MotionEventBuilder
public
class
MotionEventBuilder
extends Object
java.lang.Object | |
↳ | androidx.test.core.view.MotionEventBuilder |
A helper builder for creating MotionEvent
's.
Default values for unspecified attributes are 0 unless otherwise noted.
Summary
Public methods | |
---|---|
MotionEvent
|
build()
Returns a MotionEvent with the provided data or reasonable defaults. |
static
MotionEventBuilder
|
newBuilder()
Start building a new MotionEvent. |
MotionEventBuilder
|
setAction(int action)
Sets the action. |
MotionEventBuilder
|
setActionIndex(int pointerIndex)
Sets the pointer index associated with the action. |
MotionEventBuilder
|
setButtonState(int buttonState)
Sets the button state. |
MotionEventBuilder
|
setDeviceId(int deviceId)
Sets the device id. |
MotionEventBuilder
|
setDownTime(long downTime)
Sets the down time. |
MotionEventBuilder
|
setEdgeFlags(int edgeFlags)
Sets the edge flags. |
MotionEventBuilder
|
setEventTime(long eventTime)
Sets the event time. |
MotionEventBuilder
|
setFlags(int flags)
Sets the flags. |
MotionEventBuilder
|
setMetaState(int metastate)
Sets the metaState. |
MotionEventBuilder
|
setPointer(MotionEvent.PointerProperties pointerProperties, MotionEvent.PointerCoords pointerCoords)
An expanded variant of |
MotionEventBuilder
|
setPointer(float x, float y)
Simple mechanism to add a pointer to the MotionEvent. |
MotionEventBuilder
|
setSource(int source)
Sets the source. |
MotionEventBuilder
|
setXPrecision(float xPrecision)
Sets the x precision. |
MotionEventBuilder
|
setYPrecision(float yPrecision)
Sets the y precision. |
Inherited methods | |
---|---|
![]()
java.lang.Object
|
Public methods
build
MotionEvent build ()
Returns a MotionEvent with the provided data or reasonable defaults.
Returns | |
---|---|
MotionEvent |
newBuilder
MotionEventBuilder newBuilder ()
Start building a new MotionEvent.
Returns | |
---|---|
MotionEventBuilder |
a new MotionEventBuilder. |
setAction
MotionEventBuilder setAction (int action)
Sets the action. Default is ERROR(/MotionEvent.ACTION_DOWN)
.
Parameters | |
---|---|
action |
int |
Returns | |
---|---|
MotionEventBuilder |
See also:
setActionIndex
MotionEventBuilder setActionIndex (int pointerIndex)
Sets the pointer index associated with the action.
Parameters | |
---|---|
pointerIndex |
int |
Returns | |
---|---|
MotionEventBuilder |
See also:
setButtonState
MotionEventBuilder setButtonState (int buttonState)
Sets the button state.
Parameters | |
---|---|
buttonState |
int |
Returns | |
---|---|
MotionEventBuilder |
See also:
setDeviceId
MotionEventBuilder setDeviceId (int deviceId)
Sets the device id.
Parameters | |
---|---|
deviceId |
int |
Returns | |
---|---|
MotionEventBuilder |
See also:
setDownTime
MotionEventBuilder setDownTime (long downTime)
Sets the down time.
Parameters | |
---|---|
downTime |
long |
Returns | |
---|---|
MotionEventBuilder |
See also:
setEdgeFlags
MotionEventBuilder setEdgeFlags (int edgeFlags)
Sets the edge flags.
Parameters | |
---|---|
edgeFlags |
int |
Returns | |
---|---|
MotionEventBuilder |
See also:
setEventTime
MotionEventBuilder setEventTime (long eventTime)
Sets the event time. Default is SystemClock.uptimeMillis().
Parameters | |
---|---|
eventTime |
long |
Returns | |
---|---|
MotionEventBuilder |
See also:
setFlags
MotionEventBuilder setFlags (int flags)
Sets the flags.
Parameters | |
---|---|
flags |
int |
Returns | |
---|---|
MotionEventBuilder |
See also:
setMetaState
MotionEventBuilder setMetaState (int metastate)
Sets the metaState.
Parameters | |
---|---|
metastate |
int |
Returns | |
---|---|
MotionEventBuilder |
See also:
setPointer
MotionEventBuilder setPointer (MotionEvent.PointerProperties pointerProperties, MotionEvent.PointerCoords pointerCoords)
An expanded variant of setPointer(float, float)
that supports specifying all pointer
properties and coords data.
Parameters | |
---|---|
pointerProperties |
MotionEvent.PointerProperties |
pointerCoords |
MotionEvent.PointerCoords |
Returns | |
---|---|
MotionEventBuilder |
setPointer
MotionEventBuilder setPointer (float x, float y)
Simple mechanism to add a pointer to the MotionEvent.
Can be called multiple times to add multiple pointers to the event.
Parameters | |
---|---|
x |
float |
y |
float |
Returns | |
---|---|
MotionEventBuilder |
setSource
MotionEventBuilder setSource (int source)
Sets the source.
Parameters | |
---|---|
source |
int |
Returns | |
---|---|
MotionEventBuilder |
See also:
setXPrecision
MotionEventBuilder setXPrecision (float xPrecision)
Sets the x precision.
Parameters | |
---|---|
xPrecision |
float |
Returns | |
---|---|
MotionEventBuilder |
See also:
setYPrecision
MotionEventBuilder setYPrecision (float yPrecision)
Sets the y precision.
Parameters | |
---|---|
yPrecision |
float |
Returns | |
---|---|
MotionEventBuilder |
See also: