EventStreamTransformation.javaAPI DocAndroid 5.1 API3723Thu Mar 12 22:22:42 GMT


public interface EventStreamTransformation
Interface for classes that can handle and potentially transform a stream of motion and accessibility events. Instances implementing this interface are ordered in a sequence to implement a transformation chain. An instance may consume, modify, and generate events. It is responsible to deliver the output events to the next transformation in the sequence set via {@link #setNext(EventStreamTransformation)}. Note that since instances implementing this interface are transformations of the event stream, an instance should work against the event stream potentially modified by previous ones. Hence, the order of transformations is important. It is a responsibility of each handler that decides to react to an event sequence and prevent any subsequent ones from performing an action to send the appropriate cancel event given it has delegated a part of the events that belong to the current gesture. This will ensure that subsequent transformations will not be left in an inconsistent state and the applications see a consistent event stream. For example, to cancel a {@link KeyEvent} the handler has to emit an event with action {@link KeyEvent#ACTION_UP} with the additional flag {@link KeyEvent#FLAG_CANCELED}. To cancel a {@link MotionEvent} the handler has to send an event with action {@link MotionEvent#ACTION_CANCEL}. It is a responsibility of each handler that received a cancel event to clear its internal state and to propagate the event to the next one to enable subsequent transformations to clear their internal state. It is a responsibility for each transformation to start handling events only after an event that designates the start of a well-formed event sequence. For example, if it received a down motion event followed by a cancel motion event, it should not handle subsequent move and up events until it gets a down.

Fields Summary
Constructors Summary
Methods Summary
public voidclear()
Clears the internal state of this transformation.

public voidonAccessibilityEvent(android.view.accessibility.AccessibilityEvent event)
Receives an accessibility event.

event The accessibility event.

public voidonDestroy()
Destroys this transformation.

public voidonMotionEvent(android.view.MotionEvent event, android.view.MotionEvent rawEvent, int policyFlags)
Receives a motion event. Passed are the event transformed by previous transformations and the raw event to which no transformations have been applied.

event The transformed motion event.
rawEvent The raw motion event.
policyFlags Policy flags for the event.

public voidsetNext( next)
Sets the next transformation.

next The next transformation.