Package icyllis.modernui.view

# Class KeyEvent.DispatcherState

java.lang.Object
icyllis.modernui.view.KeyEvent.DispatcherState

Enclosing class:
  `KeyEvent`

public static class KeyEvent.DispatcherState extends Object

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DispatcherState()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `handleUpEvent(KeyEvent event)`
  Handle key up event to stop tracking.
  `boolean`
  `isTracking(KeyEvent event)`
  Return true if the key event is for a key code that is currently being tracked by the dispatcher.
  `void`
  `performedLongPress(KeyEvent event)`
  Keep track of the given event's key code as having performed an action with a long press, so no action should occur on the up.
  `void`
  `reset()`
  Reset back to initial state.
  `void`
  `reset(Object target)`
  Stop any tracking associated with this target.
  `void`
  `startTracking(KeyEvent event, Object target)`
  Start tracking the key code associated with the given event.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### DispatcherState

    public DispatcherState()

- ## Method Details

  - ### reset

    public void reset()
    Reset back to initial state.

  - ### reset

    public void reset(Object target)
    Stop any tracking associated with this target.

  - ### startTracking

    public void startTracking(@NonNull KeyEvent event, Object target)
    Start tracking the key code associated with the given event. This can only be called on a key down. It will allow you to see any long press associated with the key, and will result in `KeyEvent.isTracking()` return true on the long press and up events.

    This is only needed if you are directly dispatching events, rather than handling them in

    invalid reference

        Callback#onKeyDown

    .

  - ### isTracking

    public boolean isTracking(@NonNull KeyEvent event)
    Return true if the key event is for a key code that is currently being tracked by the dispatcher.

  - ### performedLongPress

    public void performedLongPress(@NonNull KeyEvent event)
    Keep track of the given event's key code as having performed an action with a long press, so no action should occur on the up.

    This is only needed if you are directly dispatching events, rather than handling them in

    invalid reference

        Callback#onKeyLongPress

    .

  - ### handleUpEvent

    public void handleUpEvent(@NonNull KeyEvent event)
    Handle key up event to stop tracking. This resets the dispatcher state, and updates the key event state based on it.

    This is only needed if you are directly dispatching events, rather than handling them in

    invalid reference

        Callback#onKeyUp

    .