Class AnimationUtils


  • public class AnimationUtils
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      AnimationUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void animateAlpha​(android.view.View view, float startAlpha, float targetAlpha, long duration)  
      static void animateAlpha​(android.view.View view, float startAlpha, float targetAlpha, long duration, android.animation.Animator.AnimatorListener animatorListener)  
      static java.lang.Runnable animateFromJson​(com.airbnb.lottie.LottieAnimationView view, java.lang.String jsonFileName)
      Animates a view using a json animation file immediately.
      static java.lang.Runnable animateFromJson​(com.airbnb.lottie.LottieAnimationView view, java.lang.String jsonFileName, boolean reversed)
      Animates a view using a json animation file immediately.
      static java.lang.Runnable animateFromJson​(com.airbnb.lottie.LottieAnimationView view, java.lang.String jsonFileName, long delay)
      Animates a view using a json animation file after a certain delay.
      static java.lang.Runnable animateFromJson​(com.airbnb.lottie.LottieAnimationView view, java.lang.String jsonFileName, long delay, boolean reversed)
      Animates a view using a json animation file.
      static void animateTextSize​(android.widget.TextView view, int startTextSize, int targetTextSize, long duration)  
      static void animateToTransparent​(android.view.View view, long duration, int endVisibilityState)
      Animates the view from an opaque state to a transparent state and then sets it's visibility to the specified state.
      static void animateToTransparent​(android.view.View view, long duration, int endVisibilityState, AnimationUtils.AnimateToTransparentListener onAnimationEndCallback)
      Animates the view from an opaque state to a transparent state and then sets it's visibility to the specified state.
      static boolean areSystemAnimationsEnabled​(android.content.Context context)
      Gets a value indicating whether system animations are enabled or not.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • ANIMATION_REVERSE_PLAY_SPEED

        public static final float ANIMATION_REVERSE_PLAY_SPEED
        See Also:
        Constant Field Values
    • Constructor Detail

      • AnimationUtils

        public AnimationUtils()
    • Method Detail

      • animateAlpha

        public static void animateAlpha​(android.view.View view,
                                        float startAlpha,
                                        float targetAlpha,
                                        long duration)
      • animateAlpha

        public static void animateAlpha​(android.view.View view,
                                        float startAlpha,
                                        float targetAlpha,
                                        long duration,
                                        android.animation.Animator.AnimatorListener animatorListener)
      • animateFromJson

        public static java.lang.Runnable animateFromJson​(com.airbnb.lottie.LottieAnimationView view,
                                                         java.lang.String jsonFileName)
        Animates a view using a json animation file immediately.
        Parameters:
        view - to animate
        jsonFileName - animation
        Returns:
        true if animation played, false otherwise
      • animateFromJson

        public static java.lang.Runnable animateFromJson​(com.airbnb.lottie.LottieAnimationView view,
                                                         java.lang.String jsonFileName,
                                                         long delay)
        Animates a view using a json animation file after a certain delay.
        Parameters:
        view - to animate
        jsonFileName - animation
        delay - ms before starting animation
        Returns:
        true if animation played, false otherwise
      • animateFromJson

        public static java.lang.Runnable animateFromJson​(com.airbnb.lottie.LottieAnimationView view,
                                                         java.lang.String jsonFileName,
                                                         boolean reversed)
        Animates a view using a json animation file immediately. The animation will be reversed.
        Parameters:
        view - to animate
        jsonFileName - animation
        reversed - true if the animation should be reversed, false otherwise
        Returns:
        true if animation played, false otherwise
      • animateFromJson

        public static java.lang.Runnable animateFromJson​(com.airbnb.lottie.LottieAnimationView view,
                                                         java.lang.String jsonFileName,
                                                         long delay,
                                                         boolean reversed)
        Animates a view using a json animation file.
        Parameters:
        view - to animate
        jsonFileName - animation
        delay - ms before starting animation
        reversed - true if the animation should be reversed, false otherwise
        Returns:
        true if animation played, false otherwise
      • animateTextSize

        public static void animateTextSize​(android.widget.TextView view,
                                           int startTextSize,
                                           int targetTextSize,
                                           long duration)
      • animateToTransparent

        public static void animateToTransparent​(@NonNull
                                                android.view.View view,
                                                long duration,
                                                int endVisibilityState)
        Animates the view from an opaque state to a transparent state and then sets it's visibility to the specified state.
        Parameters:
        view - The view that will become transparent.
        duration - The duration of the animation.
        endVisibilityState - The visibility state that the view will be set to after the animation.
      • animateToTransparent

        public static void animateToTransparent​(@NonNull
                                                android.view.View view,
                                                long duration,
                                                int endVisibilityState,
                                                @Nullable
                                                AnimationUtils.AnimateToTransparentListener onAnimationEndCallback)
        Animates the view from an opaque state to a transparent state and then sets it's visibility to the specified state.
        Parameters:
        view - The view that will become transparent.
        duration - The duration of the animation.
        endVisibilityState - The visibility state that the view will be set to after the animation.
      • areSystemAnimationsEnabled

        public static boolean areSystemAnimationsEnabled​(@NonNull
                                                         android.content.Context context)
        Gets a value indicating whether system animations are enabled or not.
        Parameters:
        context - The current context.
        Returns:
        True if animations are enabled, otherwise false.