@ SuppressLint ( "NewApi" ) private int calculateAnimationDelay ( final int position ) { int delay ; int lastVisiblePosition = mListViewWrapper . getLastVisiblePosition ( ) ; int firstVisiblePosition = mListViewWrapper . getFirstVisiblePosition ( ) ; int numberOfItemsOnScreen = lastVisiblePosition - firstVisiblePosition ; int numberOfAnimatedItems = position - 1 - mFirstAnimatedPosition ; if ( numberOfItemsOnScreen + 1 < numberOfAnimatedItems ) { delay = mAnimationDelayMillis ; if ( mListViewWrapper . getListView ( ) instanceof GridView && Build . VERSION . SDK_INT >= Build . VERSION_CODES . HONEYCOMB ) { int numColumns = ( ( GridView ) mListViewWrapper . getListView ( ) ) . getNumColumns ( ) ; delay += mAnimationDelayMillis * ( position % numColumns ) ; } } else { int delaySinceStart = ( position - mFirstAnimatedPosition ) * mAnimationDelayMillis ; delay = Math . max ( 0 , ( int ) ( - SystemClock . uptimeMillis ( ) + mAnimationStartMillis + mInitialDelayMillis + delaySinceStart ) ) ; } return delay ; }
Returns the delay in milliseconds after which animation for View with position mLastAnimatedPosition + 1 should start .