[android] #4635 - fix rotate disabled with location tracking
This commit is contained in:
@@ -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";
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user