Join us for ⁠#Android11: The Beta Launch Show on June 3!

PointerInputFilter

abstract class PointerInputFilter
kotlin.Any
   ↳ androidx.ui.core.pointerinput.PointerInputFilter

A PointerInputFilter represents a single entity that receives PointerInputChanges), interprets them, and consumes the aspects of the changes that it is react to such that other PointerInputFilters don't also react to them.

Summary

Public constructors

A PointerInputFilter represents a single entity that receives PointerInputChanges), interprets them, and consumes the aspects of the changes that it is react to such that other PointerInputFilters don't also react to them.

Public methods

abstract Unit

Invoked to notify the handler that no more calls to PointerInputFilter will be made, until at least new pointers exist.

open Unit

Invoked when a CustomEvent is dispatched by a PointerInputNode.

open Unit
onInit(customEventDispatcher: CustomEventDispatcher)

Invoked right after this PointerInputFilter is hit by a pointer during hit testing.

abstract List<PointerInputChange>

Invoked when pointers that previously hit this PointerInputFilter have changed.

Public constructors

<init>

PointerInputFilter()

A PointerInputFilter represents a single entity that receives PointerInputChanges), interprets them, and consumes the aspects of the changes that it is react to such that other PointerInputFilters don't also react to them.

Public methods

onCancel

abstract fun onCancel(): Unit

Invoked to notify the handler that no more calls to PointerInputFilter will be made, until at least new pointers exist. This can occur for a few reasons:

  1. Android dispatches ACTION_CANCEL to Compose.
  2. This PointerInputFilter is no longer associated with a LayoutNode.
  3. This PointerInputFilter's associated LayoutNode is no longer in the composition tree.

onCustomEvent

open fun onCustomEvent(
    customEvent: CustomEvent,
    pass: PointerEventPass
): Unit

Invoked when a CustomEvent is dispatched by a PointerInputNode.

Dispatch occurs over all passes of PointerEventPass.

Parameters
customEvent: CustomEvent The CustomEvent is the event being dispatched.
pass: PointerEventPass The PointerEventPass in which this function is being called.

onInit

open fun onInit(customEventDispatcher: CustomEventDispatcher): Unit

Invoked right after this PointerInputFilter is hit by a pointer during hit testing.

Parameters
customEventDispatcher: CustomEventDispatcher The CustomEventDispatcher that can be used to dispatch CustomEvent across the tree of hit PointerInputFilters.

onPointerInput

abstract fun onPointerInput(
    changes: List<PointerInputChange>,
    pass: PointerEventPass,
    bounds: IntPxSize
): List<PointerInputChange>

Invoked when pointers that previously hit this PointerInputFilter have changed.

Parameters
changes: List<PointerInputChange> The list of PointerInputChanges with positions relative to this PointerInputFilter.
pass: PointerEventPass The PointerEventPass in which this function is being called.
bounds: IntPxSize The width and height associated with this PointerInputFilter.
Return
The list of PointerInputChanges after any aspect of the changes have been consumed.