Destination
class Destination : FragmentNavigator.Destination
Destination for dynamic feature navigator.
Summary
Inherited functions |
From class NavDestination
Unit |
addArgument(@NonNull argumentName: String, @NonNull argument: NavArgument)
Sets an argument type for an argument name
|
Unit |
addDeepLink(@NonNull uriPattern: String)
Add a deep link to this destination. Matching Uris sent to NavController#handleDeepLink(Intent) or NavController#navigate(Uri) will trigger navigating to this destination.
In addition to a direct Uri match, the following features are supported:
- Uris without a scheme are assumed as http and https. For example,
www.example.com will match http://www.example.com and https://www.example.com .
- Placeholders in the form of
{placeholder_name} matches 1 or more characters. The String value of the placeholder will be available in the arguments Bundle with a key of the same name. For example, http://www.example.com/users/{id} will match http://www.example.com/users/4 .
- The
.* wildcard can be used to match 0 or more characters.
These Uris can be declared in your navigation XML files by adding one or more <deepLink app:uri="uriPattern" /> elements as a child to your destination.
Deep links added in navigation XML files will automatically replace instances of ${applicationId} with the applicationId of your app. Programmatically added deep links should use Context#getPackageName() directly when constructing the uriPattern.
|
Unit |
addDeepLink(@NonNull navDeepLink: NavDeepLink)
Add a deep link to this destination. Uris that match the given NavDeepLink uri sent to NavController#handleDeepLink(Intent) or NavController#navigate(NavDeepLinkRequest) will trigger navigating to this destination.
In addition to a direct Uri match, the following features are supported:
- Uris without a scheme are assumed as http and https. For example,
www.example.com will match http://www.example.com and https://www.example.com .
- Placeholders in the form of
{placeholder_name} matches 1 or more characters. The String value of the placeholder will be available in the arguments Bundle with a key of the same name. For example, http://www.example.com/users/{id} will match http://www.example.com/users/4 .
- The
.* wildcard can be used to match 0 or more characters.
These Uris can be declared in your navigation XML files by adding one or more <deepLink app:uri="uriPattern" /> elements as a child to your destination.
Custom actions and mimetypes are also supported by NavDeepLink and can be declared in your navigation XML files by adding <app:action="android.intent.action.SOME_ACTION" /> or <app:mimetype="type/subtype" /> as part of your deepLink declaration.
Deep link Uris, actions, and mimetypes added in navigation XML files will automatically replace instances of ${applicationId} with the applicationId of your app. Programmatically added deep links should use Context#getPackageName() directly when constructing the uriPattern.
When matching deep links for calls to NavController#handleDeepLink(Intent) or NavController#navigate(NavDeepLinkRequest) the order of precedence is as follows: the deep link with the most matching arguments will be chosen, followed by the deep link with a matching action, followed by the best matching mimeType (e.i. when matching mimeType image/jpg: image/* > *\/jpg > *\/*).
|
NavAction? |
getAction(@IdRes id: Int)
Returns the destination ID for a given action. This will recursively check the parent of this destination if the action destination is not found in this destination.
|
MutableMap<String!, NavArgument!> |
getArguments()
Get the arguments supported by this destination. Returns a read-only map of argument names to NavArgument objects that can be used to check the type, default value and nullability of the argument.
To add and remove arguments for this NavDestination use addArgument(String, NavArgument) and removeArgument(String) .
|
Int |
getId()
Returns the destination's unique ID. This should be an ID resource generated by the Android resource system.
|
CharSequence? |
getLabel()
Gets the descriptive label of this destination.
|
String |
getNavigatorName()
Returns the name associated with this destination's Navigator .
|
NavGraph? |
getParent()
Gets the NavGraph that contains this destination. This will be set when a destination is added to a NavGraph via NavGraph#addDestination .
|
Boolean |
hasDeepLink(@NonNull deepLink: Uri)
Checks the given deep link Uri , and determines whether it matches a Uri pattern added to the destination by a call to addDeepLink(String) . It returns
| |