pub struct MotionEvent { /* private fields */ }
Expand description

A motion event

Wraps an AInputEvent * of the ffi::AINPUT_EVENT_TYPE_MOTION type.

For general discussion of motion events in Android, see the relevant javadoc.

Implementations

Constructs a MotionEvent from a pointer to a native ffi::AInputEvent

Safety

By calling this method, you assert that the pointer is a valid, non-null pointer to a native ffi::AInputEvent and that ffi::AInputEvent is an AMotionEvent.

Returns a pointer to the native ffi::AInputEvent

Get the source of the event.

See the NDK docs

Get the device id associated with the event.

See the NDK docs

Returns the motion action associated with the event.

See the NDK docs

Returns the pointer index of an Up or Down event.

Pointer indices can change per motion event. For an identifier that stays the same, see Pointer::pointer_id().

This only has a meaning when the action is one of Up, Down, PointerUp, or PointerDown.

Returns the number of pointers in this event

See the NDK docs

An iterator over the pointers in this motion event

The pointer at a given pointer index. Panics if the pointer index is out of bounds.

If you need to loop over all the pointers, prefer the pointers() method.

Returns the size of the history contained in this event.

See the NDK docs

An iterator over the historical events contained in this event.

Returns the state of any modifier keys that were pressed during the event.

See the NDK docs

Returns the button state during this event, as a bitfield.

See the NDK docs

Returns the time of the start of this gesture, in the java.lang.System.nanoTime() time base

See the NDK docs

Returns a bitfield indicating which edges were touched by this event.

See the NDK docs

Returns the time of this event, in the java.lang.System.nanoTime() time base

See the NDK docs

The flags associated with a motion event.

See the NDK docs

Returns the offset in the x direction between the coordinates and the raw coordinates

See the NDK docs

Returns the offset in the y direction between the coordinates and the raw coordinates

See the NDK docs

Returns the precision of the x value of the coordinates

See the NDK docs

Returns the precision of the y value of the coordinates

See the NDK docs

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.