Code example for ViewAnimator

Methods: getChildAtgetChildCount, getCurrentView, getDisplayedChild, setDisplayedChild, setInAnimation, setOutAnimation

0
	 * @param viewAnimator the {@code ViewAnimator} 
	 * @param dir the direction of flip 
	 */ 
	public static void flipTransition(final ViewAnimator viewAnimator, FlipDirection dir, long duration) {   
		 
		final View fromView = viewAnimator.getCurrentView();
		 
		final int currentIndex = viewAnimator.getDisplayedChild();
		final int nextIndex = (currentIndex + 1) % viewAnimator.getChildCount();
		 
		final View toView = viewAnimator.getChildAt(nextIndex);
 
		Animation[] animc = AnimationFactory.flipAnimation(fromView, toView, dir, duration);
   
		viewAnimator.setOutAnimation(animc[0]);
		viewAnimator.setInAnimation(animc[1]);
		 
		viewAnimator.setDisplayedChild(nextIndex); 
	} 
	 
	public static void flipTransition(final ViewAnimator viewAnimator, FlipDirection dir) {
		 
		flipTransition(viewAnimator, dir, 1000);