diff options
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/MapboxAnimatorProvider.java')
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/MapboxAnimatorProvider.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/MapboxAnimatorProvider.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/MapboxAnimatorProvider.java index 938f4ec74a..36cce25d2b 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/MapboxAnimatorProvider.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/MapboxAnimatorProvider.java @@ -1,5 +1,6 @@ package com.mapbox.mapboxsdk.location; +import android.animation.ValueAnimator; import android.support.annotation.Nullable; import com.mapbox.mapboxsdk.geometry.LatLng; @@ -37,4 +38,33 @@ final class MapboxAnimatorProvider { @Nullable MapboxMap.CancelableCallback cancelableCallback) { return new MapboxCameraAnimatorAdapter(previous, target, updateListener, cancelableCallback); } + + /** + * This animator is for the LocationComponent pulsing circle. + * + * @param updateListener the listener that is found in the {@link LocationAnimatorCoordinator}'s + * listener array. + * @param maxAnimationFps the max frames per second of the pulsing animation + * @param pulseSingleDuration the number of milliseconds it takes for the animator to create + * a single pulse. + * @param pulseMaxRadius the max radius when the circle is finished with a single pulse. + * @param desiredInterpolatorFromOptions the type of Android-system interpolator to use for + * the pulsing animation (linear, accelerate, bounce, etc.) + * @return a built {@link PulsingLocationCircleAnimator} object. + */ + PulsingLocationCircleAnimator pulsingCircleAnimator(MapboxAnimator.AnimationsValueChangeListener updateListener, + int maxAnimationFps, + float pulseSingleDuration, + float pulseMaxRadius, + String desiredInterpolatorFromOptions) { + PulsingLocationCircleAnimator pulsingLocationCircleAnimator = + new PulsingLocationCircleAnimator(updateListener, maxAnimationFps, pulseMaxRadius); + pulsingLocationCircleAnimator.setDuration((long) pulseSingleDuration); + pulsingLocationCircleAnimator.setRepeatMode(ValueAnimator.RESTART); + pulsingLocationCircleAnimator.setRepeatCount(ValueAnimator.INFINITE); + pulsingLocationCircleAnimator.retrievePulseInterpolator(desiredInterpolatorFromOptions); + pulsingLocationCircleAnimator.setInterpolator( + pulsingLocationCircleAnimator.retrievePulseInterpolator(desiredInterpolatorFromOptions)); + return pulsingLocationCircleAnimator; + } } |