androidx.compose.ui.input.indirect

Interfaces

IndirectTouchEvent

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

Cmn
IndirectTouchInputModifierNode

Implement this interface to create a Modifier.Node that can intercept indirect touch input events.

Cmn

Classes

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

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

android

Extension functions summary

Modifier

Adding this modifier to the modifier parameter of a component will allow it to handle IndirectTouchEvents, if it (or one of its children) is focused.

Cmn
Modifier

Adding this modifier to the modifier parameter of a component will allow it to intercept IndirectTouchEvents before a focused child receives it in onIndirectTouchEvent, if it (or one of its children) is focused.

Cmn

Extension properties summary

Top-level functions

IndirectTouchEvent

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

Allows creation of a IndirectTouchEvent from a MotionEvent for cross module testing. IMPORTANT NOTE: 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 indirectScrollAxis() on your MotionEvent to get the primary axis.

Extension functions

onIndirectTouchEvent

@ExperimentalIndirectTouchTypeApi
fun Modifier.onIndirectTouchEvent(
    onIndirectTouchEvent: (IndirectTouchEvent) -> Boolean
): Modifier

Adding this modifier to the modifier parameter of a component will allow it to handle IndirectTouchEvents, if it (or one of its children) is focused.

Parameters
onIndirectTouchEvent: (IndirectTouchEvent) -> Boolean

This callback is invoked when a user interacts with a touch input device that is not associated with a touchscreen. While implementing this callback, return true to stop propagation of this event. If you return false, the event will be sent to this IndirectTouchEvent's parent.

Returns
Modifier

true if the event is consumed, false otherwise.

onPreIndirectTouchEvent

@ExperimentalIndirectTouchTypeApi
fun Modifier.onPreIndirectTouchEvent(
    onPreIndirectTouchEvent: (IndirectTouchEvent) -> Boolean
): Modifier

Adding this modifier to the modifier parameter of a component will allow it to intercept IndirectTouchEvents before a focused child receives it in onIndirectTouchEvent, if it (or one of its children) is focused.

Parameters
onPreIndirectTouchEvent: (IndirectTouchEvent) -> Boolean

This callback is invoked when a user interacts with a touch input device that is not associated with a touchscreen.s It gives ancestors of a focused component the chance to intercept an IndirectTouchEvent. Return true to indicate that you consumed the event and want to stop propagation of this event.

Returns
Modifier

true if the event is consumed, false otherwise.

Extension properties