diff options
author | Langston Smith <langston.smith@mapbox.com> | 2019-03-04 07:21:06 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-04 07:21:06 -0800 |
commit | 4bc56cc5764779ec23325530dfb6acfef125ccf8 (patch) | |
tree | 7de48210f756ef14fb913171ce63c7c12e66eed7 /platform | |
parent | 74538406e9e7f9444e491ea23b7dc52f63d77e73 (diff) | |
download | qtlocation-mapboxgl-4bc56cc5764779ec23325530dfb6acfef125ccf8.tar.gz |
[android] added areAllGesturesEnabled() method and test (#14022)
Diffstat (limited to 'platform')
2 files changed, 27 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 3e24b8c797..034dc63c35 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 @@ -939,6 +939,18 @@ public final class UiSettings { setQuickZoomGesturesEnabled(enabled); } + /** + * <p> + * Retrieves the current status of whether all gestures are enabled. + * </p> + * + * @return If true, all gestures are enabled. + */ + public boolean areAllGesturesEnabled() { + return rotateGesturesEnabled && tiltGesturesEnabled && zoomGesturesEnabled + && scrollGesturesEnabled && doubleTapGesturesEnabled && quickZoomGesturesEnabled; + } + private void saveFocalPoint(Bundle outState) { outState.putParcelable(MapboxConstants.STATE_USER_FOCAL_POINT, getFocalPoint()); } diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/UiSettingsTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/UiSettingsTest.java index b53c4692d9..79dcd5bc6c 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/UiSettingsTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/UiSettingsTest.java @@ -384,4 +384,19 @@ public class UiSettingsTest { assertEquals("Zoom gesture should be disabled", false, uiSettings.isZoomGesturesEnabled()); assertEquals("Scroll gesture should be disabled", false, uiSettings.isScrollGesturesEnabled()); } + + @Test + public void testAreAllGesturesEnabled() { + uiSettings.setAllGesturesEnabled(true); + assertEquals("All gestures check should return true", true, + uiSettings.areAllGesturesEnabled()); + } + + @Test + public void testAreAllGesturesEnabledWithOneGestureDisabled() { + uiSettings.setAllGesturesEnabled(true); + uiSettings.setScrollGesturesEnabled(false); + assertEquals("All gestures check should return false", false, + uiSettings.areAllGesturesEnabled()); + } } |