summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/MapboxAnimator.java
diff options
context:
space:
mode:
authorŁukasz Paczos <lukas.paczos@gmail.com>2018-09-05 14:30:36 +0200
committerŁukasz Paczos <lukasz.paczos@mapbox.com>2018-09-12 13:59:11 +0200
commit907612e93d8a2b156d4604fda348707ccb347836 (patch)
tree830bc854430f31e5f688d3d849fbb81599ea0ce0 /platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/MapboxAnimator.java
parentcf7752c80c1dab6a818fb5093bee5cd964990525 (diff)
downloadqtlocation-mapboxgl-907612e93d8a2b156d4604fda348707ccb347836.tar.gz
[android] updated naming scheme and packages structure for LocationLayerPlugin, now called LocationComponent
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/MapboxAnimator.java')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/MapboxAnimator.java92
1 files changed, 92 insertions, 0 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/MapboxAnimator.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/MapboxAnimator.java
new file mode 100644
index 0000000000..b22601a15c
--- /dev/null
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/MapboxAnimator.java
@@ -0,0 +1,92 @@
+package com.mapbox.mapboxsdk.location;
+
+import android.animation.TypeEvaluator;
+import android.animation.ValueAnimator;
+import android.support.annotation.IntDef;
+
+import com.mapbox.mapboxsdk.geometry.LatLng;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.util.List;
+
+/**
+ * Abstract class for all of the plugin animators.
+ *
+ * @param <K> Data type that will be animated.
+ * @param <L> Listener of animation updates.
+ */
+abstract class MapboxAnimator<K, L> extends ValueAnimator implements ValueAnimator.AnimatorUpdateListener {
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef( {
+ ANIMATOR_LAYER_LATLNG,
+ ANIMATOR_CAMERA_LATLNG,
+ ANIMATOR_LAYER_GPS_BEARING,
+ ANIMATOR_LAYER_COMPASS_BEARING,
+ ANIMATOR_CAMERA_GPS_BEARING,
+ ANIMATOR_CAMERA_COMPASS_BEARING,
+ ANIMATOR_LAYER_ACCURACY,
+ ANIMATOR_ZOOM,
+ ANIMATOR_TILT
+ })
+ @interface Type {
+ }
+
+ static final int ANIMATOR_LAYER_LATLNG = 0;
+ static final int ANIMATOR_CAMERA_LATLNG = 1;
+ static final int ANIMATOR_LAYER_GPS_BEARING = 2;
+ static final int ANIMATOR_LAYER_COMPASS_BEARING = 3;
+ static final int ANIMATOR_CAMERA_GPS_BEARING = 4;
+ static final int ANIMATOR_CAMERA_COMPASS_BEARING = 5;
+ static final int ANIMATOR_LAYER_ACCURACY = 6;
+ static final int ANIMATOR_ZOOM = 7;
+ static final int ANIMATOR_TILT = 8;
+
+ private final int animatorType = provideAnimatorType();
+ final List<L> updateListeners;
+ private final K target;
+
+ MapboxAnimator(K previous, K target, List<L> updateListeners) {
+ setObjectValues(previous, target);
+ setEvaluator(provideEvaluator());
+ this.updateListeners = updateListeners;
+ this.target = target;
+ addUpdateListener(this);
+ }
+
+ K getTarget() {
+ return target;
+ }
+
+ @Type
+ int getAnimatorType() {
+ return animatorType;
+ }
+
+ @Type
+ abstract int provideAnimatorType();
+
+ abstract TypeEvaluator provideEvaluator();
+
+ interface OnLayerAnimationsValuesChangeListener {
+ void onNewLatLngValue(LatLng latLng);
+
+ void onNewGpsBearingValue(float gpsBearing);
+
+ void onNewCompassBearingValue(float compassBearing);
+
+ void onNewAccuracyRadiusValue(float accuracyRadiusValue);
+ }
+
+ interface OnCameraAnimationsValuesChangeListener {
+ void onNewLatLngValue(LatLng latLng);
+
+ void onNewGpsBearingValue(float gpsBearing);
+
+ void onNewCompassBearingValue(float compassBearing);
+
+ void onNewZoomValue(float zoom);
+
+ void onNewTiltValue(float tilt);
+ }
+}