InputDeviceCompat
class InputDeviceCompat
kotlin.Any | |
↳ | androidx.core.view.InputDeviceCompat |
Helper class for accessing values in android.view.InputDevice
.
Summary
Constants |
|
---|---|
static Int |
A special input source constant that is used when filtering input devices to match devices that provide any type of input source. |
static Int |
The input source has buttons or keys. |
static Int |
The input source is a joystick. |
static Int |
A mask for input source classes. |
static Int |
The input source has no class. |
static Int |
The input source is a pointing device associated with a display. |
static Int |
The input source is an absolute positioning device not associated with a display (unlike |
static Int |
The input source is a trackball navigation device. |
static Int |
The input source is a DPad. |
static Int |
The input source is a game pad. |
static Int |
The input source is a device connected through HDMI-based bus. |
static Int |
The input source is a joystick. |
static Int |
The input source is a keyboard. |
static Int |
The input source is a mouse pointing device. |
static Int |
The input source is a rotating encoder device whose motions should be interpreted as akin to those of a scroll wheel. |
static Int |
The input source is a stylus pointing device. |
static Int |
The input source is a touch pad or digitizer tablet that is not associated with a display (unlike |
static Int |
The input source is a touch screen pointing device. |
static Int |
The input source is a touch device whose motions should be interpreted as navigation events. |
static Int |
The input source is a trackball. |
static Int |
The input source is unknown. |
Constants
SOURCE_ANY
static val SOURCE_ANY: Int
A special input source constant that is used when filtering input devices to match devices that provide any type of input source.
Value: 0xffffff00
SOURCE_CLASS_BUTTON
static val SOURCE_CLASS_BUTTON: Int
The input source has buttons or keys. Examples: SOURCE_KEYBOARD
, SOURCE_DPAD
. A android.view.KeyEvent
should be interpreted as a button or key press.
Value: 0x00000001
SOURCE_CLASS_JOYSTICK
static val SOURCE_CLASS_JOYSTICK: Int
The input source is a joystick. A android.view.MotionEvent
should be interpreted as absolute joystick movements. Use android.view.InputDevice#getMotionRange
to query the range of positions.
Value: 0x00000010
SOURCE_CLASS_MASK
static val SOURCE_CLASS_MASK: Int
A mask for input source classes. Each distinct input source constant has one or more input source class bits set to specify the desired interpretation for its input events.
Value: 0x000000ff
SOURCE_CLASS_NONE
static val SOURCE_CLASS_NONE: Int
The input source has no class. It is up to the application to determine how to handle the device based on the device type.
Value: 0x00000000
SOURCE_CLASS_POINTER
static val SOURCE_CLASS_POINTER: Int
The input source is a pointing device associated with a display. Examples: SOURCE_TOUCHSCREEN
, SOURCE_MOUSE
. A android.view.MotionEvent
should be interpreted as absolute coordinates in display units according to the android.view.View
hierarchy. Pointer down/up indicated when the finger touches the display or when the selection button is pressed/released. Use android.view.InputDevice#getMotionRange
to query the range of the pointing device. Some devices permit touches outside the display area so the effective range may be somewhat smaller or larger than the actual display size.
Value: 0x00000002
SOURCE_CLASS_POSITION
static val SOURCE_CLASS_POSITION: Int
The input source is an absolute positioning device not associated with a display (unlike SOURCE_CLASS_POINTER
). A android.view.MotionEvent
should be interpreted as absolute coordinates in device-specific surface units. Use android.view.InputDevice#getMotionRange
to query the range of positions.
Value: 0x00000008
SOURCE_CLASS_TRACKBALL
static val SOURCE_CLASS_TRACKBALL: Int
The input source is a trackball navigation device. Examples: SOURCE_TRACKBALL
. A android.view.MotionEvent
should be interpreted as relative movements in device-specific units used for navigation purposes. Pointer down/up indicates when the selection button is pressed/released. Use android.view.InputDevice#getMotionRange
to query the range of motion.
Value: 0x00000004
SOURCE_DPAD
static val SOURCE_DPAD: Int
The input source is a DPad.
Value: 0x00000200 | SOURCE_CLASS_BUTTON
See Also
SOURCE_GAMEPAD
static val SOURCE_GAMEPAD: Int
The input source is a game pad. (It may also be a SOURCE_JOYSTICK
).
Value: 0x00000400 | SOURCE_CLASS_BUTTON
See Also
SOURCE_HDMI
static val SOURCE_HDMI: Int
The input source is a device connected through HDMI-based bus. The key comes in through HDMI-CEC or MHL signal line, and is treated as if it were generated by a locally connected DPAD or keyboard.
Value: 0x02000000 | SOURCE_CLASS_BUTTON
SOURCE_JOYSTICK
static val SOURCE_JOYSTICK: Int
The input source is a joystick. (It may also be a SOURCE_GAMEPAD
).
Value: 0x01000000 | SOURCE_CLASS_JOYSTICK
See Also
SOURCE_KEYBOARD
static val SOURCE_KEYBOARD: Int
The input source is a keyboard. This source indicates pretty much anything that has buttons. Use android.view.InputDevice#getKeyboardType()
to determine whether the keyboard has alphabetic keys and can be used to enter text.
Value: 0x00000100 | SOURCE_CLASS_BUTTON
See Also
SOURCE_MOUSE
static val SOURCE_MOUSE: Int
The input source is a mouse pointing device. This code is also used for other mouse-like pointing devices such as trackpads and trackpoints.
Value: 0x00002000 | SOURCE_CLASS_POINTER
See Also
SOURCE_ROTARY_ENCODER
static val SOURCE_ROTARY_ENCODER: Int
The input source is a rotating encoder device whose motions should be interpreted as akin to those of a scroll wheel.
Value: 0x00400000 | SOURCE_CLASS_NONE
See Also
SOURCE_STYLUS
static val SOURCE_STYLUS: Int
The input source is a stylus pointing device.
Note that this bit merely indicates that an input device is capable of obtaining input from a stylus. To determine whether a given touch event was produced by a stylus, examine the tool type returned by android.view.MotionEvent#getToolType(int)
for each individual pointer.
A single touch event may multiple pointers with different tool types, such as an event that has one pointer with tool type android.view.MotionEvent#TOOL_TYPE_FINGER
and another pointer with tool type android.view.MotionEvent#TOOL_TYPE_STYLUS
. So it is important to examine the tool type of each pointer, regardless of the source reported by android.view.MotionEvent#getSource()
.
Value: 0x00004000 | SOURCE_CLASS_POINTER
See Also
SOURCE_TOUCHPAD
static val SOURCE_TOUCHPAD: Int
The input source is a touch pad or digitizer tablet that is not associated with a display (unlike SOURCE_TOUCHSCREEN
).
Value: 0x00100000 | SOURCE_CLASS_POSITION
See Also
SOURCE_TOUCHSCREEN
static val SOURCE_TOUCHSCREEN: Int
The input source is a touch screen pointing device.
Value: 0x00001000 | SOURCE_CLASS_POINTER
See Also
SOURCE_TOUCH_NAVIGATION
static val SOURCE_TOUCH_NAVIGATION: Int
The input source is a touch device whose motions should be interpreted as navigation events. For example, an upward swipe should be as an upward focus traversal in the same manner as pressing up on a D-Pad would be. Swipes to the left, right and down should be treated in a similar manner.
Value: 0x00200000 | SOURCE_CLASS_NONE
See Also
SOURCE_TRACKBALL
static val SOURCE_TRACKBALL: Int
The input source is a trackball.
Value: 0x00010000 | SOURCE_CLASS_TRACKBALL
See Also