LibreOffice Module android (master) 1
Classes | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
org.mozilla.gecko.gfx.TouchEventHandler Class Reference

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...

Collaboration diagram for org.mozilla.gecko.gfx.TouchEventHandler:
[legend]

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"
 

Detailed Description

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.

Member Function Documentation

◆ dispatchEvent()

void org.mozilla.gecko.gfx.TouchEventHandler.dispatchEvent ( MotionEvent  event)
inlineprivate

◆ handleEvent()

boolean org.mozilla.gecko.gfx.TouchEventHandler.handleEvent ( MotionEvent  event)
inline

◆ handleEventListenerAction()

void org.mozilla.gecko.gfx.TouchEventHandler.handleEventListenerAction ( boolean  allowDefaultAction)
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().

◆ isDownEvent()

boolean org.mozilla.gecko.gfx.TouchEventHandler.isDownEvent ( MotionEvent  event)
inlineprivate

◆ processEventBlock()

void org.mozilla.gecko.gfx.TouchEventHandler.processEventBlock ( boolean  allowDefaultAction)
inlineprivate

◆ setWaitForTouchListeners()

void org.mozilla.gecko.gfx.TouchEventHandler.setWaitForTouchListeners ( boolean  aValue)
inline

◆ touchFinished()

boolean org.mozilla.gecko.gfx.TouchEventHandler.touchFinished ( MotionEvent  event)
inlineprivate

Member Data Documentation

◆ EVENT_LISTENER_TIMEOUT

final int org.mozilla.gecko.gfx.TouchEventHandler.EVENT_LISTENER_TIMEOUT = 200
private

◆ LOGTAG

final String org.mozilla.gecko.gfx.TouchEventHandler.LOGTAG = "GeckoTouchEventHandler"
staticprivate

◆ mDispatchEvents

boolean org.mozilla.gecko.gfx.TouchEventHandler.mDispatchEvents
private

◆ mEventQueue

final Queue<MotionEvent> org.mozilla.gecko.gfx.TouchEventHandler.mEventQueue
private

◆ mGestureDetector

final GestureDetector org.mozilla.gecko.gfx.TouchEventHandler.mGestureDetector
private

◆ mHoldInQueue

boolean org.mozilla.gecko.gfx.TouchEventHandler.mHoldInQueue
private

◆ mListenerTimeoutProcessor

final ListenerTimeoutProcessor org.mozilla.gecko.gfx.TouchEventHandler.mListenerTimeoutProcessor
private

◆ mPanZoomController

final JavaPanZoomController org.mozilla.gecko.gfx.TouchEventHandler.mPanZoomController
private

◆ mProcessingBalance

int org.mozilla.gecko.gfx.TouchEventHandler.mProcessingBalance
private

◆ mScaleGestureDetector

final SimpleScaleGestureDetector org.mozilla.gecko.gfx.TouchEventHandler.mScaleGestureDetector
private

◆ mView

final View org.mozilla.gecko.gfx.TouchEventHandler.mView
private

◆ mWaitForTouchListeners

boolean org.mozilla.gecko.gfx.TouchEventHandler.mWaitForTouchListeners
private

The documentation for this class was generated from the following file: