summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorŁukasz Paczos <lukas.paczos@gmail.com>2019-01-25 10:47:29 +0100
committerŁukasz Paczos <lukasz.paczos@mapbox.com>2019-01-25 15:07:22 +0100
commitd7cd06eb55a4bdce3edbd86f6ab6088d5e7e8331 (patch)
tree1caa4e7aaf902b808d21b3c754eb20fbd8427747
parentbe94efa4024271cf6307baaa1e3317c3ec055b3b (diff)
downloadqtlocation-mapboxgl-d7cd06eb55a4bdce3edbd86f6ab6088d5e7e8331.tar.gz
[android] expose quick zoom option xml attribute
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java2
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/res-public/values/public.xml1
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/res/values/attrs.xml1
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/GestureDetectorActivity.java13
4 files changed, 8 insertions, 9 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java
index 91895e64ad..acfe8ede43 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java
@@ -158,6 +158,8 @@ public class MapboxMapOptions implements Parcelable {
typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_uiTiltGestures, true));
mapboxMapOptions.doubleTapGesturesEnabled(
typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_uiDoubleTapGestures, true));
+ mapboxMapOptions.quickZoomGesturesEnabled(
+ typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_uiQuickZoomGestures, true));
mapboxMapOptions.maxZoomPreference(typedArray.getFloat(R.styleable.mapbox_MapView_mapbox_cameraZoomMax,
MapboxConstants.MAXIMUM_ZOOM));
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res-public/values/public.xml b/platform/android/MapboxGLAndroidSDK/src/main/res-public/values/public.xml
index b259b774da..58109257f2 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/res-public/values/public.xml
+++ b/platform/android/MapboxGLAndroidSDK/src/main/res-public/values/public.xml
@@ -31,6 +31,7 @@
<public name="mapbox_uiRotateGestures" type="attr" />
<public name="mapbox_uiTiltGestures" type="attr" />
<public name="mapbox_uiDoubleTapGestures" type="attr" />
+ <public name="mapbox_uiQuickZoomGestures" type="attr" />
<!--Compass-->
<public name="mapbox_uiCompass" type="attr" />
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values/attrs.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values/attrs.xml
index c1c9b91056..2eeb5057f2 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/res/values/attrs.xml
+++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values/attrs.xml
@@ -24,6 +24,7 @@
<attr name="mapbox_uiRotateGestures" format="boolean"/>
<attr name="mapbox_uiTiltGestures" format="boolean"/>
<attr name="mapbox_uiDoubleTapGestures" format="boolean"/>
+ <attr name="mapbox_uiQuickZoomGestures" format="boolean"/>
<!--Compass-->
<attr name="mapbox_uiCompass" format="boolean"/>
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/GestureDetectorActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/GestureDetectorActivity.java
index 88e8996ccd..f4639b0f1a 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/GestureDetectorActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/GestureDetectorActivity.java
@@ -124,11 +124,6 @@ public class GestureDetectorActivity extends AppCompatActivity {
mapView.onSaveInstanceState(outState);
}
- @Override
- protected void onRestoreInstanceState(Bundle savedInstanceState) {
- super.onRestoreInstanceState(savedInstanceState);
- }
-
private void initializeMap() {
gesturesManager = mapboxMap.getGesturesManager();
@@ -139,7 +134,7 @@ public class GestureDetectorActivity extends AppCompatActivity {
attachListeners();
- focusOnAPoint(mapboxMap.getUiSettings().getFocalPoint() != null);
+ fixedFocalPointEnabled(mapboxMap.getUiSettings().getFocalPoint() != null);
}
public void attachListeners() {
@@ -239,7 +234,7 @@ public class GestureDetectorActivity extends AppCompatActivity {
UiSettings uiSettings = mapboxMap.getUiSettings();
switch (item.getItemId()) {
case R.id.menu_gesture_focus_point:
- focusOnAPoint(focalPointLatLng == null);
+ fixedFocalPointEnabled(focalPointLatLng == null);
return true;
case R.id.menu_gesture_animation:
uiSettings.setScaleVelocityAnimationEnabled(!uiSettings.isScaleVelocityAnimationEnabled());
@@ -268,8 +263,8 @@ public class GestureDetectorActivity extends AppCompatActivity {
return super.onOptionsItemSelected(item);
}
- private void focusOnAPoint(boolean focus) {
- if (focus) {
+ private void fixedFocalPointEnabled(boolean enabled) {
+ if (enabled) {
focalPointLatLng = new LatLng(51.50325, -0.12968);
marker = mapboxMap.addMarker(new MarkerOptions().position(focalPointLatLng));
mapboxMap.easeCamera(CameraUpdateFactory.newLatLngZoom(focalPointLatLng, 16));