Class AnimatorPack



  • public class AnimatorPack
    extends java.lang.Object
    Provides useful animator packs.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class and Description
      static class  AnimatorPack.Direction 
    • Constructor Summary

      Constructors 
      Constructor and Description
      AnimatorPack() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static AnimatorSet crossfade(View out, View in)
      Switch views with fade and scale in place animation.
      static AnimatorSet crossfade(View out, View in, Animator.AnimatorListener outListener, Animator.AnimatorListener inListener)
      Switch views with fade and scale in place animation.
      static Animator fadeIn(View toAnimate)
      Animation to fade in and scale up a view and make it visible.
      static Animator fadeOut(View toAnimate)
      Animation to fade out and scale down a view and make it invisible.
      static AnimatorSet scale(View view, float from, float to)
      Scales view in place It's up to you to set view's visibility on animation end
      static Animator slideIn(View toAnimate, AnimatorPack.Direction from)
      Builds a slide in animator
      static Animator slideInSequentially(AnimatorPack.Direction from, long delay, boolean fadeIn, boolean scale, View... toAnimate)
      Slide in animation that delays start of each animated element by an offset.
      static Animator slideOut(View toAnimate, AnimatorPack.Direction to)
      Builds a slide out animator.
      static Animator slideOutSequentially(AnimatorPack.Direction to, long delay, boolean fadeOut, boolean scale, View... toAnimate)
      Slide out animation that delays start of each animated element by an offset.
      • Methods inherited from class java.lang.Object

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

      • AnimatorPack

        public AnimatorPack()
    • Method Detail

      • scale

        public static AnimatorSet scale(View view,
                                        float from,
                                        float to)
        Scales view in place It's up to you to set view's visibility on animation end
        Parameters:
        view - to be scaled
        from - starting scale
        to - ending scale
        Returns:
        scale animator
      • crossfade

        public static AnimatorSet crossfade(View out,
                                            View in,
                                            Animator.AnimatorListener outListener,
                                            Animator.AnimatorListener inListener)
        Switch views with fade and scale in place animation.
        Parameters:
        out - view to hide
        in - view to show
        outListener - that listens for fade-out animator
        inListener - that listens for fade-in animator
        Returns:
        crossfade animator
      • crossfade

        public static AnimatorSet crossfade(View out,
                                            View in)
        Switch views with fade and scale in place animation.
        Parameters:
        out - view to hide
        in - view to show
        Returns:
        crossfade animator
      • slideOut

        public static Animator slideOut(View toAnimate,
                                        AnimatorPack.Direction to)
        Builds a slide out animator.
        Parameters:
        toAnimate - view to animate
        to - direction to slide out
        Returns:
        slide out animator
      • slideIn

        public static Animator slideIn(View toAnimate,
                                       AnimatorPack.Direction from)
        Builds a slide in animator
        Parameters:
        toAnimate - view to animate
        from - direction to slide in from
        Returns:
        slide in animator
      • slideOutSequentially

        public static Animator slideOutSequentially(AnimatorPack.Direction to,
                                                    long delay,
                                                    boolean fadeOut,
                                                    boolean scale,
                                                    View... toAnimate)
        Slide out animation that delays start of each animated element by an offset.
        Parameters:
        to - direction to slide out to
        delay - duration
        fadeOut - true if fading out
        scale - true if scaling
        toAnimate - view to animate
        Returns:
        slide out animator
      • slideInSequentially

        public static Animator slideInSequentially(AnimatorPack.Direction from,
                                                   long delay,
                                                   boolean fadeIn,
                                                   boolean scale,
                                                   View... toAnimate)
        Slide in animation that delays start of each animated element by an offset.
        Parameters:
        from - direction to slide in from
        delay - duration
        fadeIn - true if fading in
        scale - true if scaling
        toAnimate - view to animate
        Returns:
        slide in animator
      • fadeOut

        public static Animator fadeOut(View toAnimate)
        Animation to fade out and scale down a view and make it invisible.
        Parameters:
        toAnimate - view to animate
        Returns:
        animator that performs animation
      • fadeIn

        public static Animator fadeIn(View toAnimate)
        Animation to fade in and scale up a view and make it visible.
        Parameters:
        toAnimate - view to animate
        Returns:
        animator that performs animation