summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorTobrun <tobrun.van.nuland@gmail.com>2018-01-11 12:17:22 +0100
committerTobrun <tobrun@mapbox.com>2018-01-11 15:49:19 +0100
commita09eb55ae17e748d936ab298912b95236e4d4c64 (patch)
treeb6419a69105dfabb86a66440d584d0eaa557716d /platform
parent02c795c2e67d5661aca40e0372cb14c0bd188069 (diff)
downloadqtlocation-mapboxgl-a09eb55ae17e748d936ab298912b95236e4d4c64.tar.gz
[android] - retain configuration for user provided focal point and deselect markers on tap
Diffstat (limited to 'platform')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MapboxConstants.java3
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java23
2 files changed, 26 insertions, 0 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MapboxConstants.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MapboxConstants.java
index 3b35df4f4b..60362dd2e9 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MapboxConstants.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MapboxConstants.java
@@ -146,4 +146,7 @@ public class MapboxConstants {
public static final String STATE_LOCATION_VIEW_ACCURACY_TINT_COLOR = "mapbox_locViewAccuracyTintColor";
public static final String STATE_LOCATION_VIEW_ACCURACY_THRESHOLD = "mapbox_locViewAccuracyThreshold";
public static final String STATE_LOCATION_VIEW_PADDING = "mapbox_locViewPadding";
+ public static final String STATE_DESELECT_MARKER_ON_TAP = "mapbox_deselectMarkerOnTap";
+ public static final String STATE_USER_FOCAL_POINT = "mapbox_userFocalPoint";
+
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java
index 4f37dd6f36..3fd3e1220a 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java
@@ -91,6 +91,8 @@ public final class UiSettings {
saveLogo(outState);
saveAttribution(outState);
saveZoomControl(outState);
+ saveDeselectMarkersOnTap(outState);
+ saveFocalPoint(outState);
}
void onRestoreInstanceState(@NonNull Bundle savedInstanceState) {
@@ -99,6 +101,8 @@ public final class UiSettings {
restoreLogo(savedInstanceState);
restoreAttribution(savedInstanceState);
restoreZoomControl(savedInstanceState);
+ restoreDeselectMarkersOnTap(savedInstanceState);
+ restoreFocalPoint(savedInstanceState);
}
private void initialiseGestures(MapboxMapOptions options) {
@@ -783,6 +787,14 @@ public final class UiSettings {
return doubleTapGestureChangeAllowed;
}
+ private void restoreDeselectMarkersOnTap(Bundle savedInstanceState) {
+ setDeselectMarkersOnTap(savedInstanceState.getBoolean(MapboxConstants.STATE_DESELECT_MARKER_ON_TAP));
+ }
+
+ private void saveDeselectMarkersOnTap(Bundle outState) {
+ outState.putBoolean(MapboxConstants.STATE_DESELECT_MARKER_ON_TAP, isDeselectMarkersOnTap());
+ }
+
/**
* Gets whether the markers are automatically deselected (and therefore, their infowindows
* closed) when a map tap is detected.
@@ -862,6 +874,17 @@ public final class UiSettings {
setDoubleTapGesturesEnabled(enabled);
}
+ private void saveFocalPoint(Bundle outState) {
+ outState.putParcelable(MapboxConstants.STATE_USER_FOCAL_POINT, getFocalPoint());
+ }
+
+ private void restoreFocalPoint(Bundle savedInstanceState) {
+ PointF pointF = savedInstanceState.getParcelable(MapboxConstants.STATE_USER_FOCAL_POINT);
+ if (pointF != null) {
+ setFocalPoint(pointF);
+ }
+ }
+
/**
* Sets the focal point used as center for a gesture
*