@RequiresApi(value = 33)
public sealed class OnBackInvokedInput extends NavigationEventInput


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

Summary

Protected constructors

OnBackInvokedInput(
    @NonNull OnBackInvokedDispatcher onBackInvokedDispatcher,
    int onBackInvokedCallbackPriority
)

Protected methods

void
onHasEnabledHandlersChanged(boolean hasEnabledHandlers)

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

void

Called after this NavigationEventInput is removed from a NavigationEventDispatcher.

Inherited methods

From androidx.navigationevent.NavigationEventInput
final void

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

final void

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

final void

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

final void

Notifies the dispatcher that a TRANSITIONING_BACK navigation gesture has started.

final void

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

final void

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

final void

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

final void

Notifies the dispatcher that a TRANSITIONING_FORWARD navigation gesture has started.

void

Called after this NavigationEventInput is added to dispatcher.

void

Called when the NavigationEventHistory state in the connected NavigationEventDispatcher changes.

Protected constructors

OnBackInvokedInput

protected OnBackInvokedInput(
    @NonNull OnBackInvokedDispatcher onBackInvokedDispatcher,
    int onBackInvokedCallbackPriority
)
Parameters
@NonNull OnBackInvokedDispatcher onBackInvokedDispatcher

the OnBackInvokedDispatcher to use.

int onBackInvokedCallbackPriority

the priority to use.

Protected methods

onHasEnabledHandlersChanged

protected void onHasEnabledHandlersChanged(boolean hasEnabledHandlers)

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
boolean hasEnabledHandlers

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

onRemoved

protected void onRemoved()

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