[android] improved gestures management while tracking location
This commit is contained in:
committed by
Łukasz Paczos
parent
907612e93d
commit
8cd86fe1b4
@@ -158,6 +158,12 @@ public class LocationModesActivity extends AppCompatActivity implements OnMapRea
|
||||
} else if (id == R.id.action_component_enabled) {
|
||||
activateLocationComponent();
|
||||
return true;
|
||||
} else if (id == R.id.action_gestures_management_disabled) {
|
||||
disableGesturesManagement();
|
||||
return true;
|
||||
} else if (id == R.id.action_gestures_management_enabled) {
|
||||
enableGesturesManagement();
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
@@ -192,18 +198,36 @@ public class LocationModesActivity extends AppCompatActivity implements OnMapRea
|
||||
}
|
||||
}
|
||||
|
||||
public void toggleStyle() {
|
||||
private void toggleStyle() {
|
||||
customStyle = !customStyle;
|
||||
locationComponent.applyStyle(
|
||||
this,
|
||||
customStyle ? R.style.CustomLocationComponent : R.style.mapbox_LocationComponent);
|
||||
}
|
||||
|
||||
public void toggleMapStyle() {
|
||||
private void toggleMapStyle() {
|
||||
String styleUrl = mapboxMap.getStyleUrl().contentEquals(Style.DARK) ? Style.LIGHT : Style.DARK;
|
||||
mapboxMap.setStyle(styleUrl);
|
||||
}
|
||||
|
||||
private void disableGesturesManagement() {
|
||||
LocationComponentOptions options = locationComponent
|
||||
.getLocationComponentOptions()
|
||||
.toBuilder()
|
||||
.trackingGesturesManagement(false)
|
||||
.build();
|
||||
locationComponent.applyStyle(options);
|
||||
}
|
||||
|
||||
private void enableGesturesManagement() {
|
||||
LocationComponentOptions options = locationComponent
|
||||
.getLocationComponentOptions()
|
||||
.toBuilder()
|
||||
.trackingGesturesManagement(true)
|
||||
.build();
|
||||
locationComponent.applyStyle(options);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings( {"MissingPermission"})
|
||||
protected void onStart() {
|
||||
|
||||
@@ -10,11 +10,18 @@
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item android:id="@+id/action_component_disable"
|
||||
android:title="Disable"
|
||||
android:title="Disable Component"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
|
||||
<item android:id="@+id/action_component_enabled"
|
||||
android:title="Enabled"
|
||||
android:title="Enable Component"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item android:id="@+id/action_gestures_management_enabled"
|
||||
android:title="Enable Gestures Management"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item android:id="@+id/action_gestures_management_disabled"
|
||||
android:title="Disable Gestures Management"
|
||||
app:showAsAction="never"/>
|
||||
</menu>
|
||||
Reference in New Issue
Block a user