NavigationEventCallback


Known direct subclasses
TestNavigationEventCallback

A test implementation of NavigationEventCallback that records received events and invocation counts.


Callback for handling NavigationEvents.

This class maintains its own isEnabled state and will only receive callbacks when enabled.

Summary

Public constructors

Cmn

Public functions

open Unit

Callback for handling NavigationEventDispatcher.dispatchOnCancelled.

Cmn
open Unit

Callback for handling NavigationEventDispatcher.dispatchOnCompleted.

Cmn
open Unit

Callback for handling NavigationEventDispatcher.dispatchOnProgressed.

Cmn
open Unit

Callback for handling NavigationEventDispatcher.dispatchOnStarted.

Cmn
Unit

Removes this callback from the NavigationEventDispatcher it is registered with.

Cmn
Unit
setInfo(currentInfo: T, previousInfo: T?)

Updates the current and previous navigation information for this callback.

Cmn

Public properties

Boolean

Controls whether this callback is active and should be considered for event dispatching.

Cmn

Public constructors

<T : NavigationEventInfo> NavigationEventCallback(isEnabled: Boolean)
Parameters
isEnabled: Boolean

The initial enabled state for this callback.

Public functions

onEventCancelled

open fun onEventCancelled(): Unit

Callback for handling NavigationEventDispatcher.dispatchOnCancelled.

onEventCompleted

open fun onEventCompleted(): Unit

Callback for handling NavigationEventDispatcher.dispatchOnCompleted.

onEventProgressed

open fun onEventProgressed(event: NavigationEvent): Unit

Callback for handling NavigationEventDispatcher.dispatchOnProgressed.

onEventStarted

open fun onEventStarted(event: NavigationEvent): Unit

Callback for handling NavigationEventDispatcher.dispatchOnStarted.

remove

fun remove(): Unit

Removes this callback from the NavigationEventDispatcher it is registered with. If the callback is not registered, this call does nothing.

setInfo

fun setInfo(currentInfo: T, previousInfo: T?): Unit

Updates the current and previous navigation information for this callback.

This method updates the callback's local info and then notifies the central NavigationEventProcessor. The processor is responsible for deciding whether to update the global navigation state, ensuring that only the highest-priority callback can influence the state.

Parameters
currentInfo: T

The new navigation information to be set as the current state.

previousInfo: T?

The navigation information to be set as the previous state.

Public properties

isEnabled

var isEnabledBoolean

Controls whether this callback is active and should be considered for event dispatching.

A callback's effective enabled state is hierarchical; it is directly influenced by the NavigationEventDispatcher it is registered with.

Getting the value:

  • This will return false if the associated dispatcher exists and its isEnabled state is false, regardless of the callback's own local setting. This provides a powerful mechanism to disable a whole group of callbacks at once by simply disabling their dispatcher.

  • Otherwise, it returns the callback's own locally stored state.

Setting the value:

  • This updates the local enabled state of the callback itself.

  • More importantly, it immediately notifies the dispatcher (if one is attached) that its list of enabled callbacks might have changed, prompting a re-evaluation. This ensures the system's state remains consistent and responsive to changes.

For a callback to be truly active, both its local isEnabled property and its dispatcher's isEnabled property must evaluate to true.