Ejemplo n.º 1
0
        /**
         * Flip to the next view of the {@code ViewAnimator}'s subviews. A call to this method will initiate a {@link FlipAnimation} to show the next View.
         * If the currently visible view is the last view, flip direction will be reversed for this transition.
         *
         * @param viewAnimator the {@code ViewAnimator}
         * @param dir the direction of flip
         * @param duration the transition duration in milliseconds
         */

        public static void FlipTransition(ViewAnimator viewAnimator, FlipDirection dir, long duration)
        {
            View fromView     = viewAnimator.CurrentView;
            int  currentIndex = viewAnimator.DisplayedChild;
            int  nextIndex    = (currentIndex + 1) % viewAnimator.ChildCount;

            View toView = viewAnimator.GetChildAt(nextIndex);

            Animation[] animc = AnimationFactory.FlipAnimation(fromView, toView,
                                                               (nextIndex < currentIndex ? dir.OtherDirection() : dir), duration, new AnticipateOvershootInterpolator());

            viewAnimator.OutAnimation = animc[0];
            viewAnimator.InAnimation  = animc[1];

            viewAnimator.ShowNext();
        }
Ejemplo n.º 2
0
        /**
	 * Flip to the next view of the {@code ViewAnimator}'s subviews. A call to this method will initiate a {@link FlipAnimation} to show the next View.  
	 * If the currently visible view is the last view, flip direction will be reversed for this transition.
	 *  
	 * @param viewAnimator the {@code ViewAnimator}
	 * @param dir the direction of flip
	 * @param duration the transition duration in milliseconds
	 */

        public static void FlipTransition(ViewAnimator viewAnimator, FlipDirection dir, long duration)
        {

            View fromView = viewAnimator.CurrentView;
            int currentIndex = viewAnimator.DisplayedChild;
            int nextIndex = (currentIndex + 1)%viewAnimator.ChildCount;

            View toView = viewAnimator.GetChildAt(nextIndex);

            Animation[] animc = AnimationFactory.FlipAnimation(fromView, toView,
                (nextIndex < currentIndex ? dir.OtherDirection() : dir), duration, new AnticipateOvershootInterpolator());

            viewAnimator.OutAnimation = animc[0];
            viewAnimator.InAnimation = animc[1];

            viewAnimator.ShowNext();
        }