publicbooleanonTouchEvent(MotionEventev){// ...if(mIsDoubleTapping){// Give the move events of the double-taphandled|=mDoubleTapListener.onDoubleTapEvent(ev);}elseif(mAlwaysInTapRegion){finalintdeltaX=(int)(x-mCurrentDownEvent.getX());finalintdeltaY=(int)(y-mCurrentDownEvent.getY());intdistance=(deltaX*deltaX)+(deltaY*deltaY);if(distance>mTouchSlopSquare){// onScroll が呼ばれるhandled=mListener.onScroll(mCurrentDownEvent,ev,scrollX,scrollY);mLastMotionX=x;mLastMotionY=y;mAlwaysInTapRegion=false;mHandler.removeMessages(TAP);mHandler.removeMessages(SHOW_PRESS);mHandler.removeMessages(LONG_PRESS);}if(distance>mBiggerTouchSlopSquare){mAlwaysInBiggerTapRegion=false;}}elseif((Math.abs(scrollX)>=1)||(Math.abs(scrollY)>=1)){// onScroll が呼ばれるhandled=mListener.onScroll(mCurrentDownEvent,ev,scrollX,scrollY);mLastMotionX=x;mLastMotionY=y;}// ...if(mIsDoubleTapping){// Finally, give the up event of the double-taphandled|=mDoubleTapListener.onDoubleTapEvent(ev);}elseif(mInLongPress){mHandler.removeMessages(TAP);mInLongPress=false;}elseif(mAlwaysInTapRegion){handled=mListener.onSingleTapUp(ev);}else{// A fling must travel the minimum tap distancefinalVelocityTrackervelocityTracker=mVelocityTracker;velocityTracker.computeCurrentVelocity(1000,mMaximumFlingVelocity);finalfloatvelocityY=velocityTracker.getYVelocity();finalfloatvelocityX=velocityTracker.getXVelocity();if((Math.abs(velocityY)>mMinimumFlingVelocity)||(Math.abs(velocityX)>mMinimumFlingVelocity)){// onFling が呼ばれるhandled=mListener.onFling(mCurrentDownEvent,ev,velocityX,velocityY);}}// ...}