LibreOffice Module android (master) 1
|
This class handles incoming touch events from the user and sends them to listeners in Gecko and/or performs the "default action" (asynchronous pan/zoom behaviour. More...
Classes | |
class | ListenerTimeoutProcessor |
Public Member Functions | |
boolean | handleEvent (MotionEvent event) |
void | handleEventListenerAction (boolean allowDefaultAction) |
This function is how gecko sends us a default-prevented notification. More... | |
void | setWaitForTouchListeners (boolean aValue) |
Private Member Functions | |
boolean | isDownEvent (MotionEvent event) |
boolean | touchFinished (MotionEvent event) |
void | dispatchEvent (MotionEvent event) |
Dispatch the event to the gesture detectors and the pan/zoom controller. More... | |
void | processEventBlock (boolean allowDefaultAction) |
Process the block of events at the head of the queue now that we know whether it has been default-prevented or not. More... | |
Private Attributes | |
final int | EVENT_LISTENER_TIMEOUT = 200 |
final View | mView |
final GestureDetector | mGestureDetector |
final SimpleScaleGestureDetector | mScaleGestureDetector |
final JavaPanZoomController | mPanZoomController |
final Queue< MotionEvent > | mEventQueue |
final ListenerTimeoutProcessor | mListenerTimeoutProcessor |
boolean | mWaitForTouchListeners |
boolean | mHoldInQueue |
boolean | mDispatchEvents |
int | mProcessingBalance |
Static Private Attributes | |
static final String | LOGTAG = "GeckoTouchEventHandler" |
This class handles incoming touch events from the user and sends them to listeners in Gecko and/or performs the "default action" (asynchronous pan/zoom behaviour.
EVERYTHING IN THIS CLASS MUST RUN ON THE UI THREAD.
In the following code/comments, a "block" of events refers to a contiguous sequence of events that starts with a DOWN or POINTER_DOWN and goes up to but not including the next DOWN or POINTER_DOWN event.
"Dispatching" an event refers to performing the default actions for the event, which at our level of abstraction just means sending it off to the gesture detectors and the pan/zoom controller.
If an event is "default-prevented" that means one or more listeners in Gecko has called preventDefault() on the event, which means that the default action for that event should not occur. Usually we care about a "block" of events being default-prevented, which means that the DOWN/POINTER_DOWN event that started the block, or the first MOVE event following that, were prevent-defaulted.
A "default-prevented notification" is when we here in Java-land receive a notification from gecko as to whether or not a block of events was default-prevented. This happens at some point after the first or second event in the block is processed in Gecko. This code assumes we get EXACTLY ONE default-prevented notification for each block of events.
Note that even if all events are default-prevented, we still send specific types of notifications to the pan/zoom controller. The notifications are needed to respond to user actions a timely manner regardless of default-prevention, and fix issues like bug 749384.
Definition at line 48 of file TouchEventHandler.java.
|
inlineprivate |
Dispatch the event to the gesture detectors and the pan/zoom controller.
Definition at line 221 of file TouchEventHandler.java.
References org.mozilla.gecko.gfx.SimpleScaleGestureDetector.isInProgress(), org.mozilla.gecko.gfx.TouchEventHandler.mGestureDetector, org.mozilla.gecko.gfx.TouchEventHandler.mPanZoomController, org.mozilla.gecko.gfx.TouchEventHandler.mScaleGestureDetector, and org.mozilla.gecko.gfx.SimpleScaleGestureDetector.onTouchEvent().
Referenced by org.mozilla.gecko.gfx.TouchEventHandler.handleEvent(), and org.mozilla.gecko.gfx.TouchEventHandler.processEventBlock().
|
inline |
Definition at line 137 of file TouchEventHandler.java.
References org.mozilla.gecko.gfx.TouchEventHandler.dispatchEvent(), org.mozilla.gecko.gfx.TouchEventHandler.EVENT_LISTENER_TIMEOUT, org.mozilla.gecko.gfx.TouchEventHandler.isDownEvent(), org.mozilla.gecko.gfx.TouchEventHandler.mDispatchEvents, org.mozilla.gecko.gfx.TouchEventHandler.mEventQueue, org.mozilla.gecko.gfx.TouchEventHandler.mHoldInQueue, org.mozilla.gecko.gfx.TouchEventHandler.mListenerTimeoutProcessor, org.mozilla.gecko.gfx.TouchEventHandler.mPanZoomController, org.mozilla.gecko.gfx.TouchEventHandler.mView, org.mozilla.gecko.gfx.TouchEventHandler.mWaitForTouchListeners, and org.mozilla.gecko.gfx.TouchEventHandler.touchFinished().
|
inline |
This function is how gecko sends us a default-prevented notification.
It is called once gecko knows definitively whether the block of events has had preventDefault called on it (either on the initial down event that starts the block, or on the first event following that down event).
This function MUST be called on the UI thread.
Definition at line 191 of file TouchEventHandler.java.
References org.mozilla.gecko.gfx.TouchEventHandler.mProcessingBalance, and org.mozilla.gecko.gfx.TouchEventHandler.processEventBlock().
|
inlineprivate |
Definition at line 208 of file TouchEventHandler.java.
References action.
Referenced by org.mozilla.gecko.gfx.TouchEventHandler.handleEvent(), and org.mozilla.gecko.gfx.TouchEventHandler.processEventBlock().
|
inlineprivate |
Process the block of events at the head of the queue now that we know whether it has been default-prevented or not.
Definition at line 236 of file TouchEventHandler.java.
References org.mozilla.gecko.gfx.TouchEventHandler.dispatchEvent(), Exception, org.mozilla.gecko.gfx.TouchEventHandler.isDownEvent(), Log, org.mozilla.gecko.gfx.TouchEventHandler.LOGTAG, org.mozilla.gecko.gfx.TouchEventHandler.mDispatchEvents, org.mozilla.gecko.gfx.TouchEventHandler.mEventQueue, org.mozilla.gecko.gfx.TouchEventHandler.mHoldInQueue, org.mozilla.gecko.gfx.TouchEventHandler.mPanZoomController, now, and org.mozilla.gecko.gfx.TouchEventHandler.touchFinished().
Referenced by org.mozilla.gecko.gfx.TouchEventHandler.handleEventListenerAction(), and org.mozilla.gecko.gfx.TouchEventHandler.ListenerTimeoutProcessor.run().
|
inline |
Definition at line 204 of file TouchEventHandler.java.
References org.mozilla.gecko.gfx.TouchEventHandler.mWaitForTouchListeners.
|
inlineprivate |
Definition at line 213 of file TouchEventHandler.java.
References action.
Referenced by org.mozilla.gecko.gfx.TouchEventHandler.handleEvent(), and org.mozilla.gecko.gfx.TouchEventHandler.processEventBlock().
|
private |
Definition at line 53 of file TouchEventHandler.java.
Referenced by org.mozilla.gecko.gfx.TouchEventHandler.handleEvent().
|
staticprivate |
Definition at line 49 of file TouchEventHandler.java.
Referenced by org.mozilla.gecko.gfx.TouchEventHandler.processEventBlock().
|
private |
Definition at line 78 of file TouchEventHandler.java.
Referenced by org.mozilla.gecko.gfx.TouchEventHandler.handleEvent(), and org.mozilla.gecko.gfx.TouchEventHandler.processEventBlock().
|
private |
Definition at line 62 of file TouchEventHandler.java.
Referenced by org.mozilla.gecko.gfx.TouchEventHandler.handleEvent(), and org.mozilla.gecko.gfx.TouchEventHandler.processEventBlock().
|
private |
Definition at line 56 of file TouchEventHandler.java.
Referenced by org.mozilla.gecko.gfx.TouchEventHandler.dispatchEvent().
|
private |
Definition at line 72 of file TouchEventHandler.java.
Referenced by org.mozilla.gecko.gfx.TouchEventHandler.handleEvent(), and org.mozilla.gecko.gfx.TouchEventHandler.processEventBlock().
|
private |
Definition at line 63 of file TouchEventHandler.java.
Referenced by org.mozilla.gecko.gfx.TouchEventHandler.handleEvent().
|
private |
Definition at line 58 of file TouchEventHandler.java.
Referenced by org.mozilla.gecko.gfx.TouchEventHandler.dispatchEvent(), org.mozilla.gecko.gfx.TouchEventHandler.handleEvent(), and org.mozilla.gecko.gfx.TouchEventHandler.processEventBlock().
|
private |
Definition at line 118 of file TouchEventHandler.java.
Referenced by org.mozilla.gecko.gfx.TouchEventHandler.handleEventListenerAction(), and org.mozilla.gecko.gfx.TouchEventHandler.ListenerTimeoutProcessor.run().
|
private |
Definition at line 57 of file TouchEventHandler.java.
Referenced by org.mozilla.gecko.gfx.TouchEventHandler.dispatchEvent().
|
private |
Definition at line 55 of file TouchEventHandler.java.
Referenced by org.mozilla.gecko.gfx.TouchEventHandler.handleEvent().
|
private |
Definition at line 67 of file TouchEventHandler.java.
Referenced by org.mozilla.gecko.gfx.TouchEventHandler.handleEvent(), and org.mozilla.gecko.gfx.TouchEventHandler.setWaitForTouchListeners().