Chromium Code Reviews| 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..ccceb52b30a13aab505022821ed567254c06646a 100644 |
| --- a/remoting/android/java/src/org/chromium/chromoting/TapGestureDetector.java |
| +++ b/remoting/android/java/src/org/chromium/chromoting/TapGestureDetector.java |
| @@ -42,10 +42,10 @@ public class TapGestureDetector { |
| } |
| /** The listener to which notifications are sent. */ |
| - private OnTapListener mListener; |
| + private final OnTapListener mListener; |
|
Lambros
2016/06/02 18:11:30
Are you adding 'final' simply because this impleme
Hzj_jie
2016/06/02 22:20:04
In my opinion -- it's similar as the 'final' of Se
|
| /** Handler used for posting tasks to be executed in the future. */ |
| - private Handler mHandler; |
| + private final Handler mHandler; |
| /** The maximum number of fingers seen in the gesture. */ |
| private int mPointerCount = 0; |
| @@ -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; |