NavOptions

open class NavOptions
kotlin.Any
   ↳ androidx.navigation.NavOptions

NavOptions stores special options for navigate actions

Summary

Nested classes
open

Builder for constructing new instances of NavOptions.

Public methods
open Int

The custom enter Animation/Animator that should be run.

open Int

The custom exit Animation/Animator that should be run when this destination is popped from the back stack.

open Boolean

Whether the destination set in #getPopUpTo should be popped from the back stack.

open Int

The custom exit Animation/Animator that should be run.

open Int

The custom enter Animation/Animator that should be run when this destination is popped from the back stack.

open Boolean

Whether this navigation action should launch as single-top (i.

open Int

The destination to pop up to before navigating.

open Boolean

Whether this navigation action should launch the destination in a new document.

open Boolean

Whether this navigation action should clear the entire back stack

open static Unit
addPopAnimationsToIntent(intent: Intent, navOptions: NavOptions?)

Add the pop enter and pop exit animation to an Intent for later usage with #applyPopAnimationsToPendingTransition(Activity).

open static Unit

Apply any pop animations in the Intent of the given Activity to a pending transition.

Public methods

getEnterAnim

open fun getEnterAnim(): Int

The custom enter Animation/Animator that should be run.

Return
Int: the resource id of a Animation or Animator or -1 if none.

getPopExitAnim

open fun getPopExitAnim(): Int

The custom exit Animation/Animator that should be run when this destination is popped from the back stack.

Return
Int: the resource id of a Animation or Animator or -1 if none.

isPopUpToInclusive

open fun isPopUpToInclusive(): Boolean

Whether the destination set in #getPopUpTo should be popped from the back stack.

getExitAnim

open fun getExitAnim(): Int

The custom exit Animation/Animator that should be run.

Return
Int: the resource id of a Animation or Animator or -1 if none.

getPopEnterAnim

open fun getPopEnterAnim(): Int

The custom enter Animation/Animator that should be run when this destination is popped from the back stack.

Return
Int: the resource id of a Animation or Animator or -1 if none.

shouldLaunchSingleTop

open fun shouldLaunchSingleTop(): 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).

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

getPopUpTo

open fun getPopUpTo(): Int

The destination to pop up to before navigating. When set, all non-matching destinations should be popped from the back stack.

Return
Int: the destinationId to pop up to, clearing all intervening destinations

shouldLaunchDocument

open fun shouldLaunchDocument(): Boolean

Whether this navigation action should launch the destination in a new document.

This functions similarly to how android.content.Intent#FLAG_ACTIVITY_NEW_DOCUMENT works with activites.

shouldClearTask

open fun shouldClearTask(): Boolean

Whether this navigation action should clear the entire back stack

This functions similarly to how android.content.Intent#FLAG_ACTIVITY_CLEAR_TASK works with activites.

addPopAnimationsToIntent

open static fun addPopAnimationsToIntent(intent: Intent, navOptions: NavOptions?): Unit

Add the pop enter and pop exit animation to an Intent for later usage with #applyPopAnimationsToPendingTransition(Activity).

This is automatically called for you by ActivityNavigator.

Parameters
intent Intent: Intent being started with the given NavOptions
navOptions Intent: NavOptions containing the pop animations.

applyPopAnimationsToPendingTransition

open static fun applyPopAnimationsToPendingTransition(activity: Activity): Unit

Apply any pop animations in the Intent of the given Activity to a pending transition. This should be used in place of Activity#overridePendingTransition(int, int) to get the appropriate pop animations.

Parameters
activity Activity: An activity started from the ActivityNavigator.