Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(663)

Unified Diff: content/public/android/java/src/org/chromium/content/browser/third_party/GestureDetector.java

Issue 59173006: [Android] Fix missing onSingleTapConfirmed calls in GestureDetector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Findbugs fix Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/findbugs_filter/findbugs_known_bugs.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/src/org/chromium/content/browser/third_party/GestureDetector.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/third_party/GestureDetector.java b/content/public/android/java/src/org/chromium/content/browser/third_party/GestureDetector.java
index 6c98320fa3ff96b6f8bf36fdcdd906423896d6bb..3a52db4015a8f56f8b68f8c3cc3a5b6458158e83 100644
--- a/content/public/android/java/src/org/chromium/content/browser/third_party/GestureDetector.java
+++ b/content/public/android/java/src/org/chromium/content/browser/third_party/GestureDetector.java
@@ -225,6 +225,7 @@ public class GestureDetector {
private OnDoubleTapListener mDoubleTapListener;
private boolean mStillDown;
+ private boolean mDeferConfirmSingleTap;
private boolean mInLongPress;
private boolean mAlwaysInTapRegion;
private boolean mAlwaysInBiggerTapRegion;
@@ -281,8 +282,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;
@@ -555,7 +560,8 @@ public class GestureDetector {
mAlwaysInBiggerTapRegion = true;
mStillDown = true;
mInLongPress = false;
-
+ mDeferConfirmSingleTap = false;
+
if (mIsLongpressEnabled) {
mHandler.removeMessages(LONG_PRESS);
mHandler.sendEmptyMessageAtTime(LONG_PRESS, mCurrentDownEvent.getDownTime()
@@ -608,6 +614,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
@@ -634,6 +643,7 @@ public class GestureDetector {
mVelocityTracker = null;
}
mIsDoubleTapping = false;
+ mDeferConfirmSingleTap = false;
mHandler.removeMessages(SHOW_PRESS);
mHandler.removeMessages(LONG_PRESS);
break;
@@ -661,6 +671,7 @@ public class GestureDetector {
mStillDown = false;
mAlwaysInTapRegion = false;
mAlwaysInBiggerTapRegion = false;
+ mDeferConfirmSingleTap = false;
if (mInLongPress) {
mInLongPress = false;
}
@@ -673,6 +684,7 @@ public class GestureDetector {
mIsDoubleTapping = false;
mAlwaysInTapRegion = false;
mAlwaysInBiggerTapRegion = false;
+ mDeferConfirmSingleTap = false;
if (mInLongPress) {
mInLongPress = false;
}
@@ -695,6 +707,7 @@ public class GestureDetector {
private void dispatchLongPress() {
mHandler.removeMessages(TAP);
+ mDeferConfirmSingleTap = false;
mInLongPress = true;
mListener.onLongPress(mCurrentDownEvent);
}
« no previous file with comments | « build/android/findbugs_filter/findbugs_known_bugs.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698