private int determineFinalHorizontalLocation(){
  if (mGestureState == GESTURE_FLINGING) {
    float msRequired=calculateMsRequiredToFlingOffScreen();
    if (msRequired > MS_DISMISS_FLING_THRESHOLD)     return DRAGGED_CANCEL;
  }
 else   if (mGestureState == GESTURE_SCROLLING) {
    float dismissPercentage=DISMISS_SWIPE_THRESHOLD;
    float dismissThreshold=getWidth() * dismissPercentage;
    if (Math.abs(getTranslationX()) < dismissThreshold)     return DRAGGED_CANCEL;
  }
  return mDragDirection;
}

private int determineFinalHorizontalLocation ( ) { if ( mGestureState == GESTURE_FLINGING ) { float msRequired = calculateMsRequiredToFlingOffScreen ( ) ; if ( msRequired > MS_DISMISS_FLING_THRESHOLD ) return DRAGGED_CANCEL ; } else if ( mGestureState == GESTURE_SCROLLING ) { float dismissPercentage = DISMISS_SWIPE_THRESHOLD ; float dismissThreshold = getWidth ( ) * dismissPercentage ; if ( Math . abs ( getTranslationX ( ) ) < dismissThreshold ) return DRAGGED_CANCEL ; } return mDragDirection ; }
determine where the view needs to move . if the user hasn ' t tried hard enough to dismiss the view , move it back to the center .
