Package-level declarations

Types

Link copied to clipboard
sealed interface BaseRoute
Link copied to clipboard
abstract class DestinationNavigator(val hostNavigator: HostNavigator) : Navigator, ActivityNavigator

A combination of Navigator and com.freeletics.khonshu.navigation.activity.ActivityNavigator that can be used as base class for navigators of individual screens.

Link copied to clipboard
abstract class HostNavigator : Navigator
Link copied to clipboard

A destination that can be navigated to. See NavHost for how to configure a NavGraph with it.

Link copied to clipboard
@Serializable
data class NavigationResult<R>(val value: R?)
Link copied to clipboard
class NavigationResultRequest<R>(val key: NavigationResultRequest.Key<R>, val state: StackEntryState, resultSerializer: KSerializer<R>)

Class returned from registerForNavigationResult.

Link copied to clipboard
interface Navigator
Link copied to clipboard
interface NavRoot : BaseRoute

This is similar to a NavRoute but represents the route to the start destination used in a backstack. When you navigate to a NavRoot the current backstack is saved and removed so that the NavRoot is right on top of the start destination.

Link copied to clipboard
interface NavRoute : BaseRoute

Represents the route to a destination.

Functions

Link copied to clipboard
fun createHostNavigator(viewModel: StackEntryStoreViewModel, startRoot: NavRoot, destinations: ImmutableSet<NavDestination<*>>): HostNavigator
Link copied to clipboard

Delivers the result to the destination that created key.

Link copied to clipboard
@Composable
fun NavHost(navigator: HostNavigator, modifier: Modifier = Modifier, destinationChangedCallback: (NavRoot, BaseRoute) -> Unit? = null)

Create a new NavHost with the given HostNavigator. The start NavRoot, available destinations and deep link handling are all dependent on the navigator. For more see rememberHostNavigator.

@Composable
fun NavHost(startRoute: NavRoot, destinations: ImmutableSet<NavDestination<*>>, modifier: Modifier = Modifier, deepLinkHandlers: ImmutableSet<DeepLinkHandler> = persistentSetOf(), deepLinkPrefixes: ImmutableSet<DeepLinkHandler.Prefix> = persistentSetOf(), destinationChangedCallback: (NavRoot, BaseRoute) -> Unit? = null)

Create a new NavHost containing all given destinations. startRoute will be used as the start destination of the graph. Use HostNavigator and DestinationNavigator to change what is shown in NavHost.

Link copied to clipboard
inline fun <Route : NavRoute> OverlayDestination(noinline content: @Composable (Route) -> Unit): NavDestination<Route>

Creates a new NavDestination that is shown on top a ScreenDestination, for example a dialog or bottom sheet. The class of Route will be used as a unique identifier. The given content will be shown inside the dialog window when navigating to it by using an instance of Route.

inline fun <Route : NavRoute> OverlayDestination(extra: Any, noinline content: @Composable (StackSnapshot, StackEntry<Route>) -> Unit): NavDestination<Route>
@JvmName(name = "OverlayWithParentDestination")
inline fun <Route : NavRoute, ParentRoute : BaseRoute> OverlayDestination(extra: Any, noinline content: @Composable (StackSnapshot, StackEntry<Route>) -> Unit): NavDestination<Route>
Link copied to clipboard

Register for receiving navigation results.

Link copied to clipboard
@Composable
fun rememberHostNavigator(startRoot: NavRoot, destinations: ImmutableSet<NavDestination<*>>, deepLinkHandlers: ImmutableSet<DeepLinkHandler> = persistentSetOf(), deepLinkPrefixes: ImmutableSet<DeepLinkHandler.Prefix> = persistentSetOf()): HostNavigator

Returns an instance of HostNavigator with the given destinations and startRoot as initially shown destination.

Link copied to clipboard
inline fun <Route : BaseRoute> ScreenDestination(noinline content: @Composable (Route) -> Unit): NavDestination<Route>

Creates a new NavDestination that represents a full screen. The class of Route will be used as a unique identifier. The given content will be shown when the screen is being navigated to using an instance of Route.

inline fun <Route : BaseRoute> ScreenDestination(extra: Any, noinline content: @Composable (StackSnapshot, StackEntry<Route>) -> Unit): NavDestination<Route>
@JvmName(name = "ScreenWithParentDestination")
inline fun <Route : BaseRoute, ParentRoute : BaseRoute> ScreenDestination(extra: Any, noinline content: @Composable (StackSnapshot, StackEntry<Route>) -> Unit): NavDestination<Route>