diff options
author | Tobrun <tobrun@mapbox.com> | 2016-04-08 11:25:50 +0200 |
---|---|---|
committer | Tobrun <tobrun@mapbox.com> | 2016-04-08 11:25:50 +0200 |
commit | 35b579fde196ec3dd2a487ab5d528c8662571a43 (patch) | |
tree | fd2eb7aa095acbc00d3e31306cd320a36efb1233 /platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk | |
parent | 18495fc19d4d6224b3d59db18f22305de533a368 (diff) | |
download | qtlocation-mapboxgl-35b579fde196ec3dd2a487ab5d528c8662571a43.tar.gz |
[android] #4635 - fix rotate disabled with location tracking
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk')
3 files changed, 77 insertions, 12 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 80d9a06890..752ba01fac 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 @@ -71,9 +71,13 @@ public class MapboxConstants { public static final String STATE_HAS_SAVED_STATE = "savedState"; public static final String STATE_CAMERA_POSITION = "cameraPosition"; public static final String STATE_ZOOM_ENABLED = "zoomEnabled"; + public static final String STATE_ZOOM_ENABLED_CHANGE = "zoomEnabledChange"; public static final String STATE_SCROLL_ENABLED = "scrollEnabled"; + public static final String STATE_SCROLL_ENABLED_CHANGE = "scrollEnabledChange"; public static final String STATE_ROTATE_ENABLED = "rotateEnabled"; + public static final String STATE_ROTATE_ENABLED_CHANGE = "rotateEnabledChange"; public static final String STATE_TILT_ENABLED = "tiltEnabled"; + public static final String STATE_TILT_ENABLED_CHANGE = "tiltEnabledChange"; public static final String STATE_ZOOM_CONTROLS_ENABLED = "zoomControlsEnabled"; public static final String STATE_DEBUG_ACTIVE = "debugActive"; public static final String STATE_STYLE_URL = "styleUrl"; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java index e0d444d79a..abe0bdc317 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java @@ -262,10 +262,19 @@ public class MapView extends FrameLayout { // Enable gestures UiSettings uiSettings = mMapboxMap.getUiSettings(); + uiSettings.setZoomGesturesEnabled(options.getZoomGesturesEnabled()); + uiSettings.setZoomGestureChangeAllowed(options.getZoomGesturesEnabled()); + uiSettings.setScrollGesturesEnabled(options.getScrollGesturesEnabled()); + uiSettings.setScrollGestureChangeAllowed(options.getScrollGesturesEnabled()); + uiSettings.setRotateGesturesEnabled(options.getRotateGesturesEnabled()); + uiSettings.setRotateGestureChangeAllowed(options.getRotateGesturesEnabled()); + uiSettings.setTiltGesturesEnabled(options.getTiltGesturesEnabled()); + uiSettings.setTiltGestureChangeAllowed(options.getTiltGesturesEnabled()); + uiSettings.setZoomControlsEnabled(options.getZoomControlsEnabled()); // Zoom @@ -338,9 +347,13 @@ public class MapView extends FrameLayout { UiSettings uiSettings = mMapboxMap.getUiSettings(); uiSettings.setZoomGesturesEnabled(savedInstanceState.getBoolean(MapboxConstants.STATE_ZOOM_ENABLED)); + uiSettings.setZoomGestureChangeAllowed(savedInstanceState.getBoolean(MapboxConstants.STATE_ZOOM_ENABLED_CHANGE)); uiSettings.setScrollGesturesEnabled(savedInstanceState.getBoolean(MapboxConstants.STATE_SCROLL_ENABLED)); + uiSettings.setScrollGestureChangeAllowed(savedInstanceState.getBoolean(MapboxConstants.STATE_SCROLL_ENABLED_CHANGE)); uiSettings.setRotateGesturesEnabled(savedInstanceState.getBoolean(MapboxConstants.STATE_ROTATE_ENABLED)); + uiSettings.setRotateGestureChangeAllowed(savedInstanceState.getBoolean(MapboxConstants.STATE_ROTATE_ENABLED_CHANGE)); uiSettings.setTiltGesturesEnabled(savedInstanceState.getBoolean(MapboxConstants.STATE_TILT_ENABLED)); + uiSettings.setTiltGestureChangeAllowed(savedInstanceState.getBoolean(MapboxConstants.STATE_TILT_ENABLED_CHANGE)); uiSettings.setZoomControlsEnabled(savedInstanceState.getBoolean(MapboxConstants.STATE_ZOOM_CONTROLS_ENABLED)); // Compass @@ -451,9 +464,13 @@ public class MapView extends FrameLayout { // UiSettings UiSettings uiSettings = mMapboxMap.getUiSettings(); outState.putBoolean(MapboxConstants.STATE_ZOOM_ENABLED, uiSettings.isZoomGesturesEnabled()); + outState.putBoolean(MapboxConstants.STATE_ZOOM_ENABLED_CHANGE, uiSettings.isZoomGestureChangeAllowed()); outState.putBoolean(MapboxConstants.STATE_SCROLL_ENABLED, uiSettings.isScrollGesturesEnabled()); + outState.putBoolean(MapboxConstants.STATE_SCROLL_ENABLED_CHANGE,uiSettings.isScrollGestureChangeAllowed()); outState.putBoolean(MapboxConstants.STATE_ROTATE_ENABLED, uiSettings.isRotateGesturesEnabled()); + outState.putBoolean(MapboxConstants.STATE_ROTATE_ENABLED_CHANGE,uiSettings.isRotateGestureChangeAllowed()); outState.putBoolean(MapboxConstants.STATE_TILT_ENABLED, uiSettings.isTiltGesturesEnabled()); + outState.putBoolean(MapboxConstants.STATE_TILT_ENABLED_CHANGE,uiSettings.isTiltGestureChangeAllowed()); outState.putBoolean(MapboxConstants.STATE_ZOOM_CONTROLS_ENABLED, uiSettings.isZoomControlsEnabled()); // UiSettings - Compass 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 f87ddb4ca1..44f113e70e 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 @@ -1,14 +1,10 @@ package com.mapbox.mapboxsdk.maps; -import android.support.annotation.FloatRange; import android.support.annotation.NonNull; import android.support.annotation.UiThread; -import android.util.Log; import android.view.Gravity; import android.view.View; -import com.mapbox.mapboxsdk.constants.MapboxConstants; - /** * Settings for the user interface of a MapboxMap. To obtain this interface, call getUiSettings(). */ @@ -20,11 +16,19 @@ public class UiSettings { private ViewSettings logoSettings; private ViewSettings attributionSettings; - private boolean rotateGesturesEnabled; - private boolean tiltGesturesEnabled; - private boolean zoomGesturesEnabled; + private boolean rotateGesturesEnabled = true; + private boolean rotateGestureChangeAllowed = true; + + private boolean tiltGesturesEnabled = true; + private boolean tiltGestureChangeAllowed = true; + + private boolean zoomGesturesEnabled = true; + private boolean zoomGestureChangeAllowed = true; + + private boolean scrollGesturesEnabled = true; + private boolean scrollGestureChangeAllowed = true; + private boolean zoomControlsEnabled; - private boolean scrollGesturesEnabled; UiSettings(@NonNull MapView mapView) { this.mapView = mapView; @@ -339,7 +343,9 @@ public class UiSettings { * @param rotateGesturesEnabled If true, rotating is enabled. */ public void setRotateGesturesEnabled(boolean rotateGesturesEnabled) { - this.rotateGesturesEnabled = rotateGesturesEnabled; + if (rotateGestureChangeAllowed) { + this.rotateGesturesEnabled = rotateGesturesEnabled; + } } /** @@ -351,6 +357,14 @@ public class UiSettings { return rotateGesturesEnabled; } + void setRotateGestureChangeAllowed(boolean rotateGestureChangeAllowed) { + this.rotateGestureChangeAllowed = rotateGestureChangeAllowed; + } + + boolean isRotateGestureChangeAllowed() { + return rotateGestureChangeAllowed; + } + /** * <p> * Changes whether the user may tilt the map. @@ -364,7 +378,9 @@ public class UiSettings { * @param tiltGesturesEnabled If true, tilting is enabled. */ public void setTiltGesturesEnabled(boolean tiltGesturesEnabled) { - this.tiltGesturesEnabled = tiltGesturesEnabled; + if (tiltGestureChangeAllowed) { + this.tiltGesturesEnabled = tiltGesturesEnabled; + } } /** @@ -376,6 +392,14 @@ public class UiSettings { return tiltGesturesEnabled; } + void setTiltGestureChangeAllowed(boolean tiltGestureChangeAllowed) { + this.tiltGestureChangeAllowed = tiltGestureChangeAllowed; + } + + boolean isTiltGestureChangeAllowed() { + return tiltGestureChangeAllowed; + } + /** * <p> * Changes whether the user may zoom the map. @@ -389,7 +413,9 @@ public class UiSettings { * @param zoomGesturesEnabled If true, zooming is enabled. */ public void setZoomGesturesEnabled(boolean zoomGesturesEnabled) { - this.zoomGesturesEnabled = zoomGesturesEnabled; + if (zoomGestureChangeAllowed) { + this.zoomGesturesEnabled = zoomGesturesEnabled; + } } /** @@ -401,6 +427,14 @@ public class UiSettings { return zoomGesturesEnabled; } + void setZoomGestureChangeAllowed(boolean zoomGestureChangeAllowed) { + this.zoomGestureChangeAllowed = zoomGestureChangeAllowed; + } + + boolean isZoomGestureChangeAllowed() { + return zoomGestureChangeAllowed; + } + /** * <p> * Sets whether the zoom controls are enabled. @@ -439,7 +473,9 @@ public class UiSettings { * @param scrollGesturesEnabled If true, scrolling is enabled. */ public void setScrollGesturesEnabled(boolean scrollGesturesEnabled) { - this.scrollGesturesEnabled = scrollGesturesEnabled; + if (scrollGestureChangeAllowed) { + this.scrollGesturesEnabled = scrollGesturesEnabled; + } } /** @@ -451,6 +487,14 @@ public class UiSettings { return scrollGesturesEnabled; } + void setScrollGestureChangeAllowed(boolean scrollGestureChangeAllowed) { + this.scrollGestureChangeAllowed = scrollGestureChangeAllowed; + } + + boolean isScrollGestureChangeAllowed() { + return scrollGestureChangeAllowed; + } + /** * <p> * Sets the preference for whether all gestures should be enabled or disabled. |