KeyEvent.DispatcherState
public
static
class
KeyEvent.DispatcherState
extends Object
| java.lang.Object | |
| ↳ | android.view.KeyEvent.DispatcherState |
Use with dispatch(Callback, DispatcherState, Object)
for more advanced key dispatching, such as long presses.
Summary
Public constructors | |
|---|---|
KeyEvent.DispatcherState()
|
|
Public methods | |
|---|---|
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(Object target)
Stop any tracking associated with this target. |
void
|
reset()
Reset back to initial state. |
void
|
startTracking(KeyEvent event, Object target)
Start tracking the key code associated with the given event. |
Inherited methods | |
|---|---|
From
class
java.lang.Object
| |
Public constructors
Public methods
handleUpEvent
void handleUpEvent (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 onKeyUp(int, KeyEvent).
| Parameters | |
|---|---|
event |
KeyEvent
|
isTracking
boolean isTracking (KeyEvent event)
Return true if the key event is for a key code that is currently being tracked by the dispatcher.
| Parameters | |
|---|---|
event |
KeyEvent
|
| Returns | |
|---|---|
boolean |
|
performedLongPress
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.
This is only needed if you are directly dispatching events, rather
than handling them in onKeyLongPress(int, KeyEvent).
| Parameters | |
|---|---|
event |
KeyEvent
|
reset
void reset (Object target)
Stop any tracking associated with this target.
| Parameters | |
|---|---|
target |
Object
|
startTracking
void startTracking (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
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 onKeyDown(int, KeyEvent).
| Parameters | |
|---|---|
event |
KeyEvent
|
target |
Object
|
Annotations
Interfaces
- ActionMode.Callback
- ActionProvider.VisibilityListener
- Choreographer.FrameCallback
- CollapsibleActionView
- ContextMenu
- ContextMenu.ContextMenuInfo
- GestureDetector.OnContextClickListener
- GestureDetector.OnDoubleTapListener
- GestureDetector.OnGestureListener
- InputQueue.Callback
- KeyEvent.Callback
- LayoutInflater.Factory
- LayoutInflater.Factory2
- LayoutInflater.Filter
- Menu
- MenuItem
- MenuItem.OnActionExpandListener
- MenuItem.OnMenuItemClickListener
- PixelCopy.OnPixelCopyFinishedListener
- ScaleGestureDetector.OnScaleGestureListener
- SubMenu
- SurfaceHolder
- SurfaceHolder.Callback
- SurfaceHolder.Callback2
- TextureView.SurfaceTextureListener
- View.OnApplyWindowInsetsListener
- View.OnAttachStateChangeListener
- View.OnClickListener
- View.OnContextClickListener
- View.OnCreateContextMenuListener
- View.OnDragListener
- View.OnFocusChangeListener
- View.OnGenericMotionListener
- View.OnHoverListener
- View.OnKeyListener
- View.OnLayoutChangeListener
- View.OnLongClickListener
- View.OnScrollChangeListener
- View.OnSystemUiVisibilityChangeListener
- View.OnTouchListener
- ViewGroup.OnHierarchyChangeListener
- ViewManager
- ViewParent
- ViewStub.OnInflateListener
- ViewTreeObserver.OnDrawListener
- ViewTreeObserver.OnGlobalFocusChangeListener
- ViewTreeObserver.OnGlobalLayoutListener
- ViewTreeObserver.OnPreDrawListener
- ViewTreeObserver.OnScrollChangedListener
- ViewTreeObserver.OnTouchModeChangeListener
- ViewTreeObserver.OnWindowAttachListener
- ViewTreeObserver.OnWindowFocusChangeListener
- Window.Callback
- Window.OnFrameMetricsAvailableListener
- Window.OnRestrictedCaptionAreaChangedListener
- WindowManager
Classes
- AbsSavedState
- ActionMode
- ActionMode.Callback2
- ActionProvider
- Choreographer
- ContextThemeWrapper
- Display
- Display.HdrCapabilities
- Display.Mode
- DragAndDropPermissions
- DragEvent
- FocusFinder
- FrameMetrics
- FrameStats
- GestureDetector
- GestureDetector.SimpleOnGestureListener
- Gravity
- HapticFeedbackConstants
- InputDevice
- InputDevice.MotionRange
- InputEvent
- InputQueue
- KeyboardShortcutGroup
- KeyboardShortcutInfo
- KeyCharacterMap
- KeyCharacterMap.KeyData
- KeyEvent
- KeyEvent.DispatcherState
- LayoutInflater
- MenuInflater
- MotionEvent
- MotionEvent.PointerCoords
- MotionEvent.PointerProperties
- OrientationEventListener
- OrientationListener
- PixelCopy
- PointerIcon
- ScaleGestureDetector
- ScaleGestureDetector.SimpleOnScaleGestureListener
- SearchEvent
- SoundEffectConstants
- Surface
- SurfaceView
- TextureView
- TouchDelegate
- VelocityTracker
- View
- View.AccessibilityDelegate
- View.BaseSavedState
- View.DragShadowBuilder
- View.MeasureSpec
- ViewAnimationUtils
- ViewConfiguration
- ViewDebug
- ViewGroup
- ViewGroup.LayoutParams
- ViewGroup.MarginLayoutParams
- ViewGroupOverlay
- ViewOutlineProvider
- ViewOverlay
- ViewPropertyAnimator
- ViewStructure
- ViewStub
- ViewTreeObserver
- Window
- WindowAnimationFrameStats
- WindowContentFrameStats
- WindowId
- WindowId.FocusObserver
- WindowInsets
- WindowManager.LayoutParams
Enums
Exceptions


