Skip to content

Commit 7d62746

Browse files
committed
Fix #14: Save follow setting
1 parent b4bdd30 commit 7d62746

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

app/build.gradle

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ android {
77
applicationId "org.nitri.opentopo"
88
minSdkVersion 19
99
targetSdkVersion 28
10-
versionCode 23
11-
versionName "1.11"
10+
versionCode 24
11+
versionName "1.11.1"
1212
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1313
vectorDrawables.useSupportLibrary = true
1414
}
@@ -30,16 +30,16 @@ android {
3030
dependencies {
3131
implementation fileTree(dir: 'libs', include: ['*.jar'])
3232
//noinspection GradleCompatible
33-
implementation 'androidx.appcompat:appcompat:1.1.0'
33+
implementation 'androidx.appcompat:appcompat:1.2.0'
3434
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
3535
implementation 'androidx.recyclerview:recyclerview:1.2.0-alpha03'
36-
implementation 'com.google.android.material:material:1.1.0'
36+
implementation 'com.google.android.material:material:1.2.0'
3737
implementation 'org.osmdroid:osmdroid-android:6.0.3'
3838
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
3939
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
4040
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
4141
implementation 'com.squareup.retrofit2:converter-gson:2.2.0'
42-
implementation 'com.google.code.gson:gson:2.8.5'
42+
implementation 'com.google.code.gson:gson:2.8.6'
4343
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
4444
implementation 'androidx.room:room-runtime:2.2.5'
4545
annotationProcessor 'androidx.room:room-compiler:2.2.5'
@@ -56,6 +56,6 @@ dependencies {
5656
exclude group: 'com.android.support', module: 'exifinterface'
5757
}
5858
testImplementation 'junit:junit:4.12'
59-
androidTestImplementation 'androidx.test:runner:1.3.0-rc01'
60-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-rc01'
59+
androidTestImplementation 'androidx.test:runner:1.3.0'
60+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
6161
}

app/src/main/java/org/nitri/opentopo/MapFragment.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ public boolean onZoom(ZoomEvent event) {
121121
private final static String PREF_OVERLAY = "overlay";
122122
private final static String PREF_LATITUDE = "latitude";
123123
private final static String PREF_LONGITUDE = "longitude";
124+
private final static String PREF_FOLLOW = "follow";
124125

125126
private final static int BASE_MAP_OTM = 1;
126127
private final static int BASE_MAP_OSM = 2;
@@ -218,6 +219,9 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
218219
}
219220

220221
mMapView.getController().setZoom(mZoomState);
222+
223+
if (mPrefs.getBoolean(PREF_FOLLOW, false))
224+
enableFollow();
221225
}
222226

223227
@Override
@@ -382,6 +386,7 @@ private void enableFollow() {
382386
mLocationOverlay.enableFollowLocation();
383387
mMapHandler.removeCallbacks(mCenterRunnable);
384388
mMapHandler.post(mCenterRunnable);
389+
mPrefs.edit().putBoolean(PREF_FOLLOW, true).apply();
385390
}
386391

387392
private void disableFollow() {
@@ -390,6 +395,7 @@ private void disableFollow() {
390395
((AppCompatActivity) getActivity()).supportInvalidateOptionsMenu();
391396
mLocationOverlay.disableFollowLocation();
392397
mMapHandler.removeCallbacks(mCenterRunnable);
398+
mPrefs.edit().putBoolean(PREF_FOLLOW, false).apply();
393399
}
394400

395401
private void saveMapCenterPrefs() {

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ buildscript {
77
jcenter()
88
}
99
dependencies {
10-
classpath 'com.android.tools.build:gradle:3.6.3'
10+
classpath 'com.android.tools.build:gradle:4.0.0'
1111
}
1212
}
1313

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Mon Mar 23 15:52:08 CET 2020
1+
#Fri Aug 07 12:27:52 CEST 2020
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

0 commit comments

Comments
 (0)