MotionEventCompat

Added in 1.1.0

class MotionEventCompat


Helper for accessing features in MotionEvent.

Summary

Constants

const Int

This property is deprecated.

Use ACTION_HOVER_ENTER directly.

const Int

This property is deprecated.

Use ACTION_HOVER_EXIT directly.

const Int

This property is deprecated.

Use ACTION_HOVER_MOVE directly.

const Int

This property is deprecated.

Use ACTION_MASK directly.

const Int

This property is deprecated.

Use ACTION_POINTER_DOWN directly.

const Int

This property is deprecated.

Use ACTION_POINTER_INDEX_MASK directly.

const Int

This property is deprecated.

Use ACTION_POINTER_INDEX_SHIFT directly.

const Int

This property is deprecated.

Use ACTION_POINTER_UP directly.

const Int

This property is deprecated.

Use ACTION_SCROLL directly.

const Int

This property is deprecated.

Use AXIS_BRAKE directly.

const Int

This property is deprecated.

Use AXIS_DISTANCE directly.

const Int

This property is deprecated.

Use AXIS_GAS directly.

const Int

This property is deprecated.

Use AXIS_GENERIC_1 directly.

const Int

This property is deprecated.

Use AXIS_GENERIC_10 directly.

const Int

This property is deprecated.

Use AXIS_GENERIC_11 directly.

const Int

This property is deprecated.

Use AXIS_GENERIC_12 directly.

const Int

This property is deprecated.

Use AXIS_GENERIC_13 directly.

const Int

This property is deprecated.

Use AXIS_GENERIC_14 directly.

const Int

This property is deprecated.

Use AXIS_GENERIC_15 directly.

const Int

This property is deprecated.

Use AXIS_GENERIC_16 directly.

const Int

This property is deprecated.

Use AXIS_GENERIC_2 directly.

const Int

This property is deprecated.

Use AXIS_GENERIC_3 directly.

const Int

This property is deprecated.

Use AXIS_GENERIC_4 directly.

const Int

This property is deprecated.

Use AXIS_GENERIC_5 directly.

const Int

This property is deprecated.

Use AXIS_GENERIC_6 directly.

const Int

This property is deprecated.

Use AXIS_GENERIC_7 directly.

const Int

This property is deprecated.

Use AXIS_GENERIC_8 directly.

const Int

This property is deprecated.

Use AXIS_GENERIC_9 directly.

const Int

This property is deprecated.

Use AXIS_HAT_X directly.

const Int

This property is deprecated.

Use AXIS_HAT_Y directly.

const Int

This property is deprecated.

Use AXIS_HSCROLL directly.

const Int

This property is deprecated.

Use AXIS_LTRIGGER directly.

const Int

This property is deprecated.

Use AXIS_ORIENTATION directly.

const Int

This property is deprecated.

Use AXIS_PRESSURE directly.

const Int

Synonym for AXIS_RELATIVE_X.

const Int

Synonym for AXIS_RELATIVE_Y.

const Int

This property is deprecated.

Use AXIS_RTRIGGER directly.

const Int

This property is deprecated.

Use AXIS_RUDDER directly.

const Int
AXIS_RX = 12

This property is deprecated.

Use AXIS_RX directly.

const Int
AXIS_RY = 13

This property is deprecated.

Use AXIS_RY directly.

const Int
AXIS_RZ = 14

This property is deprecated.

Use AXIS_RZ directly.

const Int

Synonym for AXIS_SCROLL.

const Int

This property is deprecated.

Use AXIS_SIZE directly.

const Int

This property is deprecated.

Use AXIS_THROTTLE directly.

const Int

This property is deprecated.

Use AXIS_TILT directly.

const Int

This property is deprecated.

Use AXIS_TOOL_MAJOR directly.

const Int

This property is deprecated.

Use AXIS_TOOL_MINOR directly.

const Int

This property is deprecated.

Use AXIS_TOUCH_MAJOR directly.

const Int

This property is deprecated.

Use AXIS_TOUCH_MINOR directly.

const Int

This property is deprecated.

Use AXIS_VSCROLL directly.

const Int

This property is deprecated.

Use AXIS_WHEEL directly.

const Int
AXIS_X = 0

This property is deprecated.

Use AXIS_X directly.

const Int
AXIS_Y = 1

This property is deprecated.

Use AXIS_Y directly.

const Int
AXIS_Z = 11

This property is deprecated.

Use AXIS_Z directly.

const Int

