MotionEvents

public final class MotionEvents
extends Object

java.lang.Object
   ↳ androidx.test.espresso.action.MotionEvents


Facilitates sending of motion events to a UiController.

Summary

Nested classes

class MotionEvents.DownResultHolder

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 MotionEvent obtainMovement(long downTime, float[] coordinates)
static MotionEvent obtainMovement(long downTime, long eventTime, float[] coordinates)
static MotionEvent obtainUpEvent(MotionEvent downEvent, float[] coordinates)
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)

Inherited methods

Public methods

obtainDownEvent

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

Parameters
coordinates float

precision float

Returns
MotionEvent

obtainDownEvent

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

Obtains the MotionEvent of down.

Parameters
coordinates float

precision float

inputDevice int

buttonState int

Returns
MotionEvent

obtainMovement

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

Parameters
downTime long

coordinates float

Returns
MotionEvent

obtainMovement

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

Parameters
downTime long

eventTime long

coordinates float

Returns
MotionEvent

obtainUpEvent

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

Parameters
downEvent MotionEvent

coordinates float

Returns
MotionEvent

sendCancel

public static void sendCancel (UiController uiController, 
                MotionEvent downEvent)

Parameters
uiController UiController

downEvent MotionEvent

sendDown

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

Parameters
uiController UiController

coordinates float

precision float

Returns
MotionEvents.DownResultHolder

sendDown

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

Parameters
uiController UiController

coordinates float

precision float

inputDevice int

buttonState int

Returns
MotionEvents.DownResultHolder

sendMovement

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

Parameters
uiController UiController

downEvent MotionEvent

coordinates float

Returns
boolean

sendUp

public static boolean sendUp (UiController uiController, 
                MotionEvent downEvent)

Parameters
uiController UiController

downEvent MotionEvent

Returns
boolean

sendUp

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

Parameters
uiController UiController

downEvent MotionEvent

coordinates float

Returns
boolean