androidx.navigationevent


Provides APIs to easily intercept platform gesture events, including swipes and clicks, to help in app navigation.

Interfaces

NavigationEventDispatcherOwner

A class that has an NavigationEventDispatcher that allows you to register a NavigationEventHandler for handling navigation events.

Cmn
OnBackCompletedFallback

A listener that provides a final fallback action for unhandled backCompleted callbacks.

Cmn

Classes

DirectNavigationEventInput

An input that can send events to a NavigationEventDispatcher.

Cmn
NavigationEvent

Represents a system navigation event, such as a predictive back gesture or a back button press.

Cmn
NavigationEventDispatcher

A dispatcher for navigation events that can be organized hierarchically.

Cmn
NavigationEventHandler

Base class for handling navigation gestures dispatched by a NavigationEventDispatcher.

Cmn
NavigationEventHistory

Represents an immutable snapshot of the navigation history stack.

Cmn
NavigationEventInfo

Provides contextual information about a navigation state (e.g., a screen or route).

Cmn
NavigationEventInput

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

Cmn
NavigationEventTransitionState

Represents the physical state of a navigation gesture, such as a predictive back or forward swipe.

Cmn
NavigationEventTransitionState.InProgress

Represents the state where a navigation gesture is actively in progress.

Cmn
OnBackInvokedDefaultInput

Provides input to a NavigationEventDispatcher by registering an OnBackInvokedCallback with the OnBackInvokedDispatcher.PRIORITY_DEFAULT priority to onBackInvokedDispatcher.

android
OnBackInvokedInput

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

android
OnBackInvokedOverlayInput

Provides input to a NavigationEventDispatcher by registering an OnBackInvokedCallback with the OnBackInvokedDispatcher.PRIORITY_OVERLAY priority to onBackInvokedDispatcher.

android

Objects

NavigationEventInfo.None

A default used when no specific information is associated with a navigation event.

Cmn
NavigationEventTransitionState.Idle

Represents the state where no navigation gesture is currently in progress.

Cmn

Extension functions summary

NavigationEventDispatcherOwner?

Retrieve the NavigationEventDispatcherOwner associated with the given View.

android
Unit

Set the NavigationEventDispatcherOwner associated with the given View.

android

Extension functions

findViewTreeNavigationEventDispatcherOwner

fun View.findViewTreeNavigationEventDispatcherOwner(): NavigationEventDispatcherOwner?

Retrieve the NavigationEventDispatcherOwner associated with the given View. This may be used to add a callback for navigation events.

Returns
NavigationEventDispatcherOwner?

The NavigationEventDispatcherOwner associated with this view and/or some subset of its ancestors

setViewTreeNavigationEventDispatcherOwner

fun View.setViewTreeNavigationEventDispatcherOwner(
    navigationEventDispatcherOwner: NavigationEventDispatcherOwner?
): Unit

Set the NavigationEventDispatcherOwner associated with the given View. Calls to findViewTreeNavigationEventDispatcherOwner from this view or descendants will return NavigationEventDispatcherOwner.

This should only be called by constructs such as activities or dialogs that manage a view tree and handle the dispatch of navigation events. Callers should only set a NavigationEventDispatcherOwner that will be stable.

Parameters
navigationEventDispatcherOwner: NavigationEventDispatcherOwner?

NavigationEventDispatcherOwner associated with the View