androidx.compose.ui.input.indirect
Interfaces
IndirectPointerEvent |
An IndirectPointerEvent represents a pointer input event, where the pointer positions do not correspond to a position on the screen. |
Cmn
|
IndirectPointerInputModifierNode |
A |
Cmn
|
Classes
IndirectPointerEventPrimaryDirectionalMotionAxis |
The primary axis for motion from an |
Cmn
|
IndirectPointerEventType |
Indicates the reason that the |
Cmn
|
IndirectPointerInputChange |
Represents a single pointer input change for an indirect pointer event. |
Cmn
|
Top-level functions summary
IndirectPointerEvent |
@ExperimentalIndirectPointerApiAllows creation of a |
android
|
IndirectPointerEvent |
@TestOnlyCreate a |
android
|
Extension properties summary
MotionEvent |
Returns the underlying |
android
|
Top-level functions
IndirectPointerEvent
@ExperimentalIndirectPointerApi
fun IndirectPointerEvent(
motionEvent: MotionEvent,
primaryDirectionalMotionAxis: IndirectPointerEventPrimaryDirectionalMotionAxis = IndirectPointerEventPrimaryDirectionalMotionAxis.None,
previousMotionEvent: MotionEvent? = null
): IndirectPointerEvent
Allows creation of a IndirectPointerEvent from a MotionEvent for cross module testing. IMPORTANT NOTE 1: Primary axis is determined by properties of the InputDevice contained within the MotionEvent. However, when manually creating a MotionEvent, there is no way to set the InputDevice. Therefore, this function allows you to manually set the primary axis for testing. IMPORTANT NOTE 2: Since this is just a test function that doesn't maintain state for previous MotionEvents (like the Android Compose system does), you will need to pass a separate MotionEvent to populate IndirectPointerInputChange's "previous" parameters (time, position, and pressed).
| Parameters | |
|---|---|
motionEvent: MotionEvent |
The |
primaryDirectionalMotionAxis: IndirectPointerEventPrimaryDirectionalMotionAxis = IndirectPointerEventPrimaryDirectionalMotionAxis.None |
Primary directional motion axis for testing. |
previousMotionEvent: MotionEvent? = null |
The |
IndirectPointerEvent
@TestOnly
fun IndirectPointerEvent(
changes: List<IndirectPointerInputChange>,
type: IndirectPointerEventType,
primaryDirectionalMotionAxis: IndirectPointerEventPrimaryDirectionalMotionAxis,
motionEvent: MotionEvent
): IndirectPointerEvent
Create a IndirectPointerEvent for test use cases. In most cases, you should receive an IndirectPointerEvent from the system through IndirectPointerInputModifierNode.
If you need to test indirect pointer events, use SemanticsNodeInteractionsProvider.performIndirectPointerInput().
| Parameters | |
|---|---|
changes: List<IndirectPointerInputChange> |
A list of |
type: IndirectPointerEventType |
Indicates the reason that the |
primaryDirectionalMotionAxis: IndirectPointerEventPrimaryDirectionalMotionAxis |
Primary directional motion axis for testing. |
motionEvent: MotionEvent |
The |
Extension properties
IndirectPointerEvent.nativeEvent
val IndirectPointerEvent.nativeEvent: MotionEvent
Returns the underlying MotionEvent for additional information and cross module testing.