メインコンテンツまでスキップ

Continue navigation customization

You can customize the continue navigation view by providing your own UI written in Jetpack Compose.

Customizing Continue Navigation Content

The setContinueNavigation function in DashNavigationFragment allows you to define custom content for the "Continue Navigation" view. It accepts a ContinueNavigationUiComposer, which is a composable function with two parameters: modifier and state. The modifier is an instance of Modifier, used to configure the layout. The state is an instance of ContinueNavigationUiState, containing the information needed to render the view.

ContinueNavigationUiState

The ContinueNavigationUiState class provides the state necessary for the "Continue Navigation" view. It includes:

  • destination: The destination to continue navigating to, represented as a DashSearchResult.
  • onClickContinueNavigation: A callback triggered when the "Continue Navigation" button is clicked.

Example Usage

To set a custom "Continue Navigation" implementation:

fragment.setContinueNavigation { state, modifier ->
CustomContinueNavigationView(state, modifier)
}

The CustomContinueNavigationView composable customizes the navigation UI using the provided ContinueNavigationUiState.

To restore the default implementation at runtime:

fragment.setContinueNavigation { state, modifier ->
DefaultContinueNavigationView(state, modifier)
}

For more examples and use cases, visit our Dash Android Examples repository.

この{Type}は役に立ちましたか?