Status Update
Comments
jb...@google.com <jb...@google.com>
il...@google.com <il...@google.com> #2
The default is no animations, so just not setting any enter/exit animation at all when building your NavOptions
should be enough to suppress any activity animation. Is there a particular reason you're explicitly setting them to 0 rather than relying on the defaults?
be...@citymapper.com <be...@citymapper.com> #3
If no enter/exit animation is set in NavOptions, and the destination is an Activity, then the system's default Activity transition will run, as ActivityNavigator doesn't call overridePendingTransition() if both the enter and exit animations are -1
We can work around it for the moment by calling overridePendingTransition(0, 0)
ourselves, but the destination being navigated to in this instance won't always be an Activity, so we'd have to special case it.
il...@google.com <il...@google.com> #4
Thanks, that's helpful context. We'll fix this for an upcoming Navigation 2.3.3 release.
ap...@google.com <ap...@google.com> #5
Branch: androidx-main
commit e730e7d7a6ea63a15085d8c17781acdd2791a6f0
Author: Jeremy Woods <jbwoods@google.com>
Date: Mon Jan 11 16:10:44 2021
Allow anim resource values of 0 when navigating to an activity
When navigating to an Activity with extra NavOptions, if you set the
animation resource values to 0, the resources can not be found.
We should allow resource values to be set to 0 to prevent any Activity
animations.
RelNote: "Fixed regression caused by
activity with an animation resource value of 0 caused a
ResourceNotFoundException."
Test: tested in sample app from
Bug: 176819931
Change-Id: I7aedb282e3bd4534758035fe17bfcdb3287be604
M navigation/navigation-runtime/src/main/java/androidx/navigation/ActivityNavigator.java
Description
In Navigation 2.3.1 and below, setting enter/exit transitions to
0
in NavOptions when navigating to an Activity destination would suppress the activity transitionWithhttps://android-review.googlesource.com/c/platform/frameworks/support/+/1489583/ in 2.3.2 the Navigator attempts to get the resource type name for enter/exit animations. If
0
is passed, this crashes with aResourceNotFoundException