NavigationEventInput


Known direct subclasses
DirectNavigationEventInput

An input that can send events to a NavigationEventDispatcher.

OnBackInvokedInput

Provides input to a NavigationEventDispatcher by registering an OnBackInvokedCallback to the passed in onBackInvokedDispatcher.


An abstract class for components that generate and dispatch navigation events.

This class acts as the "input" side of the navigation system, translating platform-specific events (like system back gestures or button clicks) into standardized events that can be sent to a NavigationEventDispatcher.

Subclasses are responsible for implementing the logic that sources these events and calling the dispatchOn... methods (e.g., dispatchOnBackStarted) to propagate them through the system.

An input must be registered with a NavigationEventDispatcher using NavigationEventDispatcher.addInput to function.

Summary

Public constructors

Cmn

Protected functions

Unit

Notifies the dispatcher that the ongoing TRANSITIONING_BACK navigation gesture has been cancelled.

Cmn
Unit

Notifies the dispatcher that the ongoing TRANSITIONING_BACK navigation gesture has completed.

Cmn
Unit

Notifies the dispatcher that an ongoing TRANSITIONING_BACK navigation gesture has progressed.

Cmn
Unit

Notifies the dispatcher that a TRANSITIONING_BACK navigation gesture has started.

Cmn
Unit

Notifies the dispatcher that the ongoing TRANSITIONING_FORWARD navigation gesture has been cancelled.

Cmn
Unit

Notifies the dispatcher that the ongoing TRANSITIONING_FORWARD navigation gesture has completed.

Cmn
Unit

Notifies the dispatcher that an ongoing TRANSITIONING_FORWARD navigation gesture has progressed.

Cmn
Unit

Notifies the dispatcher that a TRANSITIONING_FORWARD navigation gesture has started.

Cmn
open Unit

Called after this NavigationEventInput is added to dispatcher.

Cmn
open Unit

Called when the enabled state of handlers in the connected NavigationEventDispatcher changes.

Cmn
open Unit

Called when the NavigationEventHistory state in the connected NavigationEventDispatcher changes.

Cmn
open Unit

Called after this NavigationEventInput is removed from a NavigationEventDispatcher.

Cmn

Public constructors

NavigationEventInput()

Protected functions

dispatchOnBackCancelled

@MainThread
protected fun dispatchOnBackCancelled(): Unit

Notifies the dispatcher that the ongoing TRANSITIONING_BACK navigation gesture has been cancelled.

This is a terminal event. The NavigationEventDispatcher.transitionState will become Idle and ready for a new gesture.

Throws
kotlin.IllegalStateException

if this input is not added to a dispatcher.

kotlin.IllegalStateException

if this dispatcher is disposed.

dispatchOnBackCompleted

@MainThread
protected fun dispatchOnBackCompleted(): Unit

Notifies the dispatcher that the ongoing TRANSITIONING_BACK navigation gesture has completed.

This is a terminal event, signaling that the navigation should be finalized (e.g., popping the back stack). The NavigationEventDispatcher.transitionState will become Idle and ready for a new gesture.

Throws
kotlin.IllegalStateException

if this input is not added to a dispatcher.

kotlin.IllegalStateException

if this dispatcher is disposed.

dispatchOnBackProgressed

@MainThread
protected fun dispatchOnBackProgressed(event: NavigationEvent): Unit

Notifies the dispatcher that an ongoing TRANSITIONING_BACK navigation gesture has progressed.

The NavigationEventDispatcher.transitionState will become InProgress.

Parameters
event: NavigationEvent

The NavigationEvent describing the progress of the gesture.

Throws
kotlin.IllegalStateException

if this input is not added to a dispatcher.

kotlin.IllegalStateException

if this dispatcher is disposed.

dispatchOnBackStarted

@MainThread
protected fun dispatchOnBackStarted(event: NavigationEvent): Unit

Notifies the dispatcher that a TRANSITIONING_BACK navigation gesture has started.