This property is deprecated.

Use BUTTON_PRIMARY directly.

Public functions

java-static Int
@ReplaceWith(expression = "event.findPointerIndex(pointerId)")
findPointerIndex(event: MotionEvent!, pointerId: Int)

This function is deprecated.

Call findPointerIndex directly.

java-static Int
@ReplaceWith(expression = "event.getActionIndex()")
getActionIndex(event: MotionEvent!)

This function is deprecated.

Call getActionIndex directly.

java-static Int
@ReplaceWith(expression = "event.getActionMasked()")
getActionMasked(event: MotionEvent!)

This function is deprecated.

Call getAction directly.

java-static Float
@ReplaceWith(expression = "event.getAxisValue(axis)")
getAxisValue(event: MotionEvent!, axis: Int)

This function is deprecated.

Call getAxisValue directly.

java-static Float
@ReplaceWith(expression = "event.getAxisValue(axis, pointerIndex)")
getAxisValue(event: MotionEvent!, axis: Int, pointerIndex: Int)

This function is deprecated.

Call getAxisValue directly.

java-static Int
@ReplaceWith(expression = "event.getButtonState()")
getButtonState(event: MotionEvent!)

This function is deprecated.

Call getButtonState directly.

java-static Int
@ReplaceWith(expression = "event.getPointerCount()")
getPointerCount(event: MotionEvent!)

This function is deprecated.

Call getPointerCount directly.

java-static Int
@ReplaceWith(expression = "event.getPointerId(pointerIndex)")
getPointerId(event: MotionEvent!, pointerIndex: Int)

This function is deprecated.

Call getPointerId directly.

java-static Int
@ReplaceWith(expression = "event.getSource()")
getSource(event: MotionEvent!)

This function is deprecated.

Call getSource directly.

java-static Float
@ReplaceWith(expression = "event.getX(pointerIndex)")
getX(event: MotionEvent!, pointerIndex: Int)

This function is deprecated.

Call getX directly.

java-static Float
@ReplaceWith(expression = "event.getY(pointerIndex)")
getY(event: MotionEvent!, pointerIndex: Int)

This function is deprecated.

Call getY directly.

java-static Boolean
isFromSource(event: MotionEvent, source: Int)

Determines whether the event is from the given source.

Constants

ACTION_HOVER_ENTER

Added in 1.1.0
Deprecated in 1.1.0
const val ACTION_HOVER_ENTER = 9: Int

Synonym for ACTION_HOVER_ENTER.

ACTION_HOVER_EXIT

Added in 1.1.0
Deprecated in 1.1.0
const val ACTION_HOVER_EXIT = 10: Int

Synonym for ACTION_HOVER_EXIT.

ACTION_HOVER_MOVE

Added in 1.1.0
Deprecated in 1.1.0
const val ACTION_HOVER_MOVE = 7: Int

Synonym for ACTION_HOVER_MOVE.

ACTION_MASK

Added in 1.1.0
Deprecated in 1.1.0
const val ACTION_MASK = 255: Int

Synonym for ACTION_MASK.

ACTION_POINTER_DOWN

Added in 1.1.0
Deprecated in 1.1.0
const val ACTION_POINTER_DOWN = 5: Int

Synonym for ACTION_POINTER_DOWN.

ACTION_POINTER_INDEX_MASK

Added in 1.1.0
Deprecated in 1.1.0
const val ACTION_POINTER_INDEX_MASK = 65280: Int

Synonym for ACTION_POINTER_INDEX_MASK.

ACTION_POINTER_INDEX_SHIFT

Added in 1.1.0
Deprecated in 1.1.0
const val ACTION_POINTER_INDEX_SHIFT = 8: Int

Synonym for ACTION_POINTER_INDEX_SHIFT.

ACTION_POINTER_UP

Added in 1.1.0
Deprecated in 1.1.0
const val ACTION_POINTER_UP = 6: Int

Synonym for ACTION_POINTER_UP.

ACTION_SCROLL

Added in 1.1.0
Deprecated in 1.1.0
const val ACTION_SCROLL = 8: Int

Synonym for ACTION_SCROLL.

AXIS_BRAKE

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_BRAKE = 23: Int

Synonym for AXIS_BRAKE.

AXIS_DISTANCE

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_DISTANCE = 24: Int

Synonym for AXIS_DISTANCE.

AXIS_GAS

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_GAS = 22: Int

Synonym for AXIS_GAS.

