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

Unified Diff: remoting/android/java/src/org/chromium/chromoting/TapGestureDetector.java

Issue 2032883002: [Chromoting] Minor changes to TapGestureDetector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolve review comments Created 4 years, 7 months 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/android/java/src/org/chromium/chromoting/TapGestureDetector.java
diff --git a/remoting/android/java/src/org/chromium/chromoting/TapGestureDetector.java b/remoting/android/java/src/org/chromium/chromoting/TapGestureDetector.java
index 45dab790a2c3012a486115f42e55466289824cec..0fa56faaf22d0bb1451a7c6baec3a5c9e399ad36 100644
--- a/remoting/android/java/src/org/chromium/chromoting/TapGestureDetector.java
+++ b/remoting/android/java/src/org/chromium/chromoting/TapGestureDetector.java
@@ -42,28 +42,28 @@ public class TapGestureDetector {
}
/** The listener to which notifications are sent. */
- private OnTapListener mListener;
+ private final OnTapListener mListener;
/** Handler used for posting tasks to be executed in the future. */
- private Handler mHandler;
-
- /** The maximum number of fingers seen in the gesture. */
- private int mPointerCount = 0;
-
- /** The coordinates of the first finger down seen in the gesture. */
- private PointF mInitialPoint;
+ private final Handler mHandler;
/**
* Stores the location of each down MotionEvent (by pointer ID), for detecting motion of any
* pointer beyond the TouchSlop region.
*/
- private SparseArray<PointF> mInitialPositions = new SparseArray<PointF>();
+ private final SparseArray<PointF> mInitialPositions = new SparseArray<PointF>();
/**
* Threshold squared-distance, in pixels, to use for motion-detection. If a finger moves less
* than this distance, the gesture is still eligible to be a tap event.
*/
- private int mTouchSlopSquare;
+ private final int mTouchSlopSquare;
+
+ /** The maximum number of fingers seen in the gesture. */
+ private int mPointerCount = 0;
+
+ /** The coordinates of the first finger down seen in the gesture. */
+ private PointF mInitialPoint;
/** Set to true whenever motion is detected in the gesture, or a long-touch is triggered. */
private boolean mTapCancelled = false;
@@ -81,9 +81,10 @@ public class TapGestureDetector {
public void handleMessage(Message message) {
TapGestureDetector detector = mDetector.get();
if (detector != null) {
+ detector.mTapCancelled = true;
detector.mListener.onLongPress(
detector.mPointerCount, detector.mInitialPoint.x, detector.mInitialPoint.y);
- detector.mTapCancelled = true;
+ detector.mInitialPoint = null;
}
}
}
@@ -102,9 +103,10 @@ public class TapGestureDetector {
switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
reset();
+ trackDownEvent(event);
+
// Cause a long-press notification to be triggered after the timeout.
mHandler.sendEmptyMessageDelayed(0, ViewConfiguration.getLongPressTimeout());
- trackDownEvent(event);
mPointerCount = 1;
break;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698