MotionEventCompat
public final class MotionEventCompat
Helper for accessing features in MotionEvent.
Summary
Constants |
|
|---|---|
static final int |
This field is deprecated. Use |
static final int |
ACTION_HOVER_EXIT = 10This field is deprecated. Use |
static final int |
This field is deprecated. Use |
static final int |
ACTION_MASK = 255This field is deprecated. Use |
static final int |
This field is deprecated. Use |
static final int |
ACTION_POINTER_INDEX_MASK = 65280This field is deprecated. Use |
static final int |
This field is deprecated. Use |
static final int |
This field is deprecated. Use |
static final int |
ACTION_SCROLL = 8This field is deprecated. Use |
static final int |
AXIS_BRAKE = 23This field is deprecated. Use |
static final int |
AXIS_DISTANCE = 24This field is deprecated. Use |
static final int |
AXIS_GAS = 22This field is deprecated. Use |
static final int |
AXIS_GENERIC_1 = 32This field is deprecated. Use |
static final int |
AXIS_GENERIC_10 = 41This field is deprecated. Use |
static final int |
AXIS_GENERIC_11 = 42This field is deprecated. Use |
static final int |
AXIS_GENERIC_12 = 43This field is deprecated. Use |
static final int |
AXIS_GENERIC_13 = 44This field is deprecated. Use |
static final int |
AXIS_GENERIC_14 = 45This field is deprecated. Use |
static final int |
AXIS_GENERIC_15 = 46This field is deprecated. Use |
static final int |
AXIS_GENERIC_16 = 47This field is deprecated. Use |
static final int |
AXIS_GENERIC_2 = 33This field is deprecated. Use |
static final int |
AXIS_GENERIC_3 = 34This field is deprecated. Use |
static final int |
AXIS_GENERIC_4 = 35This field is deprecated. Use |
static final int |
AXIS_GENERIC_5 = 36This field is deprecated. Use |
static final int |
AXIS_GENERIC_6 = 37This field is deprecated. Use |
static final int |
AXIS_GENERIC_7 = 38This field is deprecated. Use |
static final int |
AXIS_GENERIC_8 = 39This field is deprecated. Use |
static final int |
AXIS_GENERIC_9 = 40This field is deprecated. Use |
static final int |
AXIS_HAT_X = 15This field is deprecated. Use |
static final int |
AXIS_HAT_Y = 16This field is deprecated. Use |
static final int |
AXIS_HSCROLL = 10This field is deprecated. Use |
static final int |
AXIS_LTRIGGER = 17This field is deprecated. Use |
static final int |
AXIS_ORIENTATION = 8This field is deprecated. Use |
static final int |
AXIS_PRESSURE = 2This field is deprecated. Use |
static final int |
AXIS_RELATIVE_X = 27Synonym for |
static final int |
AXIS_RELATIVE_Y = 28Synonym for |
static final int |
AXIS_RTRIGGER = 18This field is deprecated. Use |
static final int |
AXIS_RUDDER = 20This field is deprecated. Use |
static final int |
AXIS_RX = 12This field is deprecated. Use |
static final int |
AXIS_RY = 13This field is deprecated. Use |
static final int |
AXIS_RZ = 14This field is deprecated. Use |
static final int |
AXIS_SCROLL = 26Synonym for |
static final int |
AXIS_SIZE = 3This field is deprecated. Use |
static final int |
AXIS_THROTTLE = 19This field is deprecated. Use |
static final int |
AXIS_TILT = 25This field is deprecated. Use |
static final int |
AXIS_TOOL_MAJOR = 6This field is deprecated. Use |
static final int |
AXIS_TOOL_MINOR = 7This field is deprecated. Use |
static final int |
AXIS_TOUCH_MAJOR = 4This field is deprecated. Use |
static final int |
AXIS_TOUCH_MINOR = 5This field is deprecated. Use |
static final int |
AXIS_VSCROLL = 9This field is deprecated. Use |
static final int |
AXIS_WHEEL = 21This field is deprecated. Use |
static final int |
AXIS_X = 0This field is deprecated. Use |
static final int |
AXIS_Y = 1This field is deprecated. Use |
static final int |
AXIS_Z = 11This field is deprecated. Use |
static final int |
BUTTON_PRIMARY = 1This field is deprecated. Use |
Public methods |
|
|---|---|
static int |
@ReplaceWith(expression = "event.findPointerIndex(pointerId)")This method is deprecated. Call |
static int |
@ReplaceWith(expression = "event.getActionIndex()")This method is deprecated. Call |
static int |
@ReplaceWith(expression = "event.getActionMasked()")This method is deprecated. Call |
static float |
@ReplaceWith(expression = "event.getAxisValue(axis)")This method is deprecated. Call |
static float |
@ReplaceWith(expression = "event.getAxisValue(axis, pointerIndex)")This method is deprecated. Call |
static int |
@ReplaceWith(expression = "event.getButtonState()")This method is deprecated. Call |
static int |
@ReplaceWith(expression = "event.getPointerCount()")This method is deprecated. Call |
static int |
@ReplaceWith(expression = "event.getPointerId(pointerIndex)")This method is deprecated. Call |
static int |
@ReplaceWith(expression = "event.getSource()")This method is deprecated. Call |
static float |
@ReplaceWith(expression = "event.getX(pointerIndex)")This method is deprecated. Call |
static float |
@ReplaceWith(expression = "event.getY(pointerIndex)")This method is deprecated. Call |
static boolean |
isFromSource(@NonNull MotionEvent event, int source)Determines whether the event is from the given source. |
Constants
AXIS_RELATIVE_X
public static final int AXIS_RELATIVE_X = 27
Synonym for AXIS_RELATIVE_X.
AXIS_RELATIVE_Y
public static final int AXIS_RELATIVE_Y = 28
Synonym for AXIS_RELATIVE_Y.
Public methods
@ReplaceWith(expression = "event.findPointerIndex(pointerId)")
public static intfindPointerIndex(MotionEvent event, int pointerId)
Call findPointerIndex.
@ReplaceWith(expression = "event.getActionIndex()")
public static intgetActionIndex(MotionEvent event)
Call getAction, returning only the pointer index portion.
@ReplaceWith(expression = "event.getActionMasked()")
public static intgetActionMasked(MotionEvent event)
Call getAction, returning only the ACTION_MASK portion.
@ReplaceWith(expression = "event.getAxisValue(axis)")
public static floatgetAxisValue(MotionEvent event, int axis)
Get axis value for the first pointer index (may be an arbitrary pointer identifier).
| Parameters | |
|---|---|
MotionEvent event |
motion event for which to get the value. |
int axis |
The axis identifier for the axis value to retrieve. |
@ReplaceWith(expression = "event.getAxisValue(axis, pointerIndex)")
public static floatgetAxisValue(MotionEvent event, int axis, int pointerIndex)
Returns the value of the requested axis for the given pointer index (use getPointerId to find the pointer identifier for this index).
| Parameters | |
|---|---|
MotionEvent event |
motion event for which to get the value. |
int axis |
The axis identifier for the axis value to retrieve. |
int pointerIndex |
Raw index of pointer to retrieve. Value may be from 0 (the first pointer that is down) to |
| Returns | |
|---|---|
float |
The value of the axis, or 0 if the axis is not available. |
@ReplaceWith(expression = "event.getButtonState()")
public static intgetButtonState(MotionEvent event)
@ReplaceWith(expression = "event.getPointerCount()")
public static intgetPointerCount(MotionEvent event)
The number of pointers of data contained in this event. Always
@ReplaceWith(expression = "event.getPointerId(pointerIndex)")
public static intgetPointerId(MotionEvent event, int pointerIndex)
Call getPointerId.
@ReplaceWith(expression = "event.getSource()")
public static intgetSource(MotionEvent event)
Gets the source of the event.
| Returns | |
|---|---|
int |
The event source or |
@ReplaceWith(expression = "event.getX(pointerIndex)")
public static floatgetX(MotionEvent event, int pointerIndex)
Call getX.
@ReplaceWith(expression = "event.getY(pointerIndex)")
public static floatgetY(MotionEvent event, int pointerIndex)
Call getY.
isFromSource
public static boolean isFromSource(@NonNull MotionEvent event, int source)
Determines whether the event is from the given source.
| Parameters | |
|---|---|
@NonNull MotionEvent event |
motion event for which to check the source. |
int source |
The input source to check against. |
| Returns | |
|---|---|
boolean |
Whether the event is from the given source. |