NavOptionsBuilder



DSL for constructing a new NavOptions

Summary

Public constructors

android

Public functions

Unit
anim(animBuilder: AnimBuilder.() -> Unit)

Sets any custom Animation or Animator resources that should be used.

android
inline Unit
<T : Any> popUpTo(noinline popUpToBuilder: PopUpToBuilder.() -> Unit)

Pop up to a given destination before navigating.

android
Unit
popUpTo(id: @IdRes Int, popUpToBuilder: PopUpToBuilder.() -> Unit)

Pop up to a given destination before navigating.

android
Unit
<T : Any> popUpTo(route: KClass<T>, popUpToBuilder: PopUpToBuilder.() -> Unit)

Pop up to a given destination before navigating.

android
Unit
<T : Any> popUpTo(route: T, popUpToBuilder: PopUpToBuilder.() -> Unit)

Pop up to a given destination before navigating.

android
Unit
popUpTo(route: String, popUpToBuilder: PopUpToBuilder.() -> Unit)

Pop up to a given destination before navigating.

android

Public properties

Boolean

Whether this navigation action should launch as single-top (i.e., there will be at most one copy of a given destination on the top of the back stack).

android
Int

This property is deprecated. Use the popUpToId property.

android
@IdRes Int

Returns the current destination that the builder will pop up to.

android
String?

The destination to pop up to before navigating.

android
KClass<*>?

The destination to pop up to before navigating.

android
Any?

The destination to pop up to before navigating.

android
Boolean

Whether this navigation action should restore any state previously saved by PopUpToBuilder.saveState or the popUpToSaveState attribute.

android

Public constructors

NavOptionsBuilder()

Public functions

anim

fun anim(animBuilder: AnimBuilder.() -> Unit): Unit

Sets any custom Animation or Animator resources that should be used.

Note: Animator resources are not supported for navigating to a new Activity

popUpTo

inline fun <T : Any> popUpTo(noinline popUpToBuilder: PopUpToBuilder.() -> Unit = {}): Unit

Pop up to a given destination before navigating. This pops all non-matching destination routes from the back stack until the destination with a matching route is found.

Parameters
<T : Any>

route from a KClass for the destination

noinline popUpToBuilder: PopUpToBuilder.() -> Unit = {}

builder used to construct a popUpTo operation

popUpTo

fun popUpTo(id: @IdRes Int, popUpToBuilder: PopUpToBuilder.() -> Unit = {}): Unit

Pop up to a given destination before navigating. This pops all non-matching destinations from the back stack until this destination is found.

popUpTo

fun <T : Any> popUpTo(route: KClass<T>, popUpToBuilder: PopUpToBuilder.() -> Unit): Unit

Pop up to a given destination before navigating. This pops all non-matching destination routes from the back stack until the destination with a matching route is found.

Parameters
route: KClass<T>

the KClass of the destination T

popUpToBuilder: PopUpToBuilder.() -> Unit

builder used to construct a popUpTo operation

popUpTo

fun <T : Any> popUpTo(route: T, popUpToBuilder: PopUpToBuilder.() -> Unit = {}): Unit

Pop up to a given destination before navigating. This pops all non-matching destination routes from the back stack until the destination with a matching route is found.

Parameters
route: T

route from a Object for the destination

popUpToBuilder: PopUpToBuilder.() -> Unit = {}

builder used to construct a popUpTo operation

popUpTo

fun popUpTo(route: String, popUpToBuilder: PopUpToBuilder.() -> Unit = {}): Unit

Pop up to a given destination before navigating. This pops all non-matching destination routes from the back stack until the destination with a matching route is found.

Parameters
route: String

route for the destination

popUpToBuilder: PopUpToBuilder.() -> Unit = {}

builder used to construct a popUpTo operation

Public properties

launchSingleTop

var launchSingleTopBoolean

Whether this navigation action should launch as single-top (i.e., there will be at most one copy of a given destination on the top of the back stack).

This functions similarly to how android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP works with activities.

popUpTo

var popUpToInt

The destination to pop up to before navigating. All non-matching destinations from the back stack up until this destination will also be popped.

popUpToId

val popUpToId: @IdRes Int

Returns the current destination that the builder will pop up to.

popUpToRoute

val popUpToRouteString?

The destination to pop up to before navigating. All non-matching destinations from the back stack up until this destination will also be popped.

popUpToRouteClass

val popUpToRouteClassKClass<*>?

The destination to pop up to before navigating. All non-matching destinations from the back stack up until this destination will also be popped.

popUpToRouteObject

val popUpToRouteObjectAny?

The destination to pop up to before navigating. All non-matching destinations from the back stack up until this destination will also be popped.

restoreState

var restoreStateBoolean

Whether this navigation action should restore any state previously saved by PopUpToBuilder.saveState or the popUpToSaveState attribute. If no state was previously saved with the destination ID being navigated to, this has no effect.