summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2013-02-15 21:08:04 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-02-15 21:08:07 +0000
commitfdc61af16ffdbaa699431db2f008a424bd79f655 (patch)
treee333114ec10f7640ca1b003d61626e77e512a182 /core/java
parentc145317d0b19fbd1e7aff8519696146853367b89 (diff)
parenteca3e6065ee6ce26027ef792d106f2f754a3169d (diff)
downloadframeworks_base-fdc61af16ffdbaa699431db2f008a424bd79f655.zip
frameworks_base-fdc61af16ffdbaa699431db2f008a424bd79f655.tar.gz
frameworks_base-fdc61af16ffdbaa699431db2f008a424bd79f655.tar.bz2
Merge "Fix missing onSingleTapConfirmed calls in GestureDetector"
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/view/GestureDetector.java17
1 files changed, 15 insertions, 2 deletions
diff --git a/core/java/android/view/GestureDetector.java b/core/java/android/view/GestureDetector.java
index 9ddb32e..28c1058 100644
--- a/core/java/android/view/GestureDetector.java
+++ b/core/java/android/view/GestureDetector.java
@@ -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;
@@ -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) {
- mDoubleTapListener.onSingleTapConfirmed(mCurrentDownEvent);
+ if (mDoubleTapListener != null) {
+ if (!mStillDown) {
+ mDoubleTapListener.onSingleTapConfirmed(mCurrentDownEvent);
+ } else {
+ mDeferConfirmSingleTap = true;
+ }
}
break;
@@ -533,6 +538,7 @@ public class GestureDetector {
mAlwaysInBiggerTapRegion = true;
mStillDown = true;
mInLongPress = false;
+ mDeferConfirmSingleTap = false;
if (mIsLongpressEnabled) {
mHandler.removeMessages(LONG_PRESS);
@@ -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
@@ -612,6 +621,7 @@ public class GestureDetector {
mVelocityTracker = null;
}
mIsDoubleTapping = false;
+ mDeferConfirmSingleTap = false;
mHandler.removeMessages(SHOW_PRESS);
mHandler.removeMessages(LONG_PRESS);
break;
@@ -637,6 +647,7 @@ public class GestureDetector {
mStillDown = false;
mAlwaysInTapRegion = false;
mAlwaysInBiggerTapRegion = false;
+ mDeferConfirmSingleTap = false;
if (mInLongPress) {
mInLongPress = false;
}
@@ -649,6 +660,7 @@ public class GestureDetector {
mIsDoubleTapping = false;
mAlwaysInTapRegion = false;
mAlwaysInBiggerTapRegion = false;
+ mDeferConfirmSingleTap = false;
if (mInLongPress) {
mInLongPress = false;
}
@@ -671,6 +683,7 @@ public class GestureDetector {
private void dispatchLongPress() {
mHandler.removeMessages(TAP);
+ mDeferConfirmSingleTap = false;
mInLongPress = true;
mListener.onLongPress(mCurrentDownEvent);
}