NavOptionsBuilder
@NavOptionsDsl
public final class NavOptionsBuilder
DSL for constructing a new NavOptions
Summary
Public constructors |
|---|
Public methods |
|
|---|---|
final void |
anim(@NonNull Function1<@NonNull AnimBuilder, Unit> animBuilder)Sets any custom Animation or Animator resources that should be used. |
final 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). |
final int |
This method is deprecated. Use the popUpToId property. |
final int |
Returns the current destination that the builder will pop up to. |
final String |
The destination to pop up to before navigating. |
final KClass<@NonNull ?> |
The destination to pop up to before navigating. |
final Object |
The destination to pop up to before navigating. |
final boolean |
Whether this navigation action should restore any state previously saved by |
final void |
Pop up to a given destination before navigating. |
final void |
Pop up to a given destination before navigating. |
final void |
<T extends Object> popUpTo(Pop up to a given destination before navigating. |
final void |
<T extends Object> popUpTo(Pop up to a given destination before navigating. |
final void |
Pop up to a given destination before navigating. |
final void |
setLaunchSingleTop(boolean launchSingleTop)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). |
final void |
This method is deprecated. Use the popUpTo function and passing in the id. |
final void |
setRestoreState(boolean restoreState)Whether this navigation action should restore any state previously saved by |
Public constructors
Public methods
anim
public final void anim(@NonNull Function1<@NonNull AnimBuilder, Unit> animBuilder)
Sets any custom Animation or Animator resources that should be used.
Note: Animator resources are not supported for navigating to a new Activity
getLaunchSingleTop
public final boolean getLaunchSingleTop()
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.
public final int getPopUpTo()The destination to pop up to before navigating. All non-matching destinations from the back stack up until this destination will also be popped.
getPopUpToId
public final int getPopUpToId()
Returns the current destination that the builder will pop up to.
getPopUpToRoute
public final String getPopUpToRoute()
The destination to pop up to before navigating. All non-matching destinations from the back stack up until this destination will also be popped.
getPopUpToRouteClass
public final KClass<@NonNull ?> getPopUpToRouteClass()
The destination to pop up to before navigating. All non-matching destinations from the back stack up until this destination will also be popped.
getPopUpToRouteObject
public final Object getPopUpToRouteObject()
The destination to pop up to before navigating. All non-matching destinations from the back stack up until this destination will also be popped.
getRestoreState
public final boolean getRestoreState()
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.
popUpTo
public final void <T extends Object> popUpTo(
@NonNull Function1<@NonNull PopUpToBuilder, Unit> popUpToBuilder
)
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.
popUpTo
public final void popUpTo(
@IdRes int id,
@NonNull Function1<@NonNull PopUpToBuilder, Unit> popUpToBuilder
)
Pop up to a given destination before navigating. This pops all non-matching destinations from the back stack until this destination is found.
popUpTo
public final void <T extends Object> popUpTo(
@NonNull KClass<@NonNull T> route,
@NonNull Function1<@NonNull PopUpToBuilder, Unit> popUpToBuilder
)
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.
popUpTo
public final void <T extends Object> popUpTo(
@NonNull T route,
@NonNull Function1<@NonNull PopUpToBuilder, Unit> popUpToBuilder
)
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 | |
|---|---|
@NonNull T route |
route from a Object for the destination |
@NonNull Function1<@NonNull PopUpToBuilder, Unit> popUpToBuilder |
builder used to construct a popUpTo operation |
popUpTo
public final void popUpTo(
@NonNull String route,
@NonNull Function1<@NonNull PopUpToBuilder, Unit> popUpToBuilder
)
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.
setLaunchSingleTop
public final void setLaunchSingleTop(boolean launchSingleTop)
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.
public final void setPopUpTo(int popUpTo)The destination to pop up to before navigating. All non-matching destinations from the back stack up until this destination will also be popped.
setRestoreState
public final void setRestoreState(boolean restoreState)
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.