public void fling(long time,float x,float y,float velocityX,float velocityY){
  if (mDragLock != DragLock.SCROLL && mDiscardingTab != null) {
    float velocity=mCurrentMode == Orientation.PORTRAIT ? velocityX : velocityY;
    float maxDelta=getDiscardRange() * DISCARD_FLING_MAX_CONTRIBUTION;
    float deltaAmount=MathUtils.clamp(velocity * DISCARD_FLING_DT,-maxDelta,maxDelta);
    mDiscardingTab.addToDiscardAmount(deltaAmount);
  }
 else   if (mOverviewAnimationType == OverviewAnimationType.NONE && mScroller.isFinished() && mOverScrollOffset == 0 && getTabIndexAtPositon(x,y) >= 0) {
    float velocity=mCurrentMode == Orientation.PORTRAIT ? velocityY : (LocalizationUtils.isLayoutRtl() ? -velocityX : velocityX);
    mScroller.fling(0,(int)mScrollTarget,0,(int)velocity,0,0,(int)getMinScroll(false),(int)getMaxScroll(false),0,(int)((velocity > 0 ? mMaxOverScroll : mMaxUnderScroll) * MAX_OVER_FLING_SCALE),time);
    setScrollTarget(mScroller.getFinalY(),false);
  }
}

public void fling ( long time , float x , float y , float velocityX , float velocityY ) { if ( mDragLock != DragLock . SCROLL && mDiscardingTab != null ) { float velocity = mCurrentMode == Orientation . PORTRAIT ? velocityX : velocityY ; float maxDelta = getDiscardRange ( ) * DISCARD_FLING_MAX_CONTRIBUTION ; float deltaAmount = MathUtils . clamp ( velocity * DISCARD_FLING_DT , - maxDelta , maxDelta ) ; mDiscardingTab . addToDiscardAmount ( deltaAmount ) ; } else if ( mOverviewAnimationType == OverviewAnimationType . NONE && mScroller . isFinished ( ) && mOverScrollOffset == 0 && getTabIndexAtPositon ( x , y ) >= 0 ) { float velocity = mCurrentMode == Orientation . PORTRAIT ? velocityY : ( LocalizationUtils . isLayoutRtl ( ) ? - velocityX : velocityX ) ; mScroller . fling ( 0 , ( int ) mScrollTarget , 0 , ( int ) velocity , 0 , 0 , ( int ) getMinScroll ( false ) , ( int ) getMaxScroll ( false ) , 0 , ( int ) ( ( velocity > 0 ? mMaxOverScroll : mMaxUnderScroll ) * MAX_OVER_FLING_SCALE ) , time ) ; setScrollTarget ( mScroller . getFinalY ( ) , false ) ; } }
called on touch fling event . scroll the stack or help to discard a tab .