AXIS_GENERIC_1

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_GENERIC_1 = 32: Int

Synonym for AXIS_GENERIC_1.

AXIS_GENERIC_10

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_GENERIC_10 = 41: Int

Synonym for AXIS_GENERIC_10.

AXIS_GENERIC_11

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_GENERIC_11 = 42: Int

Synonym for AXIS_GENERIC_11.

AXIS_GENERIC_12

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_GENERIC_12 = 43: Int

Synonym for AXIS_GENERIC_12.

AXIS_GENERIC_13

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_GENERIC_13 = 44: Int

Synonym for AXIS_GENERIC_13.

AXIS_GENERIC_14

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_GENERIC_14 = 45: Int

Synonym for AXIS_GENERIC_14.

AXIS_GENERIC_15

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_GENERIC_15 = 46: Int

Synonym for AXIS_GENERIC_15.

AXIS_GENERIC_16

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_GENERIC_16 = 47: Int

Synonym for AXIS_GENERIC_16.

AXIS_GENERIC_2

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_GENERIC_2 = 33: Int

Synonym for AXIS_GENERIC_2.

AXIS_GENERIC_3

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_GENERIC_3 = 34: Int

Synonym for AXIS_GENERIC_3.

AXIS_GENERIC_4

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_GENERIC_4 = 35: Int

Synonym for AXIS_GENERIC_4.

AXIS_GENERIC_5

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_GENERIC_5 = 36: Int

Synonym for AXIS_GENERIC_5.

AXIS_GENERIC_6

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_GENERIC_6 = 37: Int

Synonym for AXIS_GENERIC_6.

AXIS_GENERIC_7

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_GENERIC_7 = 38: Int

Synonym for AXIS_GENERIC_7.

AXIS_GENERIC_8

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_GENERIC_8 = 39: Int

Synonym for AXIS_GENERIC_8.

AXIS_GENERIC_9

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_GENERIC_9 = 40: Int

Synonym for AXIS_GENERIC_9.

AXIS_HAT_X

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_HAT_X = 15: Int

Synonym for AXIS_HAT_X.

AXIS_HAT_Y

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_HAT_Y = 16: Int

Synonym for AXIS_HAT_Y.

AXIS_HSCROLL

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_HSCROLL = 10: Int

Synonym for AXIS_HSCROLL.

AXIS_LTRIGGER

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_LTRIGGER = 17: Int

Synonym for AXIS_LTRIGGER.

AXIS_ORIENTATION

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_ORIENTATION = 8: Int

Synonym for AXIS_ORIENTATION.

AXIS_PRESSURE

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_PRESSURE = 2: Int

Synonym for AXIS_PRESSURE.

AXIS_RELATIVE_X

Added in 1.1.0
const val AXIS_RELATIVE_X = 27: Int

Synonym for AXIS_RELATIVE_X.

AXIS_RELATIVE_Y

Added in 1.1.0
const val AXIS_RELATIVE_Y = 28: Int

Synonym for AXIS_RELATIVE_Y.

AXIS_RTRIGGER

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_RTRIGGER = 18: Int

Synonym for AXIS_RTRIGGER.

AXIS_RUDDER

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_RUDDER = 20: Int

Synonym for AXIS_RUDDER.

AXIS_RX

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_RX = 12: Int

Synonym for AXIS_RX.

AXIS_RY

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_RY = 13: Int

Synonym for AXIS_RY.

AXIS_RZ

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_RZ = 14: Int

Synonym for AXIS_RZ.

AXIS_SCROLL

Added in 1.1.0
const val AXIS_SCROLL = 26: Int

Synonym for AXIS_SCROLL.

AXIS_SIZE

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_SIZE = 3: Int

Synonym for AXIS_SIZE.

AXIS_THROTTLE

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_THROTTLE = 19: Int

Synonym for AXIS_THROTTLE.

AXIS_TILT

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_TILT = 25: Int

Synonym for AXIS_TILT.

AXIS_TOOL_MAJOR

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_TOOL_MAJOR = 6: Int

Synonym for AXIS_TOOL_MAJOR.

AXIS_TOOL_MINOR

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_TOOL_MINOR = 7: Int

Synonym for AXIS_TOOL_MINOR.

AXIS_TOUCH_MAJOR

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_TOUCH_MAJOR = 4: Int

Synonym for AXIS_TOUCH_MAJOR.

AXIS_TOUCH_MINOR

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_TOUCH_MINOR = 5: Int

Synonym for AXIS_TOUCH_MINOR.

