Skip to content
This repository has been archived by the owner on Oct 20, 2024. It is now read-only.

WHERETOGO-0015 Обновление токена Maps API #37

Merged
merged 3 commits into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion where-to-go-ui/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.android.gms:play-services-maps:18.1.0'
implementation 'com.google.android.gms:play-services-maps:18.2.0'
implementation 'com.google.android.libraries.places:places:3.2.0'
implementation 'androidx.slidingpanelayout:slidingpanelayout:1.2.0'
implementation 'com.google.maps.android:android-maps-utils:2.3.0'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<resources>
<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">AIzaSyC9dGX3Qyf3Nn3GAUd915c27a2MhOhMdMA</string>
<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">AIzaSyDAOjAKQK3Tl6h4tHaMeBWWh4NKTg5FMq8</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class ForYouActivity extends AppCompatActivity {
private ImageButton recommendByScoredBtn;
private ImageButton recommendByOthersBtn;
private ImageButton recommendByGPSBtn;
private ImageButton recommendPath;
private Location lastLocation;

@Override
Expand All @@ -51,6 +52,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
recommendByScoredBtn = (ImageButton) findViewById(R.id.by_scored_btn);
recommendByOthersBtn = (ImageButton) findViewById(R.id.by_others_btn);
recommendByGPSBtn = (ImageButton) findViewById(R.id.by_gps_btn);
recommendPath = (ImageButton) findViewById(R.id.make_path_btn);

Call<Boolean> checkStayPoints = ServiceGenerator.createService(StayPointService.class).isUserHasStayPoints();
checkStayPoints.enqueue(new Callback<Boolean>() {
Expand Down Expand Up @@ -138,6 +140,7 @@ public void onFailure(@NonNull Call<Boolean> call, @NonNull Throwable t) {
recommendByGPSBtn.setOnClickListener(this::openNearestRecommender);
}

recommendPath.setOnClickListener(this::openPathRecommender);
}

public void openNearestRecommender(View view) {
Expand Down Expand Up @@ -176,6 +179,11 @@ public void openUsersRecommender(View view) {
startActivity(intent);
}

public void openPathRecommender(View view) {
Log.d(TAG, "Open path settings for recommendation");
recommendPath.setImageResource(R.drawable.make_path_btn_selected);
}

//Блокирует кнопку вызова рекомендации в случае, если не хватает данных
private void blockRecommendButton(ImageButton imageButton) {
imageButton.setClickable(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapsInitializer;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.OnMapsSdkInitializedCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MapStyleOptions;
Expand Down Expand Up @@ -68,10 +70,10 @@
import ru.nsu.fit.wheretogo.util.PictureLoader;
import ru.nsu.fit.wheretogo.util.helper.AuthorizationHelper;

public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {
public class MapsActivity extends FragmentActivity implements OnMapReadyCallback, OnMapsSdkInitializedCallback {

private static final String TAG = MapsActivity.class.getSimpleName();
private static final int DEFAULT_ZOOM = 12;
private static final int DEFAULT_ZOOM = 13;
private static final int PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION = 1;
private static final String KEY_LOCATION = "location";
private static final String LAST_LOCATION_STR = "lastLocation";
Expand All @@ -95,6 +97,7 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MapsInitializer.initialize(getApplicationContext(), MapsInitializer.Renderer.LATEST, this);
Log.i(TAG, "Инициализация списка категорий");
getCategories(null, null);

Expand Down Expand Up @@ -837,6 +840,18 @@ public void onFailure(@NonNull Call<List<Category>> call, @NonNull Throwable t)
});
}

@Override
public void onMapsSdkInitialized(@NonNull MapsInitializer.Renderer renderer) {
switch (renderer) {
case LATEST:
Log.d(TAG, "The latest version of the renderer is used.");
break;
case LEGACY:
Log.d(TAG, "The legacy version of the renderer is used.");
break;
}
}

private static class BooleanWrapper {
private boolean value;

Expand Down
Binary file modified where-to-go-ui/app/src/main/res/drawable-v24/make_path_btn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified where-to-go-ui/app/src/main/res/drawable-v24/make_path_field.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified where-to-go-ui/app/src/main/res/drawable-v24/recoomend_btn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions where-to-go-ui/app/src/main/res/layout/activity_for_you.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="56dp"
android:layout_marginEnd="76dp"
android:layout_marginStart="67dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="66dp"
android:layout_marginBottom="22dp"
android:background="@android:color/transparent"
app:layout_constraintBottom_toTopOf="@+id/imageView10"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/recoomend_btn" />

<ImageView
Expand Down
2 changes: 1 addition & 1 deletion where-to-go-ui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.1.2'
classpath 'com.android.tools.build:gradle:8.2.0'
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.2.0"
}
}
Expand Down
2 changes: 1 addition & 1 deletion where-to-go-ui/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Oct 12 00:37:43 NOVT 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME