private void onScrollPositionChanged ( int oldScrollPosition , int newScrollPosition ) { int newScrollDirection ; if ( newScrollPosition < oldScrollPosition ) { newScrollDirection = SCROLL_TO_TOP ; } else { newScrollDirection = SCROLL_TO_BOTTOM ; } if ( directionHasChanged ( newScrollDirection ) ) { translateYAnimatedView ( newScrollDirection ) ; } }
Perform the translateY animation using the new scroll position and the old scroll position to show or hide the animated view .