diff options
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/TransitionOptions.java')
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/TransitionOptions.java | 54 |
1 files changed, 49 insertions, 5 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/TransitionOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/TransitionOptions.java index acbff20e96..3fa8400eeb 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/TransitionOptions.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/TransitionOptions.java @@ -1,8 +1,6 @@ package com.mapbox.mapboxsdk.style.layers; import android.support.annotation.Keep; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; /** * Resembles transition property from the style specification. @@ -15,6 +13,8 @@ public class TransitionOptions { private long duration; @Keep private long delay; + @Keep + private boolean enablePlacementTransitions; /** * Create a transition property based on duration and a delay. @@ -23,8 +23,21 @@ public class TransitionOptions { * @param delay the delay to start the transition */ public TransitionOptions(long duration, long delay) { + this(duration, delay, true); + } + + /** + * Create a transition property. + * + * @param duration the duration of the transition + * @param delay the delay to start the transition + * @param enablePlacementTransitions the flag that describes whether the fade in/out symbol placement transition + * should be enabled. Defaults to true. + */ + public TransitionOptions(long duration, long delay, boolean enablePlacementTransitions) { this.duration = duration; this.delay = delay; + this.enablePlacementTransitions = enablePlacementTransitions; } /** @@ -33,13 +46,31 @@ public class TransitionOptions { * @param duration the duration of the transition * @param delay the delay to start the transition * @return a new transition property object + * @deprecated use {@link #fromTransitionOptions(long, long, boolean)} instead */ @Keep + @Deprecated public static TransitionOptions fromTransitionOptions(long duration, long delay) { + // Invoked from JNI only return new TransitionOptions(duration, delay); } /** + * Create a transition property. + * + * @param duration the duration of the transition + * @param delay the delay to start the transition + * @param enablePlacementTransitions the flag that describes whether the fade in/out symbol placement transition + * should be enabled. Defaults to true. + * @return a new transition property object + */ + @Keep + static TransitionOptions fromTransitionOptions(long duration, long delay, boolean enablePlacementTransitions) { + // Invoked from JNI only + return new TransitionOptions(duration, delay, enablePlacementTransitions); + } + + /** * Get the transition duration. * * @return the transition duration @@ -57,8 +88,17 @@ public class TransitionOptions { return delay; } + /** + * Get the flag that describes whether the fade in/out symbol placement transition should be enabled. + * + * @return true if the fade in/out symbol placement transition should be enabled, false otherwise + */ + public boolean isEnablePlacementTransitions() { + return enablePlacementTransitions; + } + @Override - public boolean equals(@Nullable Object o) { + public boolean equals(Object o) { if (this == o) { return true; } @@ -71,22 +111,26 @@ public class TransitionOptions { if (duration != that.duration) { return false; } - return delay == that.delay; + if (delay != that.delay) { + return false; + } + return enablePlacementTransitions == that.enablePlacementTransitions; } @Override public int hashCode() { int result = (int) (duration ^ (duration >>> 32)); result = 31 * result + (int) (delay ^ (delay >>> 32)); + result = 31 * result + (enablePlacementTransitions ? 1 : 0); return result; } - @NonNull @Override public String toString() { return "TransitionOptions{" + "duration=" + duration + ", delay=" + delay + + ", enablePlacementTransitions=" + enablePlacementTransitions + '}'; } } |