AXIS_VSCROLL

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_VSCROLL = 9: Int

Synonym for AXIS_VSCROLL.

AXIS_WHEEL

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_WHEEL = 21: Int

Synonym for AXIS_WHEEL.

AXIS_X

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_X = 0: Int

Synonym for AXIS_X.

AXIS_Y

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_Y = 1: Int

Synonym for AXIS_Y.

AXIS_Z

Added in 1.1.0
Deprecated in 1.1.0
const val AXIS_Z = 11: Int

Synonym for AXIS_Z.

BUTTON_PRIMARY

Added in 1.1.0
Deprecated in 1.1.0
const val BUTTON_PRIMARY = 1: Int

Synonym for BUTTON_PRIMARY.

Public functions

findPointerIndex

Added in 1.1.0
Deprecated in 1.1.0
@ReplaceWith(expression = "event.findPointerIndex(pointerId)")
java-static fun findPointerIndex(event: MotionEvent!, pointerId: Int): Int

Call findPointerIndex.

getActionIndex

Added in 1.1.0
Deprecated in 1.1.0
@ReplaceWith(expression = "event.getActionIndex()")
java-static fun getActionIndex(event: MotionEvent!): Int

Call getAction, returning only the pointer index portion.

getActionMasked

Added in 1.1.0
Deprecated in 1.1.0
@ReplaceWith(expression = "event.getActionMasked()")
java-static fun getActionMasked(event: MotionEvent!): Int

Call getAction, returning only the ACTION_MASK portion.

getAxisValue

Added in 1.1.0
Deprecated in 1.1.0
@ReplaceWith(expression = "event.getAxisValue(axis)")
java-static fun getAxisValue(event: MotionEvent!, axis: Int): Float

Get axis value for the first pointer index (may be an arbitrary pointer identifier).

Parameters
event: MotionEvent!

motion event for which to get the value.

axis: Int

The axis identifier for the axis value to retrieve.

See also
AXIS_X
AXIS_Y

getAxisValue

Added in 1.1.0
Deprecated in 1.1.0
@ReplaceWith(expression = "event.getAxisValue(axis, pointerIndex)")
java-static fun getAxisValue(event: MotionEvent!, axis: Int, pointerIndex: Int): Float

Returns the value of the requested axis for the given pointer index (use getPointerId to find the pointer identifier for this index).

Parameters
event: MotionEvent!

motion event for which to get the value.

axis: Int

The axis identifier for the axis value to retrieve.

pointerIndex: Int

Raw index of pointer to retrieve. Value may be from 0 (the first pointer that is down) to getPointerCount-1.

Returns
Float

The value of the axis, or 0 if the axis is not available.

See also
AXIS_X
AXIS_Y

getButtonState

Added in 1.1.0
Deprecated in 1.1.0
@ReplaceWith(expression = "event.getButtonState()")
java-static fun getButtonState(event: MotionEvent!): Int

getPointerCount

Added in 1.1.0
Deprecated in 1.1.0
@ReplaceWith(expression = "event.getPointerCount()")
java-static fun getPointerCount(event: MotionEvent!): Int

The number of pointers of data contained in this event. Always

getPointerId

Added in 1.1.0
Deprecated in 1.1.0
@ReplaceWith(expression = "event.getPointerId(pointerIndex)")
java-static fun getPointerId(event: MotionEvent!, pointerIndex: Int): Int

Call getPointerId.

getSource

Added in 1.1.0
Deprecated in 1.1.0
@ReplaceWith(expression = "event.getSource()")
java-static fun getSource(event: MotionEvent!): Int

Gets the source of the event.

Returns
Int

The event source or SOURCE_UNKNOWN if unknown.

getX

Added in 1.1.0
Deprecated in 1.1.0
@ReplaceWith(expression = "event.getX(pointerIndex)")
java-static fun getX(event: MotionEvent!, pointerIndex: Int): Float

Call getX.

getY

Added in 1.1.0
Deprecated in 1.1.0
@ReplaceWith(expression = "event.getY(pointerIndex)")
java-static fun getY(event: MotionEvent!, pointerIndex: Int): Float

Call getY.

isFromSource

Added in 1.1.0
java-static fun isFromSource(event: MotionEvent, source: Int): Boolean

Determines whether the event is from the given source.

Parameters
event: MotionEvent

motion event for which to check the source.

source: Int

The input source to check against.

Returns
Boolean

Whether the event is from the given source.