summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentOptions.java
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentOptions.java')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentOptions.java76
1 files changed, 73 insertions, 3 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentOptions.java
index 10dfff8694..58b86c7b3a 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentOptions.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentOptions.java
@@ -111,6 +111,8 @@ public class LocationComponentOptions implements Parcelable {
private float trackingMultiFingerMoveThreshold;
private String layerBelow;
private float trackingAnimationDurationMultiplier;
+ private boolean compassAnimationEnabled;
+ private boolean accuracyAnimationEnabled;
public LocationComponentOptions(
float accuracyAlpha,
@@ -144,7 +146,9 @@ public class LocationComponentOptions implements Parcelable {
float trackingInitialMoveThreshold,
float trackingMultiFingerMoveThreshold,
String layerBelow,
- float trackingAnimationDurationMultiplier) {
+ float trackingAnimationDurationMultiplier,
+ boolean compassAnimationEnabled,
+ boolean accuracyAnimationEnabled) {
this.accuracyAlpha = accuracyAlpha;
this.accuracyColor = accuracyColor;
this.backgroundDrawableStale = backgroundDrawableStale;
@@ -180,6 +184,8 @@ public class LocationComponentOptions implements Parcelable {
this.trackingMultiFingerMoveThreshold = trackingMultiFingerMoveThreshold;
this.layerBelow = layerBelow;
this.trackingAnimationDurationMultiplier = trackingAnimationDurationMultiplier;
+ this.compassAnimationEnabled = compassAnimationEnabled;
+ this.accuracyAnimationEnabled = accuracyAnimationEnabled;
}
/**
@@ -304,6 +310,14 @@ public class LocationComponentOptions implements Parcelable {
);
builder.trackingAnimationDurationMultiplier(trackingAnimationDurationMultiplier);
+ builder.compassAnimationEnabled = typedArray.getBoolean(
+ R.styleable.mapbox_LocationComponent_mapbox_compassAnimationEnabled, true
+ );
+
+ builder.accuracyAnimationEnabled = typedArray.getBoolean(
+ R.styleable.mapbox_LocationComponent_mapbox_accuracyAnimationEnabled, true
+ );
+
typedArray.recycle();
return builder.build();
@@ -723,6 +737,26 @@ public class LocationComponentOptions implements Parcelable {
return trackingAnimationDurationMultiplier;
}
+ /**
+ * Enable or disable smooth animation of compass values for {@link com.mapbox.mapboxsdk.location.modes.CameraMode}
+ * and {@link com.mapbox.mapboxsdk.location.modes.RenderMode}.
+ *
+ * @return whether smooth compass animation is enabled
+ */
+ public boolean compassAnimationEnabled() {
+ return compassAnimationEnabled;
+ }
+
+ /**
+ * Enable or disable smooth animation of the accuracy circle around the user's position.
+ *
+ * @return whether smooth animation of the accuracy circle is enabled
+ */
+ public boolean accuracyAnimationEnabled() {
+ return accuracyAnimationEnabled;
+ }
+
+ @NonNull
@Override
public String toString() {
return "LocationComponentOptions{"
@@ -882,6 +916,10 @@ public class LocationComponentOptions implements Parcelable {
h$ ^= Float.floatToIntBits(trackingMultiFingerMoveThreshold);
h$ *= 1000003;
h$ ^= Float.floatToIntBits(trackingAnimationDurationMultiplier);
+ h$ *= 1000003;
+ h$ ^= compassAnimationEnabled ? 1231 : 1237;
+ h$ *= 1000003;
+ h$ ^= accuracyAnimationEnabled ? 1231 : 1237;
return h$;
}
@@ -921,7 +959,9 @@ public class LocationComponentOptions implements Parcelable {
in.readFloat(),
in.readFloat(),
in.readString(),
- in.readFloat()
+ in.readFloat(),
+ in.readInt() == 1,
+ in.readInt() == 1
);
}
@@ -1020,6 +1060,8 @@ public class LocationComponentOptions implements Parcelable {
dest.writeFloat(trackingMultiFingerMoveThreshold());
dest.writeString(layerBelow());
dest.writeFloat(trackingAnimationDurationMultiplier);
+ dest.writeInt(compassAnimationEnabled() ? 1 : 0);
+ dest.writeInt(accuracyAnimationEnabled() ? 1 : 0);
}
@Override
@@ -1084,6 +1126,8 @@ public class LocationComponentOptions implements Parcelable {
private Float trackingMultiFingerMoveThreshold;
private String layerBelow;
private Float trackingAnimationDurationMultiplier;
+ private Boolean compassAnimationEnabled;
+ private Boolean accuracyAnimationEnabled;
Builder() {
}
@@ -1121,6 +1165,8 @@ public class LocationComponentOptions implements Parcelable {
this.trackingMultiFingerMoveThreshold = source.trackingMultiFingerMoveThreshold();
this.layerBelow = source.layerBelow();
this.trackingAnimationDurationMultiplier = source.trackingAnimationDurationMultiplier();
+ this.compassAnimationEnabled = source.compassAnimationEnabled();
+ this.accuracyAnimationEnabled = source.accuracyAnimationEnabled();
}
/**
@@ -1556,6 +1602,28 @@ public class LocationComponentOptions implements Parcelable {
return this;
}
+ /**
+ * Enable or disable smooth animation of compass values for {@link com.mapbox.mapboxsdk.location.modes.CameraMode}
+ * and {@link com.mapbox.mapboxsdk.location.modes.RenderMode}.
+ *
+ * @return whether smooth compass animation is enabled
+ */
+ public LocationComponentOptions.Builder compassAnimationEnabled(Boolean compassAnimationEnabled) {
+ this.compassAnimationEnabled = compassAnimationEnabled;
+ return this;
+ }
+
+ /**
+ * Enable or disable smooth animation of the accuracy circle around the user's position.
+ *
+ * @return whether smooth animation of the accuracy circle is enabled
+ */
+ public Builder accuracyAnimationEnabled(Boolean accuracyAnimationEnabled) {
+ this.accuracyAnimationEnabled = accuracyAnimationEnabled;
+ return this;
+ }
+
+ @Nullable
LocationComponentOptions autoBuild() {
String missing = "";
if (this.accuracyAlpha == null) {
@@ -1653,7 +1721,9 @@ public class LocationComponentOptions implements Parcelable {
this.trackingInitialMoveThreshold,
this.trackingMultiFingerMoveThreshold,
this.layerBelow,
- this.trackingAnimationDurationMultiplier);
+ this.trackingAnimationDurationMultiplier,
+ this.compassAnimationEnabled,
+ this.accuracyAnimationEnabled);
}
}
}