I'm trying to implement a forgot password flow. What I'd like to do is to handle the received email, which contains a link to a forgot password web page, inside the app.
Using the Navigation component I created a deep link, which opens the right fragment (the one with the password field). So I'm able to change the password. Clicking on back, I return to the login screen, which is the start point of my navigation graph.
Everything works as expected, except for the animations. When I create an action between destination, I'm able to assign enter/exit/popenter/popexit animations, but with deep link I don't create any action, so when I push back, I reach the expected fragment but no animation is played.
I tried to play a bit with the code, but no results, and I cannot find any possible solution in the docs.
I tried to create some actions in my navigation graph (there are 4 different options right clicking on a destination:
None of them seems to solve my problem. Ideas? Thanks in advance.
You can find in the NavController
public void navigate(@NonNull Uri deepLink, @Nullable NavOptions navOptions) {
navigate(deepLink, navOptions, null);
}
In NavOptions set your animations in the same way like in an action:
val navOptions =
NavOptions.Builder()
.setPopUpTo(
R.id.nav_graph_main,
false
)
.setEnterAnim(R.anim.slide_in_right)
.setExitAnim(R.anim.slide_out_left)
.setPopEnterAnim(R.anim.slide_in_left)
.setPopExitAnim(R.anim.slide_out_right)
.build()