NavigationEventCallback


public abstract class 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

NavigationEventCallback(boolean isEnabled, boolean isPassThrough)

Public methods

final boolean

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

final boolean

Whether this callback should consume the events from NavigationEventDispatcher or allow it to continue.

void

Callback for handling NavigationEventDispatcher.dispatchOnCancelled.

void

Callback for handling NavigationEventDispatcher.dispatchOnCompleted.

void

Callback for handling NavigationEventDispatcher.dispatchOnProgressed.

void

Callback for handling NavigationEventDispatcher.dispatchOnStarted.

final void
final void
setEnabled(boolean isEnabled)

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

Public constructors

Added in 1.0.0-alpha05
public NavigationEventCallback(boolean isEnabled, boolean isPassThrough)
Parameters
boolean isEnabled

The enabled state for this callback.

boolean isPassThrough

Whether this callback should consume the events from NavigationEventDispatcher or allow it to continue.

Public methods

isEnabled

Added in 1.0.0-alpha05
public final boolean isEnabled()

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.

isPassThrough

Added in 1.0.0-alpha05
public final boolean isPassThrough()

Whether this callback should consume the events from NavigationEventDispatcher or allow it to continue.

onEventCancelled

Added in 1.0.0-alpha05
public void onEventCancelled()

Callback for handling NavigationEventDispatcher.dispatchOnCancelled.

onEventCompleted

Added in 1.0.0-alpha05
public void onEventCompleted()

Callback for handling NavigationEventDispatcher.dispatchOnCompleted.

onEventProgressed

Added in 1.0.0-alpha05
public void onEventProgressed(@NonNull NavigationEvent event)

Callback for handling NavigationEventDispatcher.dispatchOnProgressed.

onEventStarted

Added in 1.0.0-alpha05
public void onEventStarted(@NonNull NavigationEvent event)

Callback for handling NavigationEventDispatcher.dispatchOnStarted.

remove

Added in 1.0.0-alpha05
public final void remove()

setEnabled

Added in 1.0.0-alpha05
public final void setEnabled(boolean isEnabled)

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.