InputDeviceCompat

Added in 1.1.0

public final class InputDeviceCompat


Helper class for accessing values in android.view.InputDevice.

Summary

Constants

static final int
SOURCE_ANY = -256

A special input source constant that is used when filtering input devices to match devices that provide any type of input source.

static final int

The input source has buttons or keys.

static final int

The input source is a joystick.

static final int

A mask for input source classes.

static final int

The input source has no class.

static final int

The input source is a pointing device associated with a display.

static final int

The input source is an absolute positioning device not associated with a display (unlike SOURCE_CLASS_POINTER).

static final int

The input source is a trackball navigation device.

static final int

The input source is a DPad.

static final int

The input source is a game pad.

static final int
SOURCE_HDMI = 33554433

The input source is a device connected through HDMI-based bus.

static final int
SOURCE_JOYSTICK = 16777232

The input source is a joystick.

static final int

The input source is a keyboard.

static final int

The input source is a mouse pointing device.

static final int

The input source is a rotating encoder device whose motions should be interpreted as akin to those of a scroll wheel.

static final int

The input source is a stylus pointing device.

static final int
SOURCE_TOUCHPAD = 1048584

The input source is a touch pad or digitizer tablet that is not associated with a display (unlike SOURCE_TOUCHSCREEN).

static final int

The input source is a touch screen pointing device.

static final int

The input source is a touch device whose motions should be interpreted as navigation events.

static final int

The input source is a trackball.

static final int

The input source is unknown.

Constants

SOURCE_ANY

Added in 1.1.0
public static final int SOURCE_ANY = -256

A special input source constant that is used when filtering input devices to match devices that provide any type of input source.

SOURCE_CLASS_BUTTON

Added in 1.1.0
public static final int SOURCE_CLASS_BUTTON = 1

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.

SOURCE_CLASS_JOYSTICK

Added in 1.1.0
public static final int SOURCE_CLASS_JOYSTICK = 16

The input source is a joystick. A android.view.MotionEvent should be interpreted as absolute joystick movements. Use getMotionRange to query the range of positions.

SOURCE_CLASS_MASK

Added in 1.1.0
public static final int SOURCE_CLASS_MASK = 255

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.

SOURCE_CLASS_NONE

Added in 1.1.0
public static final int SOURCE_CLASS_NONE = 0

The input source has no class. It is up to the application to determine how to handle the device based on the device type.

SOURCE_CLASS_POINTER

Added in 1.1.0
public static final int SOURCE_CLASS_POINTER = 2

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

SOURCE_CLASS_POSITION

Added in 1.1.0
public static final int SOURCE_CLASS_POSITION = 8

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 getMotionRange to query the range of positions.

SOURCE_CLASS_TRACKBALL

Added in 1.1.0
public static final int SOURCE_CLASS_TRACKBALL = 4

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 getMotionRange to query the range of motion.

SOURCE_DPAD

Added in 1.1.0
public static final int SOURCE_DPAD = 513

The input source is a DPad.

SOURCE_GAMEPAD

Added in 1.1.0
public static final int SOURCE_GAMEPAD = 1025

The input source is a game pad. (It may also be a SOURCE_JOYSTICK).

SOURCE_HDMI

Added in 1.1.0
public static final int SOURCE_HDMI = 33554433

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.

SOURCE_JOYSTICK

Added in 1.1.0
public static final int SOURCE_JOYSTICK = 16777232

The input source is a joystick. (It may also be a SOURCE_GAMEPAD).

SOURCE_KEYBOARD

Added in 1.1.0
public static final int SOURCE_KEYBOARD = 257

The input source is a keyboard. This source indicates pretty much anything that has buttons. Use getKeyboardType to determine whether the keyboard has alphabetic keys and can be used to enter text.

SOURCE_MOUSE

Added in 1.1.0
public static final int SOURCE_MOUSE = 8194

The input source is a mouse pointing device. This code is also used for other mouse-like pointing devices such as trackpads and trackpoints.

SOURCE_ROTARY_ENCODER

Added in 1.1.0
public static final int SOURCE_ROTARY_ENCODER = 4194304

The input source is a rotating encoder device whose motions should be interpreted as akin to those of a scroll wheel.

SOURCE_STYLUS

Added in 1.1.0
public static final int SOURCE_STYLUS = 16386

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 getToolType 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 TOOL_TYPE_FINGER and another pointer with tool type TOOL_TYPE_STYLUS. So it is important to examine the tool type of each pointer, regardless of the source reported by getSource.

SOURCE_TOUCHPAD

Added in 1.1.0
public static final int SOURCE_TOUCHPAD = 1048584

The input source is a touch pad or digitizer tablet that is not associated with a display (unlike SOURCE_TOUCHSCREEN).

SOURCE_TOUCHSCREEN

Added in 1.1.0
public static final int SOURCE_TOUCHSCREEN = 4098

The input source is a touch screen pointing device.

SOURCE_TOUCH_NAVIGATION

Added in 1.1.0
public static final int SOURCE_TOUCH_NAVIGATION = 2097152

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.

SOURCE_TRACKBALL

Added in 1.1.0
public static final int SOURCE_TRACKBALL = 65540

The input source is a trackball.

SOURCE_UNKNOWN

Added in 1.1.0
public static final int SOURCE_UNKNOWN = 0

The input source is unknown.