Loading core/java/android/view/GestureDetector.java +15 −2 Original line number Diff line number Diff line Loading @@ -213,6 +213,7 @@ public class GestureDetector { private OnDoubleTapListener mDoubleTapListener; private boolean mStillDown; private boolean mDeferConfirmSingleTap; private boolean mInLongPress; private boolean mAlwaysInTapRegion; private boolean mAlwaysInBiggerTapRegion; Loading Loading @@ -267,8 +268,12 @@ public class GestureDetector { case TAP: // If the user's finger is still down, do not count it as a tap if (mDoubleTapListener != null && !mStillDown) { if (mDoubleTapListener != null) { if (!mStillDown) { mDoubleTapListener.onSingleTapConfirmed(mCurrentDownEvent); } else { mDeferConfirmSingleTap = true; } } break; Loading Loading @@ -533,6 +538,7 @@ public class GestureDetector { mAlwaysInBiggerTapRegion = true; mStillDown = true; mInLongPress = false; mDeferConfirmSingleTap = false; if (mIsLongpressEnabled) { mHandler.removeMessages(LONG_PRESS); Loading Loading @@ -586,6 +592,9 @@ public class GestureDetector { mInLongPress = false; } else if (mAlwaysInTapRegion) { handled = mListener.onSingleTapUp(ev); if (mDeferConfirmSingleTap && mDoubleTapListener != null) { mDoubleTapListener.onSingleTapConfirmed(ev); } } else { // A fling must travel the minimum tap distance Loading @@ -612,6 +621,7 @@ public class GestureDetector { mVelocityTracker = null; } mIsDoubleTapping = false; mDeferConfirmSingleTap = false; mHandler.removeMessages(SHOW_PRESS); mHandler.removeMessages(LONG_PRESS); break; Loading @@ -637,6 +647,7 @@ public class GestureDetector { mStillDown = false; mAlwaysInTapRegion = false; mAlwaysInBiggerTapRegion = false; mDeferConfirmSingleTap = false; if (mInLongPress) { mInLongPress = false; } Loading @@ -649,6 +660,7 @@ public class GestureDetector { mIsDoubleTapping = false; mAlwaysInTapRegion = false; mAlwaysInBiggerTapRegion = false; mDeferConfirmSingleTap = false; if (mInLongPress) { mInLongPress = false; } Loading @@ -671,6 +683,7 @@ public class GestureDetector { private void dispatchLongPress() { mHandler.removeMessages(TAP); mDeferConfirmSingleTap = false; mInLongPress = true; mListener.onLongPress(mCurrentDownEvent); } Loading Loading
core/java/android/view/GestureDetector.java +15 −2 Original line number Diff line number Diff line Loading @@ -213,6 +213,7 @@ public class GestureDetector { private OnDoubleTapListener mDoubleTapListener; private boolean mStillDown; private boolean mDeferConfirmSingleTap; private boolean mInLongPress; private boolean mAlwaysInTapRegion; private boolean mAlwaysInBiggerTapRegion; Loading Loading @@ -267,8 +268,12 @@ public class GestureDetector { case TAP: // If the user's finger is still down, do not count it as a tap if (mDoubleTapListener != null && !mStillDown) { if (mDoubleTapListener != null) { if (!mStillDown) { mDoubleTapListener.onSingleTapConfirmed(mCurrentDownEvent); } else { mDeferConfirmSingleTap = true; } } break; Loading Loading @@ -533,6 +538,7 @@ public class GestureDetector { mAlwaysInBiggerTapRegion = true; mStillDown = true; mInLongPress = false; mDeferConfirmSingleTap = false; if (mIsLongpressEnabled) { mHandler.removeMessages(LONG_PRESS); Loading Loading @@ -586,6 +592,9 @@ public class GestureDetector { mInLongPress = false; } else if (mAlwaysInTapRegion) { handled = mListener.onSingleTapUp(ev); if (mDeferConfirmSingleTap && mDoubleTapListener != null) { mDoubleTapListener.onSingleTapConfirmed(ev); } } else { // A fling must travel the minimum tap distance Loading @@ -612,6 +621,7 @@ public class GestureDetector { mVelocityTracker = null; } mIsDoubleTapping = false; mDeferConfirmSingleTap = false; mHandler.removeMessages(SHOW_PRESS); mHandler.removeMessages(LONG_PRESS); break; Loading @@ -637,6 +647,7 @@ public class GestureDetector { mStillDown = false; mAlwaysInTapRegion = false; mAlwaysInBiggerTapRegion = false; mDeferConfirmSingleTap = false; if (mInLongPress) { mInLongPress = false; } Loading @@ -649,6 +660,7 @@ public class GestureDetector { mIsDoubleTapping = false; mAlwaysInTapRegion = false; mAlwaysInBiggerTapRegion = false; mDeferConfirmSingleTap = false; if (mInLongPress) { mInLongPress = false; } Loading @@ -671,6 +683,7 @@ public class GestureDetector { private void dispatchLongPress() { mHandler.removeMessages(TAP); mDeferConfirmSingleTap = false; mInLongPress = true; mListener.onLongPress(mCurrentDownEvent); } Loading