NavigatorProvider
-
Cmn
open class NavigatorProvider
A NavigationProvider stores a set of Navigators that are valid ways to navigate to a destination.
Summary
Public constructors |
|
|---|---|
|
Cmn
android
|
Public functions |
||
|---|---|---|
Navigator<NavDestination>? |
addNavigator(navigator: Navigator<NavDestination>)Register a navigator using the name provided by the |
Cmn
android
|
open Navigator<NavDestination>? |
@CallSuperRegister a navigator by name. |
Cmn
android
|
open T |
<T : Navigator<*>> getNavigator(name: String)Retrieves a registered |
Cmn
android
|
T |
@CallSuperRetrieves a registered |
android
|
Extension functions |
||
|---|---|---|
inline NavGraph |
NavigatorProvider.This function is deprecated. Use routes to create your DynamicNavGraph instead |
android
|
inline NavGraph |
NavigatorProvider.navigation(Construct a new |
android
|
inline NavGraph |
NavigatorProvider.navigation(Construct a new |
android
|
inline NavGraph |
NavigatorProvider.navigation(Construct a new |
android
|
inline NavGraph |
NavigatorProvider.This function is deprecated. Use routes to build your NavGraph instead |
android
|
inline NavGraph |
NavigatorProvider.navigation(Construct a new |
Cmn
|
inline NavGraph |
NavigatorProvider.navigation(Construct a new |
Cmn
|
inline NavGraph |
NavigatorProvider.navigation(Construct a new |
Cmn
|
inline operator T |
<T : Navigator<NavDestination>> NavigatorProvider.get(clazz: KClass<T>)Retrieves a registered |
Cmn
android
|
inline operator T |
<T : Navigator<NavDestination>> NavigatorProvider.get(name: String)Retrieves a registered |
Cmn
|
inline operator Unit |
NavigatorProvider.plusAssign(navigator: Navigator<NavDestination>)Register a navigator using the name provided by the |
Cmn
|
inline operator Navigator<NavDestination>? |
NavigatorProvider.set(Register a |
Cmn
|
Public constructors
Public functions
addNavigator
fun addNavigator(navigator: Navigator<NavDestination>): Navigator<NavDestination>?
Register a navigator using the name provided by the Navigator.Name annotation. destinations may refer to any registered navigator by name for inflation. If a navigator by this name is already registered, this new navigator will replace it.
| Parameters | |
|---|---|
navigator: Navigator<NavDestination> |
navigator to add |
| Returns | |
|---|---|
Navigator<NavDestination>? |
the previously added Navigator for the name provided by the |
addNavigator
@CallSuper
open fun addNavigator(name: String, navigator: Navigator<NavDestination>): Navigator<NavDestination>?
Register a navigator by name. destinations may refer to any registered navigator by name for inflation. If a navigator by this name is already registered, this new navigator will replace it.
| Parameters | |
|---|---|
name: String |
name for this navigator |
navigator: Navigator<NavDestination> |
navigator to add |
| Returns | |
|---|---|
Navigator<NavDestination>? |
the previously added Navigator for the given name, if any |
getNavigator
open fun <T : Navigator<*>> getNavigator(name: String): T
Retrieves a registered Navigator by name.
| Parameters | |
|---|---|
name: String |
name of the navigator to return |
| Returns | |
|---|---|
T |
the registered navigator with the given name |
| Throws | |
|---|---|
kotlin.IllegalStateException |
if the Navigator has not been added |
| See also | |
|---|---|
addNavigator |
getNavigator
@CallSuper
fun <T : Navigator<*>> getNavigator(navigatorClass: Class<T>): T
Retrieves a registered Navigator using the name provided by the Navigator.Name annotation.
| Parameters | |
|---|---|
navigatorClass: Class<T> |
class of the navigator to return |
| Returns | |
|---|---|
T |
the registered navigator with the given |
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
if the Navigator does not have a |
kotlin.IllegalStateException |
if the Navigator has not been added |
| See also | |
|---|---|
addNavigator |
Extension functions
navigation
inline fun NavigatorProvider.navigation(
id: @IdRes Int = 0,
startDestination: @IdRes Int,
builder: DynamicNavGraphBuilder.() -> Unit
): NavGraph
Construct a new DynamicGraphNavigator.DynamicNavGraph
navigation
inline fun NavigatorProvider.navigation(
startDestination: String,
route: String? = null,
builder: DynamicNavGraphBuilder.() -> Unit
): NavGraph
Construct a new DynamicGraphNavigator.DynamicNavGraph
| Parameters | |
|---|---|
startDestination: String |
route start destination in the graph |
route: String? = null |
NavGraph route. |
builder: DynamicNavGraphBuilder.() -> Unit |
Another builder for chaining. |
navigation
inline fun NavigatorProvider.navigation(
startDestination: Any,
route: KClass<*>? = null,
typeMap: Map<KType, NavType<*>> = emptyMap(),
builder: DynamicNavGraphBuilder.() -> Unit
): NavGraph
Construct a new DynamicGraphNavigator.DynamicNavGraph
| Parameters | |
|---|---|
startDestination: Any |
the starting destination's route from an Object for this NavGraph. The respective NavDestination must be added with route from a |
route: KClass<*>? = null |
the graph's unique route as a |
typeMap: Map<KType, NavType<*>> = emptyMap() |
A mapping of KType to custom NavType<*> in the |
builder: DynamicNavGraphBuilder.() -> Unit |
Another builder for chaining. |
navigation
inline fun NavigatorProvider.navigation(
startDestination: KClass<*>,
route: KClass<*>? = null,
typeMap: Map<KType, NavType<*>> = emptyMap(),
builder: DynamicNavGraphBuilder.() -> Unit
): NavGraph
Construct a new DynamicGraphNavigator.DynamicNavGraph
| Parameters | |
|---|---|
startDestination: KClass<*> |
the starting destination's route from a |
route: KClass<*>? = null |
the graph's unique route as a |
typeMap: Map<KType, NavType<*>> = emptyMap() |
A mapping of KType to custom NavType<*> in the |
builder: DynamicNavGraphBuilder.() -> Unit |
Another builder for chaining. |
navigation
inline fun NavigatorProvider.navigation(
id: @IdRes Int = 0,
startDestination: @IdRes Int,
builder: NavGraphBuilder.() -> Unit
): NavGraph
Construct a new NavGraph
| Parameters | |
|---|---|
id: @IdRes Int = 0 |
the destination's unique id |
startDestination: @IdRes Int |
the starting destination for this NavGraph |
builder: NavGraphBuilder.() -> Unit |
the builder used to construct the graph |
| Returns | |
|---|---|
NavGraph |
the newly constructed NavGraph |
navigation
inline fun NavigatorProvider.navigation(
startDestination: String,
route: String? = null,
builder: NavGraphBuilder.() -> Unit
): NavGraph
Construct a new NavGraph
| Parameters | |
|---|---|
startDestination: String |
the starting destination's route for this NavGraph |
route: String? = null |
the destination's unique route |
builder: NavGraphBuilder.() -> Unit |
the builder used to construct the graph |
| Returns | |
|---|---|
NavGraph |
the newly constructed NavGraph |
navigation
inline fun NavigatorProvider.navigation(
startDestination: Any,
route: KClass<*>? = null,
typeMap: Map<KType, NavType<*>> = emptyMap(),
builder: NavGraphBuilder.() -> Unit
): NavGraph
Construct a new NavGraph
| Parameters | |
|---|---|
startDestination: Any |
the starting destination's route from an Object for this NavGraph. The respective NavDestination must be added with route from a |
route: KClass<*>? = null |
the graph's unique route as a |
typeMap: Map<KType, NavType<*>> = emptyMap() |
A mapping of KType to custom NavType<*> in the |
builder: NavGraphBuilder.() -> Unit |
the builder used to construct the graph |
| Returns | |
|---|---|
NavGraph |
the newly constructed NavGraph |
navigation
inline fun NavigatorProvider.navigation(
startDestination: KClass<*>,
route: KClass<*>? = null,
typeMap: Map<KType, NavType<*>> = emptyMap(),
builder: NavGraphBuilder.() -> Unit
): NavGraph
Construct a new NavGraph
| Parameters | |
|---|---|
startDestination: KClass<*> |
the starting destination's route from a |
route: KClass<*>? = null |
the graph's unique route as a |
typeMap: Map<KType, NavType<*>> = emptyMap() |
A mapping of KType to custom NavType<*> in the |
builder: NavGraphBuilder.() -> Unit |
the builder used to construct the graph |
| Returns | |
|---|---|
NavGraph |
the newly constructed NavGraph |
get
inline operator fun <T : Navigator<NavDestination>> NavigatorProvider.get(clazz: KClass<T>): T
Retrieves a registered Navigator using the name provided by the Navigator.Name annotation.
| Throws | |
|---|---|
kotlin.IllegalStateException |
if the Navigator has not been added |
get
inline operator fun <T : Navigator<NavDestination>> NavigatorProvider.get(name: String): T
Retrieves a registered Navigator by name.
| Throws | |
|---|---|
kotlin.IllegalStateException |
if the Navigator has not been added |
plusAssign
inline operator fun NavigatorProvider.plusAssign(navigator: Navigator<NavDestination>): Unit
Register a navigator using the name provided by the Navigator.Name annotation.
set
inline operator fun NavigatorProvider.set(
name: String,
navigator: Navigator<NavDestination>
): Navigator<NavDestination>?
Register a Navigator by name. If a navigator by this name is already registered, this new navigator will replace it.
| Returns | |
|---|---|
Navigator<NavDestination>? |
the previously added |