diff options
author | srabenja <sam.rabenja@gmail.com> | 2017-02-04 02:17:59 -0500 |
---|---|---|
committer | Tobrun <tobrun.van.nuland@gmail.com> | 2017-02-04 08:17:59 +0100 |
commit | 1dead1d19463599d0008bb5bc04f9e243603f3ff (patch) | |
tree | 8189ddd80b455832f9cb72e9fec928fe821bc4ef /platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java | |
parent | d9c055ad3463a5050dee1a63bb5d39893493d57f (diff) | |
download | qtlocation-mapboxgl-1dead1d19463599d0008bb5bc04f9e243603f3ff.tar.gz |
Disable double tap gesture to zoom in (#7879)
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java')
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java | 45 |
1 files changed, 45 insertions, 0 deletions
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 bb5271313b..8a3ae1e4f3 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 @@ -48,6 +48,9 @@ public final class UiSettings { private boolean zoomControlsEnabled; + private boolean doubleTapGesturesEnabled = true; + private boolean doubleTapGestureChangeAllowed = true; + private boolean deselectMarkersOnTap = true; private PointF userProvidedFocalPoint; @@ -99,6 +102,8 @@ public final class UiSettings { setTiltGesturesEnabled(options.getTiltGesturesEnabled()); setTiltGestureChangeAllowed(options.getTiltGesturesEnabled()); setZoomControlsEnabled(options.getZoomControlsEnabled()); + setDoubleTapGesturesEnabled(options.getDoubleTapGesturesEnabled()); + setDoubleTapGestureChangeAllowed(options.getDoubleTapGesturesEnabled()); } private void saveGestures(Bundle outState) { @@ -110,6 +115,8 @@ public final class UiSettings { outState.putBoolean(MapboxConstants.STATE_ROTATE_ENABLED_CHANGE, isRotateGestureChangeAllowed()); outState.putBoolean(MapboxConstants.STATE_TILT_ENABLED, isTiltGesturesEnabled()); outState.putBoolean(MapboxConstants.STATE_TILT_ENABLED_CHANGE, isTiltGestureChangeAllowed()); + outState.putBoolean(MapboxConstants.STATE_DOUBLE_TAP_ENABLED, isDoubleTapGesturesEnabled()); + outState.putBoolean(MapboxConstants.STATE_DOUBLE_TAP_ENABLED_CHANGE, isDoubleTapGestureChangeAllowed()); } private void restoreGestures(Bundle savedInstanceState) { @@ -121,6 +128,8 @@ public final class UiSettings { setRotateGestureChangeAllowed(savedInstanceState.getBoolean(MapboxConstants.STATE_ROTATE_ENABLED_CHANGE)); setTiltGesturesEnabled(savedInstanceState.getBoolean(MapboxConstants.STATE_TILT_ENABLED)); setTiltGestureChangeAllowed(savedInstanceState.getBoolean(MapboxConstants.STATE_TILT_ENABLED_CHANGE)); + setDoubleTapGesturesEnabled(savedInstanceState.getBoolean(MapboxConstants.STATE_DOUBLE_TAP_ENABLED)); + setDoubleTapGestureChangeAllowed(savedInstanceState.getBoolean(MapboxConstants.STATE_DOUBLE_TAP_ENABLED_CHANGE)); } private void initialiseCompass(MapboxMapOptions options, Resources resources) { @@ -696,6 +705,41 @@ public final class UiSettings { } /** + * <p> + * Changes whether the user may zoom the map with a double tap. + * </p> + * <p> + * This setting controls only user interactions with the map. If you set the value to false, + * you may still change the map location programmatically. + * </p> + * The default value is true. + * + * @param doubleTapGesturesEnabled If true, zooming with a double tap is enabled. + */ + public void setDoubleTapGesturesEnabled(boolean doubleTapGesturesEnabled) { + if (doubleTapGestureChangeAllowed) { + this.doubleTapGesturesEnabled = doubleTapGesturesEnabled; + } + } + + /** + * Returns whether the user may zoom the map with a double tap. + * + * @return If true, zooming with a double tap is enabled. + */ + public boolean isDoubleTapGesturesEnabled() { + return doubleTapGesturesEnabled; + } + + void setDoubleTapGestureChangeAllowed(boolean doubleTapGestureChangeAllowed) { + this.doubleTapGestureChangeAllowed = doubleTapGestureChangeAllowed; + } + + boolean isDoubleTapGestureChangeAllowed() { + return doubleTapGestureChangeAllowed; + } + + /** * Gets whether the markers are automatically deselected (and therefore, their infowindows * closed) when a map tap is detected. * @@ -771,6 +815,7 @@ public final class UiSettings { setRotateGesturesEnabled(enabled); setTiltGesturesEnabled(enabled); setZoomGesturesEnabled(enabled); + setDoubleTapGesturesEnabled(enabled); } /** |