The NavigationEventDispatcher.transitionState will become InProgress.

Parameters
event: NavigationEvent

The NavigationEvent describing the start of the gesture (e.g., touch position).

Throws
kotlin.IllegalStateException

if this input is not added to a dispatcher.

kotlin.IllegalStateException

if this dispatcher is disposed.

dispatchOnForwardCancelled

@MainThread
protected fun dispatchOnForwardCancelled(): Unit

Notifies the dispatcher that the ongoing TRANSITIONING_FORWARD navigation gesture has been cancelled.

This is a terminal event. The NavigationEventDispatcher.transitionState will become Idle and ready for a new gesture.

Throws
kotlin.IllegalStateException

if this input is not added to a dispatcher.

kotlin.IllegalStateException

if this dispatcher is disposed.

dispatchOnForwardCompleted

@MainThread
protected fun dispatchOnForwardCompleted(): Unit

Notifies the dispatcher that the ongoing TRANSITIONING_FORWARD navigation gesture has completed.

This is a terminal event, signaling that the navigation should be finalized (e.g., popping the back stack). The NavigationEventDispatcher.transitionState will become Idle and ready for a new gesture.

Throws
kotlin.IllegalStateException

if this input is not added to a dispatcher.

kotlin.IllegalStateException

if this dispatcher is disposed.

dispatchOnForwardProgressed

@MainThread
protected fun dispatchOnForwardProgressed(event: NavigationEvent): Unit

Notifies the dispatcher that an ongoing TRANSITIONING_FORWARD navigation gesture has progressed.

The NavigationEventDispatcher.transitionState will become InProgress.

Parameters
event: NavigationEvent

The NavigationEvent describing the progress of the gesture.

Throws
kotlin.IllegalStateException

if this input is not added to a dispatcher.

kotlin.IllegalStateException

if this dispatcher is disposed.

dispatchOnForwardStarted

@MainThread
protected fun dispatchOnForwardStarted(event: NavigationEvent): Unit

Notifies the dispatcher that a TRANSITIONING_FORWARD navigation gesture has started.

The NavigationEventDispatcher.transitionState will become InProgress.

Parameters
event: NavigationEvent

The NavigationEvent describing the start of the gesture (e.g., touch position).

Throws
kotlin.IllegalStateException

if this input is not added to a dispatcher.

kotlin.IllegalStateException

if this dispatcher is disposed.

onAdded

@MainThread
@EmptySuper
protected open fun onAdded(dispatcher: NavigationEventDispatcher): Unit

Called after this NavigationEventInput is added to dispatcher. This can happen when calling NavigationEventDispatcher.addInput. A NavigationEventInput can only be added to one NavigationEventDispatcher at a time.

Parameters
dispatcher: NavigationEventDispatcher

The NavigationEventDispatcher that this input is now added to.

onHasEnabledHandlersChanged

@MainThread
@EmptySuper
protected open fun onHasEnabledHandlersChanged(hasEnabledHandlers: Boolean): Unit

Called when the enabled state of handlers in the connected NavigationEventDispatcher changes.

This allows the input to enable or disable its own event sourcing. For example, a system back gesture input might only register for gestures when hasEnabledHandlers is true.

The exact set of handlers this reflects depends on the Priority this input was registered with.

Parameters
hasEnabledHandlers: Boolean

Whether the connected dispatcher has any enabled handlers matching this input's priority scope.

onHistoryChanged

@MainThread
@EmptySuper
protected open fun onHistoryChanged(history: NavigationEventHistory): Unit

Called when the NavigationEventHistory state in the connected NavigationEventDispatcher changes.

Parameters
history: NavigationEventHistory

The new, immutable snapshot of the navigation history.

onRemoved

@MainThread
@EmptySuper
protected open fun onRemoved(): Unit

Called after this NavigationEventInput is removed from a NavigationEventDispatcher. This can happen when calling NavigationEventDispatcher.removeInput or NavigationEventDispatcher.dispose on the containing NavigationEventDispatcher.