Fixed
Status Update
Comments
as...@google.com <as...@google.com>
ap...@google.com <ap...@google.com> #2
You don't need to do step 1 or 2 - ensuring you've called addNavigator() before setGraph() is enough.
Specifically, seehttps://issuetracker.google.com/issues/110763345#comment2
Also mentioned is the fact that you can override createFragmentNavigator(), call navController.navigatorProvider.addNavigator() there, then return super.createFragmentNavigator().
Specifically, see
Also mentioned is the fact that you can override createFragmentNavigator(), call navController.navigatorProvider.addNavigator() there, then return super.createFragmentNavigator().
ju...@google.com <ju...@google.com>
na...@google.com <na...@google.com> #3
It's may also be of interest that I am making use of a custom navigator to implement conditional routing. My custom destination/nodes simply implement an interface like this:
interface DynamicNode {
@IdRes
fun getDestination(context: Context, @IdRes destinationIn: Int, argsIn: Bundle?) : Int
}
The Navigator then implements a navigate method that simply calls NavController.navigate using the ID returned by the DynamicNode and returns null, essentially performing a redirect. It would be cool to see something like this baked-in with a later version of the Navigation component.
interface DynamicNode {
@IdRes
fun getDestination(context: Context, @IdRes destinationIn: Int, argsIn: Bundle?) : Int
}
The Navigator then implements a navigate method that simply calls NavController.navigate using the ID returned by the DynamicNode and returns null, essentially performing a redirect. It would be cool to see something like this baked-in with a later version of the Navigation component.
Description
Navigation recently added support for actions and mimeTypes inside of deep links.
There is also a new NavDeepLink Kotlin DSL .
While is is not possible to construct an empty NavDeepLink from java, you can do so from the Kotlin DSL and it will throw an IllegalStateException.
We should add a lint check to notify developers that when using the Kotlin DSL a NavDeepLink must have an uri, action, and/or mimetype or it is invalid.