MotionEvents

public final class MotionEvents


Facilitates sending of motion events to a UiController.

Summary

Nested types

Holds the result of a down motion.

Public methods

static MotionEvent
obtainDownEvent(float[] coordinates, float[] precision)
static MotionEvent
obtainDownEvent(
    float[] coordinates,
    float[] precision,
    int inputDevice,
    int buttonState
)

Obtains the MotionEvent of down.

static @NonNull MotionEvent
obtainMovement(
    @NonNull MotionEvent downEvent,
    @NonNull float[] coordinates
)

Create a new move motion event associated with the specified down motion event, at the current time.

static MotionEvent
obtainMovement(long downTime, float[] coordinates)

This method is deprecated.

Use obtainMovement instead.

static @NonNull MotionEvent
obtainMovement(
    @NonNull MotionEvent downEvent,
    long eventTime,
    @NonNull float[] coordinates
)

Create a new move motion event associated with the specified down motion event.

static MotionEvent
obtainMovement(long downTime, long eventTime, float[] coordinates)

This method is deprecated.

Use obtainMovement instead.

static MotionEvent
obtainUpEvent(MotionEvent downEvent, float[] coordinates)

Create a new finger up motion event associated with the specified down motion event, at the current time.

static MotionEvent
obtainUpEvent(
    MotionEvent downEvent,
    long eventTime,
    float[] coordinates
)

Create a new finger up motion event associated with the specified down motion event.

static void
sendCancel(UiController uiController, MotionEvent downEvent)
static MotionEvents.DownResultHolder
sendDown(
    UiController uiController,
    float[] coordinates,
    float[] precision
)
static MotionEvents.DownResultHolder
sendDown(
    UiController uiController,
    float[] coordinates,
    float[] precision,
    int inputDevice,
    int buttonState
)
static boolean
sendMovement(
    UiController uiController,
    MotionEvent downEvent,
    float[] coordinates
)
static boolean
sendUp(UiController uiController, MotionEvent downEvent)
static boolean
sendUp(
    UiController uiController,
    MotionEvent downEvent,
    float[] coordinates
)

Public methods

obtainDownEvent

public static MotionEvent obtainDownEvent(float[] coordinates, float[] precision)

obtainDownEvent

public static MotionEvent obtainDownEvent(
    float[] coordinates,
    float[] precision,
    int inputDevice,
    int buttonState
)

Obtains the MotionEvent of down.

obtainMovement

public static @NonNull MotionEvent obtainMovement(
    @NonNull MotionEvent downEvent,
    @NonNull float[] coordinates
)

Create a new move motion event associated with the specified down motion event, at the current time.

Parameters
@NonNull MotionEvent downEvent

the finger down motion event assoicated with this event.

@NonNull float[] coordinates

The coordinates of the event

obtainMovement

public static MotionEvent obtainMovement(long downTime, float[] coordinates)

obtainMovement

public static @NonNull MotionEvent obtainMovement(
    @NonNull MotionEvent downEvent,
    long eventTime,
    @NonNull float[] coordinates
)

Create a new move motion event associated with the specified down motion event.

Parameters
@NonNull MotionEvent downEvent

the finger down motion event assoicated with this event.

long eventTime

The the time (in ms) when this specific event was generated.

@NonNull float[] coordinates

The coordinates of the event

obtainMovement

public static MotionEvent obtainMovement(long downTime, long eventTime, float[] coordinates)

obtainUpEvent

public static MotionEvent obtainUpEvent(MotionEvent downEvent, float[] coordinates)

Create a new finger up motion event associated with the specified down motion event, at the current time.

Parameters
MotionEvent downEvent

the finger down motion event assoicated with this event.

float[] coordinates

The coordinates of the event

obtainUpEvent

public static MotionEvent obtainUpEvent(
    MotionEvent downEvent,
    long eventTime,
    float[] coordinates
)

Create a new finger up motion event associated with the specified down motion event.

Parameters
MotionEvent downEvent

the finger down motion event assoicated with this event.

long eventTime

The the time (in ms) when this specific event was generated.

float[] coordinates

The coordinates of the event

sendCancel

public static void sendCancel(UiController uiController, MotionEvent downEvent)

sendDown

public static MotionEvents.DownResultHolder sendDown(
    UiController uiController,
    float[] coordinates,
    float[] precision
)

sendDown

public static MotionEvents.DownResultHolder sendDown(
    UiController uiController,
    float[] coordinates,
    float[] precision,
    int inputDevice,
    int buttonState
)

sendMovement

public static boolean sendMovement(
    UiController uiController,
    MotionEvent downEvent,
    float[] coordinates
)

sendUp

public static boolean sendUp(UiController uiController, MotionEvent downEvent)

sendUp

public static boolean sendUp(
    UiController uiController,
    MotionEvent downEvent,
    float[] coordinates
)