OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.compositor.layouts.eventfilter; | 5 package org.chromium.chrome.browser.compositor.layouts.eventfilter; |
6 | 6 |
7 import android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.os.SystemClock; | 9 import android.os.SystemClock; |
10 import android.view.GestureDetector; | 10 import android.view.GestureDetector; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 private boolean mEnableTabSwiping; | 46 private boolean mEnableTabSwiping; |
47 private ScrollDirection mScrollDirection; | 47 private ScrollDirection mScrollDirection; |
48 | 48 |
49 private final double mSwipeTimeConstantPx; | 49 private final double mSwipeTimeConstantPx; |
50 | 50 |
51 private final GestureDetector mGestureDetector; | 51 private final GestureDetector mGestureDetector; |
52 private TabModelSelector mTabModelSelector; | 52 private TabModelSelector mTabModelSelector; |
53 private final EdgeSwipeHandler mEdgeSwipeHandler; | 53 private final EdgeSwipeHandler mEdgeSwipeHandler; |
54 private boolean mEdgeSwipeStarted; | 54 private boolean mEdgeSwipeStarted; |
55 | 55 |
56 private boolean mInLongPress = false; | 56 private boolean mInLongPress; |
57 private boolean mInDoubleTap = false; | 57 private boolean mInDoubleTap; |
58 private boolean mScrollStarted; | 58 private boolean mScrollStarted; |
59 | 59 |
60 // This flag is used to for accumulating events when the motion at the begin
ning of a scroll | 60 // This flag is used to for accumulating events when the motion at the begin
ning of a scroll |
61 // can not be trusted and we need more events to make a better angle and spe
ed estimate. | 61 // can not be trusted and we need more events to make a better angle and spe
ed estimate. |
62 private boolean mAccumulatingEvents = false; | 62 private boolean mAccumulatingEvents; |
63 private final ArrayList<MotionEvent> mAccumulatedEvents = new ArrayList<Moti
onEvent>(); | 63 private final ArrayList<MotionEvent> mAccumulatedEvents = new ArrayList<Moti
onEvent>(); |
64 private boolean mPropagateEventsToHostView; | 64 private boolean mPropagateEventsToHostView; |
65 | 65 |
66 /** | 66 /** |
67 * Creates a {@link EdgeSwipeEventFilter} captures event either in edge swip
e gestures or | 67 * Creates a {@link EdgeSwipeEventFilter} captures event either in edge swip
e gestures or |
68 * propagate them. | 68 * propagate them. |
69 * @param context A {@link Context} instance. | 69 * @param context A {@link Context} instance. |
70 * @param host The {@link EventFilterHost} where the event is co
ming from. | 70 * @param host The {@link EventFilterHost} where the event is co
ming from. |
71 * @param edgeSwipeHandler The {@link EdgeSwipeHandler} that is going to get
notified. | 71 * @param edgeSwipeHandler The {@link EdgeSwipeHandler} that is going to get
notified. |
72 */ | 72 */ |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 final float y = e2.getY() * mPxToDp; | 428 final float y = e2.getY() * mPxToDp; |
429 final float tx = (e2.getRawX() - e1.getRawX()) * mPxToDp; | 429 final float tx = (e2.getRawX() - e1.getRawX()) * mPxToDp; |
430 final float ty = (e2.getRawY() - e1.getRawY()) * mPxToDp; | 430 final float ty = (e2.getRawY() - e1.getRawY()) * mPxToDp; |
431 final float vx = velocityX * mPxToDp; | 431 final float vx = velocityX * mPxToDp; |
432 final float vy = velocityY * mPxToDp; | 432 final float vy = velocityY * mPxToDp; |
433 flingOccurred(x, y, tx, ty, vx, vy); | 433 flingOccurred(x, y, tx, ty, vx, vy); |
434 return false; | 434 return false; |
435 } | 435 } |
436 } | 436 } |
437 } | 437 } |
OLD | NEW |