From 5e8e47a9bdf2f3107b52b76498a2b462f2184d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Paczos?= Date: Wed, 7 Mar 2018 11:30:07 +0100 Subject: [android] removed unused methods and constants --- .../mapboxsdk/constants/MapboxConstants.java | 23 ------ .../java/com/mapbox/mapboxsdk/maps/UiSettings.java | 81 ++-------------------- .../com/mapbox/mapboxsdk/maps/UiSettingsTest.java | 75 -------------------- 3 files changed, 6 insertions(+), 173 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 6f263e4635..ecd5ad8099 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 @@ -121,23 +121,13 @@ public class MapboxConstants { public static final String STATE_HAS_SAVED_STATE = "mapbox_savedState"; public static final String STATE_CAMERA_POSITION = "mapbox_cameraPosition"; public static final String STATE_ZOOM_ENABLED = "mapbox_zoomEnabled"; - public static final String STATE_ZOOM_ENABLED_CHANGE = "mapbox_zoomEnabledChange"; public static final String STATE_SCROLL_ENABLED = "mapbox_scrollEnabled"; - public static final String STATE_SCROLL_ENABLED_CHANGE = "mapbox_scrollEnabledChange"; public static final String STATE_ROTATE_ENABLED = "mapbox_rotateEnabled"; - public static final String STATE_ROTATE_ENABLED_CHANGE = "mapbox_rotateEnabledChange"; public static final String STATE_TILT_ENABLED = "mapbox_tiltEnabled"; - public static final String STATE_TILT_ENABLED_CHANGE = "mapbox_tiltEnabledChange"; public static final String STATE_ZOOM_CONTROLS_ENABLED = "mapbox_zoomControlsEnabled"; public static final String STATE_DOUBLE_TAP_ENABLED = "mapbox_doubleTapEnabled"; - public static final String STATE_DOUBLE_TAP_ENABLED_CHANGE = "mapbox_doubleTapEnabledChange"; public static final String STATE_DEBUG_ACTIVE = "mapbox_debugActive"; public static final String STATE_STYLE_URL = "mapbox_styleUrl"; - public static final String STATE_MY_LOCATION_ENABLED = "mapbox_myLocationEnabled"; - public static final String STATE_MY_LOCATION_TRACKING_MODE = "mapbox_myLocationTracking"; - public static final String STATE_MY_BEARING_TRACKING_MODE = "mapbox_myBearingTracking"; - public static final String STATE_MY_LOCATION_TRACKING_DISMISS = "mapbox_myLocationTrackingDismiss"; - public static final String STATE_MY_BEARING_TRACKING_DISMISS = "mapbox_myBearingTrackingDismiss"; public static final String STATE_COMPASS_ENABLED = "mapbox_compassEnabled"; public static final String STATE_COMPASS_GRAVITY = "mapbox_compassGravity"; public static final String STATE_COMPASS_MARGIN_LEFT = "mapbox_compassMarginLeft"; @@ -158,19 +148,6 @@ public class MapboxConstants { public static final String STATE_ATTRIBUTION_MARGIN_RIGHT = "mapbox_attrMarginRight"; public static final String STATE_ATTRIBUTION_MARGIN_BOTTOM = "mapbox_atrrMarginBottom"; public static final String STATE_ATTRIBUTION_ENABLED = "mapbox_atrrEnabled"; - public static final String STATE_LOCATION_CHANGE_ANIMATION_ENABLED = "mapbox_locationChangeAnimationEnabled"; - public static final String STATE_USING_CUSTOM_LOCATION_SOURCE = "mapbox_usingCustomLocationSource"; - public static final String STATE_LOCATION_VIEW_ENABLED = "mapbox_locViewEnabled"; - public static final String STATE_LOCATION_VIEW_FOREGROUND_DRAWABLE = "mapbox_locViewForegroundDrawable"; - public static final String STATE_LOCATION_VIEW_FOREGROUND_BEARING_DRAWABLE = "mapbox_locViewBearingDrawable"; - public static final String STATE_LOCATION_VIEW_FOREGROUND_TINT_COLOR = "mapbox_locViewForegroundTintColor"; - public static final String STATE_LOCATION_VIEW_BACKGROUND_DRAWABLE = "mapbox_locViewBackgroundDrawable"; - public static final String STATE_LOCATION_VIEW_BACKGROUND_OFFSET = "mapbox_locViewBackgroundOffset"; - public static final String STATE_LOCATION_VIEW_BACKGROUND_TINT_COLOR = "mapbox_locViewBackgroundTintColor"; - public static final String STATE_LOCATION_VIEW_ACCURACY_ALPHA = "mapbox_locViewAccuracyAlpha"; - 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 a7448cd087..f370b7e4ed 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 @@ -45,21 +45,16 @@ public final class UiSettings { private float pixelRatio; 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 doubleTapGesturesEnabled = true; - private boolean doubleTapGestureChangeAllowed = true; private boolean scaleVelocityAnimationEnabled = true; private boolean rotateVelocityAnimationEnabled = true; @@ -112,42 +107,27 @@ public final class UiSettings { private void initialiseGestures(MapboxMapOptions options) { setZoomGesturesEnabled(options.getZoomGesturesEnabled()); - setZoomGestureChangeAllowed(options.getZoomGesturesEnabled()); setScrollGesturesEnabled(options.getScrollGesturesEnabled()); - setScrollGestureChangeAllowed(options.getScrollGesturesEnabled()); setRotateGesturesEnabled(options.getRotateGesturesEnabled()); - setRotateGestureChangeAllowed(options.getRotateGesturesEnabled()); setTiltGesturesEnabled(options.getTiltGesturesEnabled()); - setTiltGestureChangeAllowed(options.getTiltGesturesEnabled()); setZoomControlsEnabled(options.getZoomControlsEnabled()); setDoubleTapGesturesEnabled(options.getDoubleTapGesturesEnabled()); - setDoubleTapGestureChangeAllowed(options.getDoubleTapGesturesEnabled()); } private void saveGestures(Bundle outState) { outState.putBoolean(MapboxConstants.STATE_ZOOM_ENABLED, isZoomGesturesEnabled()); - outState.putBoolean(MapboxConstants.STATE_ZOOM_ENABLED_CHANGE, isZoomGestureChangeAllowed()); outState.putBoolean(MapboxConstants.STATE_SCROLL_ENABLED, isScrollGesturesEnabled()); - outState.putBoolean(MapboxConstants.STATE_SCROLL_ENABLED_CHANGE, isScrollGestureChangeAllowed()); outState.putBoolean(MapboxConstants.STATE_ROTATE_ENABLED, isRotateGesturesEnabled()); - 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) { setZoomGesturesEnabled(savedInstanceState.getBoolean(MapboxConstants.STATE_ZOOM_ENABLED)); - setZoomGestureChangeAllowed(savedInstanceState.getBoolean(MapboxConstants.STATE_ZOOM_ENABLED_CHANGE)); setScrollGesturesEnabled(savedInstanceState.getBoolean(MapboxConstants.STATE_SCROLL_ENABLED)); - setScrollGestureChangeAllowed(savedInstanceState.getBoolean(MapboxConstants.STATE_SCROLL_ENABLED_CHANGE)); setRotateGesturesEnabled(savedInstanceState.getBoolean(MapboxConstants.STATE_ROTATE_ENABLED)); - 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) { @@ -662,9 +642,7 @@ public final class UiSettings { * @param rotateGesturesEnabled If true, rotating is enabled. */ public void setRotateGesturesEnabled(boolean rotateGesturesEnabled) { - if (rotateGestureChangeAllowed) { - this.rotateGesturesEnabled = rotateGesturesEnabled; - } + this.rotateGesturesEnabled = rotateGesturesEnabled; } /** @@ -676,14 +654,6 @@ public final class UiSettings { return rotateGesturesEnabled; } - void setRotateGestureChangeAllowed(boolean rotateGestureChangeAllowed) { - this.rotateGestureChangeAllowed = rotateGestureChangeAllowed; - } - - boolean isRotateGestureChangeAllowed() { - return rotateGestureChangeAllowed; - } - /** *

* Changes whether the user may tilt the map. @@ -697,9 +667,8 @@ public final class UiSettings { * @param tiltGesturesEnabled If true, tilting is enabled. */ public void setTiltGesturesEnabled(boolean tiltGesturesEnabled) { - if (tiltGestureChangeAllowed) { - this.tiltGesturesEnabled = tiltGesturesEnabled; - } + this.tiltGesturesEnabled = tiltGesturesEnabled; + } /** @@ -711,14 +680,6 @@ public final class UiSettings { return tiltGesturesEnabled; } - void setTiltGestureChangeAllowed(boolean tiltGestureChangeAllowed) { - this.tiltGestureChangeAllowed = tiltGestureChangeAllowed; - } - - boolean isTiltGestureChangeAllowed() { - return tiltGestureChangeAllowed; - } - /** *

* Changes whether the user may zoom the map. @@ -732,9 +693,7 @@ public final class UiSettings { * @param zoomGesturesEnabled If true, zooming is enabled. */ public void setZoomGesturesEnabled(boolean zoomGesturesEnabled) { - if (zoomGestureChangeAllowed) { - this.zoomGesturesEnabled = zoomGesturesEnabled; - } + this.zoomGesturesEnabled = zoomGesturesEnabled; } /** @@ -746,14 +705,6 @@ public final class UiSettings { return zoomGesturesEnabled; } - void setZoomGestureChangeAllowed(boolean zoomGestureChangeAllowed) { - this.zoomGestureChangeAllowed = zoomGestureChangeAllowed; - } - - boolean isZoomGestureChangeAllowed() { - return zoomGestureChangeAllowed; - } - /** *

* Sets whether the zoom controls are enabled. @@ -792,9 +743,7 @@ public final class UiSettings { * @param doubleTapGesturesEnabled If true, zooming with a double tap is enabled. */ public void setDoubleTapGesturesEnabled(boolean doubleTapGesturesEnabled) { - if (doubleTapGestureChangeAllowed) { - this.doubleTapGesturesEnabled = doubleTapGesturesEnabled; - } + this.doubleTapGesturesEnabled = doubleTapGesturesEnabled; } /** @@ -806,14 +755,6 @@ public final class UiSettings { return doubleTapGesturesEnabled; } - void setDoubleTapGestureChangeAllowed(boolean doubleTapGestureChangeAllowed) { - this.doubleTapGestureChangeAllowed = doubleTapGestureChangeAllowed; - } - - boolean isDoubleTapGestureChangeAllowed() { - return doubleTapGestureChangeAllowed; - } - private void restoreDeselectMarkersOnTap(Bundle savedInstanceState) { setDeselectMarkersOnTap(savedInstanceState.getBoolean(MapboxConstants.STATE_DESELECT_MARKER_ON_TAP)); } @@ -855,9 +796,7 @@ public final class UiSettings { * @param scrollGesturesEnabled If true, scrolling is enabled. */ public void setScrollGesturesEnabled(boolean scrollGesturesEnabled) { - if (scrollGestureChangeAllowed) { - this.scrollGesturesEnabled = scrollGesturesEnabled; - } + this.scrollGesturesEnabled = scrollGesturesEnabled; } /** @@ -869,14 +808,6 @@ public final class UiSettings { return scrollGesturesEnabled; } - void setScrollGestureChangeAllowed(boolean scrollGestureChangeAllowed) { - this.scrollGestureChangeAllowed = scrollGestureChangeAllowed; - } - - boolean isScrollGestureChangeAllowed() { - return scrollGestureChangeAllowed; - } - /** * Returns whether scale velocity animation should execute after users finishes a gesture. * 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 cbec0e569d..ceb64ada28 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 @@ -180,13 +180,6 @@ public class UiSettingsTest { assertEquals("Rotate gesture should be disabled", false, uiSettings.isRotateGesturesEnabled()); } - @Test - public void testRotateGestureChange() { - assertEquals("Default state should be true", true, uiSettings.isRotateGestureChangeAllowed()); - uiSettings.setRotateGestureChangeAllowed(false); - assertEquals("State should have been changed", false, uiSettings.isRotateGestureChangeAllowed()); - } - @Test public void testRotateGestureChangeAllowed() { uiSettings.setRotateGesturesEnabled(false); @@ -195,14 +188,6 @@ public class UiSettingsTest { assertEquals("Rotate gesture should be true", true, uiSettings.isRotateGesturesEnabled()); } - @Test - public void testRotateGestureChangeDisallowed() { - assertEquals("Rotate gesture should be true", true, uiSettings.isRotateGesturesEnabled()); - uiSettings.setRotateGestureChangeAllowed(false); - uiSettings.setRotateGesturesEnabled(false); - assertEquals("Rotate gesture change should be ignored", true, uiSettings.isRotateGesturesEnabled()); - } - @Test public void testTiltGesturesEnabled() { uiSettings.setTiltGesturesEnabled(true); @@ -215,13 +200,6 @@ public class UiSettingsTest { assertEquals("Tilt gesture should be disabled", false, uiSettings.isTiltGesturesEnabled()); } - @Test - public void testTiltGestureChange() { - assertEquals("Default state should be true", true, uiSettings.isTiltGestureChangeAllowed()); - uiSettings.setTiltGestureChangeAllowed(false); - assertEquals("State should have been changed", false, uiSettings.isTiltGestureChangeAllowed()); - } - @Test public void testTiltGestureChangeAllowed() { uiSettings.setTiltGesturesEnabled(false); @@ -230,14 +208,6 @@ public class UiSettingsTest { assertEquals("Tilt gesture should be true", true, uiSettings.isTiltGesturesEnabled()); } - @Test - public void testTiltGestureChangeDisallowed() { - assertEquals("Tilt gesture should be true", true, uiSettings.isTiltGesturesEnabled()); - uiSettings.setTiltGestureChangeAllowed(false); - uiSettings.setTiltGesturesEnabled(false); - assertEquals("Tilt gesture change should be ignored", true, uiSettings.isTiltGesturesEnabled()); - } - @Test public void testZoomGesturesEnabled() { uiSettings.setZoomGesturesEnabled(true); @@ -250,13 +220,6 @@ public class UiSettingsTest { assertEquals("Zoom gesture should be disabled", false, uiSettings.isZoomGesturesEnabled()); } - @Test - public void testZoomGestureChange() { - assertEquals("Default state should be true", true, uiSettings.isZoomGestureChangeAllowed()); - uiSettings.setZoomGestureChangeAllowed(false); - assertEquals("State should have been changed", false, uiSettings.isZoomGestureChangeAllowed()); - } - @Test public void testZoomGestureChangeAllowed() { uiSettings.setZoomGesturesEnabled(false); @@ -265,14 +228,6 @@ public class UiSettingsTest { assertEquals("Zoom gesture should be true", true, uiSettings.isZoomGesturesEnabled()); } - @Test - public void testZoomGestureChangeDisallowed() { - assertEquals("Zoom gesture should be true", true, uiSettings.isZoomGesturesEnabled()); - uiSettings.setZoomGestureChangeAllowed(false); - uiSettings.setZoomGesturesEnabled(false); - assertEquals("Zooom gesture change should be ignored", true, uiSettings.isZoomGesturesEnabled()); - } - @Test public void testZoomControlsEnabled() { uiSettings.setZoomControlsEnabled(true); @@ -297,13 +252,6 @@ public class UiSettingsTest { assertEquals("DoubleTap gesture should be disabled", false, uiSettings.isDoubleTapGesturesEnabled()); } - @Test - public void testDoubleTapGestureChange() { - assertEquals("Default state should be true", true, uiSettings.isDoubleTapGestureChangeAllowed()); - uiSettings.setDoubleTapGestureChangeAllowed(false); - assertEquals("State should have been changed", false, uiSettings.isDoubleTapGestureChangeAllowed()); - } - @Test public void testDoubleTapGestureChangeAllowed() { uiSettings.setDoubleTapGesturesEnabled(false); @@ -312,14 +260,6 @@ public class UiSettingsTest { assertEquals("DoubleTap gesture should be true", true, uiSettings.isDoubleTapGesturesEnabled()); } - @Test - public void testDoubleTapGestureChangeDisallowed() { - assertEquals("DoubleTap gesture should be true", true, uiSettings.isDoubleTapGesturesEnabled()); - uiSettings.setDoubleTapGestureChangeAllowed(false); - uiSettings.setDoubleTapGesturesEnabled(false); - assertEquals("DoubleTap gesture change should be ignored", true, uiSettings.isDoubleTapGesturesEnabled()); - } - @Test public void testScrollGesturesEnabled() { uiSettings.setScrollGesturesEnabled(true); @@ -332,13 +272,6 @@ public class UiSettingsTest { assertEquals("Scroll gesture should be disabled", false, uiSettings.isScrollGesturesEnabled()); } - @Test - public void testScrollGestureChange() { - assertEquals("Default state should be true", true, uiSettings.isScrollGestureChangeAllowed()); - uiSettings.setScrollGestureChangeAllowed(false); - assertEquals("State should have been changed", false, uiSettings.isScrollGestureChangeAllowed()); - } - @Test public void testScrollGestureChangeAllowed() { uiSettings.setScrollGesturesEnabled(false); @@ -347,14 +280,6 @@ public class UiSettingsTest { assertEquals("Scroll gesture should be true", true, uiSettings.isScrollGesturesEnabled()); } - @Test - public void testScrollGestureChangeDisallowed() { - assertEquals("Scroll gesture should be true", true, uiSettings.isScrollGesturesEnabled()); - uiSettings.setScrollGestureChangeAllowed(false); - uiSettings.setScrollGesturesEnabled(false); - assertEquals("Scroll gesture change should be ignored", true, uiSettings.isScrollGesturesEnabled()); - } - @Test public void testScaleVelocityAnimationEnabled() { uiSettings.setScaleVelocityAnimationEnabled(true); -- cgit v1.2.1