NavOptionsBuilder

@NavOptionsDsl
class NavOptionsBuilder


DSL for constructing a new NavOptions

Summary

Public constructors

Public functions

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

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

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

Pop up to a given destination before navigating.

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

Pop up to a given destination before navigating.

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).

Int

This property is deprecated. Use the popUpToId property.

@IdRes Int

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

String?

Pop up to a given destination before navigating.

Boolean

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

Public constructors

Added in 1.0.0
NavOptionsBuilder()

Public functions

anim

Added in 1.0.0
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

Added in 1.0.0
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 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

Added in 1.0.0
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 activites.

popUpTo

Added in 1.0.0
var popUpToInt

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

popUpToId

val popUpToId: @IdRes Int

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

popUpToRoute

val popUpToRouteString?

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

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.