-
public final class NavControllerExtKt
-
-
Method Summary
Modifier and Type Method Description final static <T extends Any> Unitnavigate(NavController<T> $self, List<T> destinations)Adds new destinations to the backstack. final static <T extends Any> Unitnavigate(NavController<T> $self, T destination)Adds a new destination to the backstack. final static <T extends Any> BooleanmoveToTop(NavController<T> $self, Match match, Function1<T, Boolean> predicate)Looks for the destination that meet the condition of the predicate and moves this destination to the top of the backstack, effectively making it the currently displayed item in NavHost. final static <T extends Any> Booleanpop(NavController<T> $self)Pops the last destination off the backstack. final static <T extends Any> UnitpopAll(NavController<T> $self)Pops all destinations off the backstack, making it empty. final static <T extends Any> BooleanpopUpTo(NavController<T> $self, Boolean inclusive, Match match, Function1<T, Boolean> predicate)Pops all destinations off the backstack up to the destination that meets the condition of the predicate. final static <T extends Any> BooleanreplaceLast(NavController<T> $self, List<T> newDestinations)Pops the last destination off the backstack and replaces it with newDestinations. final static <T extends Any> BooleanreplaceLast(NavController<T> $self, T newDestination)Pops the last destination off the backstack and replaces it with a newDestination. final static <T extends Any> UnitreplaceAll(NavController<T> $self, List<T> newDestinations)Pops all destinations off the backstack and replaces them with newDestinations. final static <T extends Any> UnitreplaceAll(NavController<T> $self, T newDestination)Pops all destinations off the backstack and replaces them with a newDestination. final static <T extends Any> BooleanreplaceUpTo(NavController<T> $self, List<T> newDestinations, Boolean inclusive, Match match, Function1<T, Boolean> predicate)Pops all destinations off the backstack up to the destination that meets the condition of the predicate and replaces them with newDestinations. final static <T extends Any> BooleanreplaceUpTo(NavController<T> $self, T newDestination, Boolean inclusive, Match match, Function1<T, Boolean> predicate)Pops all destinations off the backstack up to the destination that meets the condition of the predicate and replaces them with a newDestination. -
-
Method Detail
-
navigate
final static <T extends Any> Unit navigate(NavController<T> $self, List<T> destinations)
Adds new destinations to the backstack.
The order of the items in the list is interpreted as going from the bottom of the backstack to the top. It means that the last item of the list will become the currently displayed item in NavHost.
The destinations list may be empty.
-
navigate
final static <T extends Any> Unit navigate(NavController<T> $self, T destination)
Adds a new destination to the backstack. It will become the currently displayed item in NavHost.
-
moveToTop
final static <T extends Any> Boolean moveToTop(NavController<T> $self, Match match, Function1<T, Boolean> predicate)
Looks for the destination that meet the condition of the predicate and moves this destination to the top of the backstack, effectively making it the currently displayed item in NavHost.
In most cases this method should be used in pair with navigate:
if (!navController.moveToTop { it is SomeDestination }) { // navigate to a new destination if there is no existing one navController.navigate(SomeDestination()) }- Parameters:
match- specifies the policy of selecting the target item in case of multiple matching items.
-
pop
final static <T extends Any> Boolean pop(NavController<T> $self)
Pops the last destination off the backstack.
-
popAll
final static <T extends Any> Unit popAll(NavController<T> $self)
Pops all destinations off the backstack, making it empty.
-
popUpTo
final static <T extends Any> Boolean popUpTo(NavController<T> $self, Boolean inclusive, Match match, Function1<T, Boolean> predicate)
Pops all destinations off the backstack up to the destination that meets the condition of the predicate.
- Parameters:
inclusive- whether the item itself should be popped or not, default value isfalsematch- specifies the policy of selecting the target item in case of multiple matching items.
-
replaceLast
final static <T extends Any> Boolean replaceLast(NavController<T> $self, List<T> newDestinations)
Pops the last destination off the backstack and replaces it with newDestinations.
The order of the items in the list is interpreted as going from the bottom of the backstack to the top. It means that the last item of the list will become the currently displayed item in NavHost.
The newDestinations list may be empty.
-
replaceLast
final static <T extends Any> Boolean replaceLast(NavController<T> $self, T newDestination)
Pops the last destination off the backstack and replaces it with a newDestination.
-
replaceAll
final static <T extends Any> Unit replaceAll(NavController<T> $self, List<T> newDestinations)
Pops all destinations off the backstack and replaces them with newDestinations.
The order of the items in the list is interpreted as going from the bottom of the backstack to the top. It means that the last item of the list will become the currently displayed item in NavHost.
The newDestinations list may be empty.
If the backstack is empty, the newDestinations are still added.
-
replaceAll
final static <T extends Any> Unit replaceAll(NavController<T> $self, T newDestination)
Pops all destinations off the backstack and replaces them with a newDestination.
If the backstack is empty, the newDestination is still added.
-
replaceUpTo
final static <T extends Any> Boolean replaceUpTo(NavController<T> $self, List<T> newDestinations, Boolean inclusive, Match match, Function1<T, Boolean> predicate)
Pops all destinations off the backstack up to the destination that meets the condition of the predicate and replaces them with newDestinations.
The order of the items in the list is interpreted as going from the bottom of the backstack to the top. It means that the last item of the list will become the currently displayed item in NavHost.
The newDestinations list may be empty.
- Parameters:
inclusive- whether the item itself should be popped or not, default value isfalsematch- specifies the policy of selecting the target item in case of multiple matching items.
-
replaceUpTo
final static <T extends Any> Boolean replaceUpTo(NavController<T> $self, T newDestination, Boolean inclusive, Match match, Function1<T, Boolean> predicate)
Pops all destinations off the backstack up to the destination that meets the condition of the predicate and replaces them with a newDestination.
- Parameters:
inclusive- whether the item itself should be popped or not, default value isfalsematch- specifies the policy of selecting the target item in case of multiple matching items.
-
-
-
-