OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.content.Context; | 7 import android.content.Context; |
8 import android.view.MotionEvent; | 8 import android.view.MotionEvent; |
9 | 9 |
10 import org.chromium.base.VisibleForTesting; | 10 import org.chromium.base.VisibleForTesting; |
11 | 11 |
12 /** | 12 /** |
13 * {@link EventFilter} is an abstract minimal {@link EventFilter}. This class is
designed to use or | 13 * {@link EventFilter} is an abstract minimal {@link EventFilter}. This class is
designed to use or |
14 * propagate events from an {@link EventFilterHost} view. | 14 * propagate events from an {@link EventFilterHost} view. |
15 */ | 15 */ |
16 public abstract class EventFilter { | 16 public abstract class EventFilter { |
17 protected final EventFilterHost mHost; | 17 protected final EventFilterHost mHost; |
18 protected final float mPxToDp; | 18 protected final float mPxToDp; |
19 private boolean mSimulateIntercepting = false; | 19 private boolean mSimulateIntercepting; |
20 | 20 |
21 private boolean mAutoOffset = false; | 21 private boolean mAutoOffset; |
22 protected float mCurrentTouchOffsetX; | 22 protected float mCurrentTouchOffsetX; |
23 protected float mCurrentTouchOffsetY; | 23 protected float mCurrentTouchOffsetY; |
24 | 24 |
25 /** | 25 /** |
26 * Creates a {@link EventFilter}. | 26 * Creates a {@link EventFilter}. |
27 * @param context A {@link Context} instance. | 27 * @param context A {@link Context} instance. |
28 * @param host The host of this EventFilter. | 28 * @param host The host of this EventFilter. |
29 */ | 29 */ |
30 public EventFilter(Context context, EventFilterHost host) { | 30 public EventFilter(Context context, EventFilterHost host) { |
31 this(context, host, true); | 31 this(context, host, true); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 return onTouchEvent(event); | 117 return onTouchEvent(event); |
118 } | 118 } |
119 | 119 |
120 /** | 120 /** |
121 * @return Whether or not touch events will be automatically offset. | 121 * @return Whether or not touch events will be automatically offset. |
122 */ | 122 */ |
123 protected boolean autoOffsetEvents() { | 123 protected boolean autoOffsetEvents() { |
124 return mAutoOffset; | 124 return mAutoOffset; |
125 } | 125 } |
126 } | 126 } |
OLD | NEW |