question: public void fling ( int startX , int startY , int velocityX , int velocityY , int minX , int maxX , int minY , int maxY ) { if ( mFlywheel && ! mFinished ) { float oldVel = getCurrVelocity ( ) ; float dx = ( float ) ( mFinalX - mStartX ) ; float dy = ( float ) ( mFinalY - mStartY ) ; float hyp = ( float ) Math . sqrt ( dx * dx + dy * dy ) ; float ndx = dx / hyp ; float ndy = dy / hyp ; float oldVelocityX = ndx * oldVel ; float oldVelocityY = ndy * oldVel ; if ( Math . signum ( velocityX ) == Math . signum ( oldVelocityX ) && Math . signum ( velocityY ) == Math . signum ( oldVelocityY ) ) { velocityX += oldVelocityX ; velocityY += oldVelocityY ; } } mMode = FLING_MODE ; mFinished = false ; float velocity = ( float ) Math . sqrt ( velocityX * velocityX + velocityY * velocityY ) ; mVelocity = velocity ; final double l = Math . log ( START_TENSION * velocity / ALPHA ) ; mDuration = ( int ) ( 1000.0 * Math . exp ( l / ( DECELERATION_RATE - 1.0 ) ) ) ; mStartTime = AnimationUtils . currentAnimationTimeMillis ( ) ; mStartX = startX ; mStartY = startY ; float coeffX = velocity == 0 ? 1.0f : velocityX / velocity ; float coeffY = velocity == 0 ? 1.0f : velocityY / velocity ; int totalDistance = ( int ) ( ALPHA * Math . exp ( DECELERATION_RATE / ( DECELERATION_RATE - 1.0 ) * l ) ) ; mMinX = minX ; mMaxX = maxX ; mMinY = minY ; mMaxY = maxY ; mFinalX = startX + Math . round ( totalDistance * coeffX ) ; mFinalX = Math . min ( mFinalX , mMaxX ) ; mFinalX = Math . max ( mFinalX , mMinX ) ; mFinalY = startY + Math . round ( totalDistance * coeffY ) ; mFinalY = Math . min ( mFinalY , mMaxY ) ; mFinalY = Math . max ( mFinalY , mMinY ) ; }
target:  Start scrolling based on a fling gesture. The distance travelled will depend on the initial velocity of the fling.