androidx.compose.ui.input.indirect

Interfaces

IndirectTouchEvent

Represents a touch event that did not result from contact with a touchscreen.

Cmn
IndirectTouchInputModifierNode

A androidx.compose.ui.Modifier.Node that receives IndirectTouchEvents.

Cmn

Classes

IndirectPointerInputChange

Represents a single pointer input change for an indirect touch event.

Cmn
IndirectTouchEventPrimaryDirectionalMotionAxis

The primary axis for motion from an IndirectTouchEvent.

Cmn
IndirectTouchEventType

Indicates the reason that the IndirectTouchEvent was sent.

Cmn

Top-level functions summary

IndirectTouchEvent
@ExperimentalIndirectTouchTypeApi
IndirectTouchEvent(
    motionEvent: MotionEvent,
    primaryDirectionalMotionAxis: IndirectTouchEventPrimaryDirectionalMotionAxis,
    previousMotionEvent: MotionEvent?
)

Allows creation of a IndirectTouchEvent from a MotionEvent for cross module testing.

android

Extension properties summary

MotionEvent

Returns the underlying MotionEvent for additional information and cross module testing.

android

Top-level functions

IndirectTouchEvent

@ExperimentalIndirectTouchTypeApi
fun IndirectTouchEvent(
    motionEvent: MotionEvent,
    primaryDirectionalMotionAxis: IndirectTouchEventPrimaryDirectionalMotionAxis = IndirectTouchEventPrimaryDirectionalMotionAxis.None,
    previousMotionEvent: MotionEvent? = null
): IndirectTouchEvent

Allows creation of a IndirectTouchEvent 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. If you have a system created MotionEvent, you can call indirectPrimaryDirectionalScrollAxis() on your MotionEvent to get the primary axis. 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 MotionEvent to convert to an IndirectTouchEvent.

primaryDirectionalMotionAxis: IndirectTouchEventPrimaryDirectionalMotionAxis = IndirectTouchEventPrimaryDirectionalMotionAxis.None

Primary directional motion axis for testing.

previousMotionEvent: MotionEvent? = null

The MotionEvent for previous values (time, position, and pressed).

Extension properties

nativeEvent

val IndirectTouchEvent.nativeEventMotionEvent

Returns the underlying MotionEvent for additional information and cross module testing.