private void displaySlide ( final int currentPosition , final int previousPosition ) { Log . v ( "SlideShowView" , "Displaying slide at position: " + currentPosition ) ; // Hide the progress indicator hideProgressIndicator ( ) ; // Add the slide view to our hierarchy final View inView = getSlideView ( currentPosition ) ; inView . setVisibility ( View . INVISIBLE ) ; addView ( inView ) ; // Notify that the slide is about to be shown notifyBeforeSlideShown ( currentPosition ) ; // Transition between current and new slide final TransitionFactory tf = getTransitionFactory ( ) ; final Animator inAnimator = tf . getInAnimator ( inView , this , previousPosition , currentPosition ) ; if ( inAnimator != null ) { inAnimator . addListener ( new AnimatorListenerAdapter ( ) { @ Override public void onAnimationStart ( Animator animation ) { inView . setVisibility ( View . VISIBLE ) ; } @ Override public void onAnimationEnd ( Animator animation ) { notifySlideShown ( currentPosition ) ; } } ) ; inAnimator . start ( ) ; } else { inView . setVisibility ( View . VISIBLE ) ; notifySlideShown ( currentPosition ) ; } int childCount = getChildCount ( ) ; if ( childCount > 1 ) { notifyBeforeSlideHidden ( previousPosition ) ; final View outView = getChildAt ( 0 ) ; final Animator outAnimator = tf . getOutAnimator ( outView , this , previousPosition , currentPosition ) ; if ( outAnimator != null ) { outAnimator . addListener ( new AnimatorListenerAdapter ( ) { @ Override public void onAnimationEnd ( Animator animation ) { outView . setVisibility ( View . INVISIBLE ) ; notifySlideHidden ( previousPosition ) ; recyclePreviousSlideView ( previousPosition , outView ) ; } } ) ; outAnimator . start ( ) ; } else { outView . setVisibility ( View . INVISIBLE ) ; notifySlideHidden ( previousPosition ) ; recyclePreviousSlideView ( previousPosition , outView ) ; } } }
Display the view for the given slide launching the appropriate transitions if available