void computeScroll ( ) { if ( ! overScroller . computeScrollOffset ( ) ) { isScrollingFast = false ; return ; } int distanceX = overScroller . getCurrX ( ) - view . getScrollX ( ) ; int distanceY = overScroller . getCurrY ( ) - view . getScrollY ( ) ; int dX = ( int ) calculateDx ( distanceX ) ; int dY = ( int ) calculateDy ( distanceY ) ; boolean stopScrolling = dX == 0 && dY == 0 ; if ( stopScrolling ) { isScrollingFast = false ; } view . scrollBy ( dX , dY ) ; }
Computes the current scroll using a OverScroller instance and the time lapsed from the previous call . Also controls if the view is performing a fast scroll after a fling gesture .