Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit 2d77bdcea09820d6c04c0b6da53eba68fc345e22
Author: Jeremy Woods <jbwoods@google.com>
Date: Tue Dec 13 17:17:33 2022
Make NavigatorState transition APIs noop on same entry
If you attempt to push/popWithTransition on an entry that has already
been push/popped, we should quick return instead of attempting to handle
the entry we have already handled.
RelNote: "Navigator state will now early return when using the
push/popWithTransition APIs and the entry is already being handled."
Test: Added TestNavigatorStateTest to ensure behavior is intact
Bug: 261213893
Change-Id: Iadbfaef1a0d6269bcc974058e09aed30de3611a7
M navigation/navigation-common/src/main/java/androidx/navigation/NavigatorState.kt
M navigation/navigation-testing/src/androidTest/java/androidx/navigation/testing/TestNavigatorStateTest.kt
https://android-review.googlesource.com/2352802
Branch: androidx-main
commit 2d77bdcea09820d6c04c0b6da53eba68fc345e22
Author: Jeremy Woods <jbwoods@google.com>
Date: Tue Dec 13 17:17:33 2022
Make NavigatorState transition APIs noop on same entry
If you attempt to push/popWithTransition on an entry that has already
been push/popped, we should quick return instead of attempting to handle
the entry we have already handled.
RelNote: "Navigator state will now early return when using the
push/popWithTransition APIs and the entry is already being handled."
Test: Added TestNavigatorStateTest to ensure behavior is intact
Bug: 261213893
Change-Id: Iadbfaef1a0d6269bcc974058e09aed30de3611a7
M navigation/navigation-common/src/main/java/androidx/navigation/NavigatorState.kt
M navigation/navigation-testing/src/androidTest/java/androidx/navigation/testing/TestNavigatorStateTest.kt
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
commit 85a4353a9bf8a9b909185256737b75f091686ba4
Author: Jeremy Woods <jbwoods@google.com>
Date: Fri Dec 02 15:19:32 2022
Convert DialogFragmentNavigator to Navigation v2 APIs
Changing DialogFragmentNavigator to use push/popWithTransition to adjust
the Lifecycle state of the NavBackStackEntry in relation to the
DialogFragment.
Now the entry will be moved to RESUMED with the DialogFragment moves to
RESUMED, and it will not be DESTROYED until the DialogFragment is
DESTROYED.
This also adds an onLaunchSingleTopWithTransitions API that adds both the
entering and exiting NavBackStackEntries to the list of
transitionsInProgress.
RelNote: "`DialogFragment` destination `NavBackStackEntry`s will no
longer be `DESTROYED` before the fragment itself is `DESTROYED`."
Bug: 261213893
Test: DialogFragmentNavigatorTest
Change-Id: I53ee5ff20ea8dd04dfffbce10015504a9bdca135
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/public_plus_experimental_current.txt
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/src/main/java/androidx/navigation/NavigatorState.kt
M navigation/navigation-fragment/src/androidTest/java/androidx/navigation/fragment/DialogFragmentNavigatorTest.kt
M navigation/navigation-fragment/src/main/java/androidx/navigation/fragment/DialogFragmentNavigator.kt
https://android-review.googlesource.com/2318960
Branch: androidx-main
commit 85a4353a9bf8a9b909185256737b75f091686ba4
Author: Jeremy Woods <jbwoods@google.com>
Date: Fri Dec 02 15:19:32 2022
Convert DialogFragmentNavigator to Navigation v2 APIs
Changing DialogFragmentNavigator to use push/popWithTransition to adjust
the Lifecycle state of the NavBackStackEntry in relation to the
DialogFragment.
Now the entry will be moved to RESUMED with the DialogFragment moves to
RESUMED, and it will not be DESTROYED until the DialogFragment is
DESTROYED.
This also adds an onLaunchSingleTopWithTransitions API that adds both the
entering and exiting NavBackStackEntries to the list of
transitionsInProgress.
RelNote: "`DialogFragment` destination `NavBackStackEntry`s will no
longer be `DESTROYED` before the fragment itself is `DESTROYED`."
Bug: 261213893
Test: DialogFragmentNavigatorTest
Change-Id: I53ee5ff20ea8dd04dfffbce10015504a9bdca135
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/public_plus_experimental_current.txt
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/src/main/java/androidx/navigation/NavigatorState.kt
M navigation/navigation-fragment/src/androidTest/java/androidx/navigation/fragment/DialogFragmentNavigatorTest.kt
M navigation/navigation-fragment/src/main/java/androidx/navigation/fragment/DialogFragmentNavigator.kt
jb...@google.com <jb...@google.com> #4
This has been fixed internally and will be available in the Navigation 2.6.0-alpha05
release.
pr...@google.com <pr...@google.com> #5
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.navigation:navigation-common:2.6.0-alpha05
androidx.navigation:navigation-fragment:2.6.0-alpha05
androidx.navigation:navigation-testing:2.6.0-alpha05
Description
DialogFragmentNavigator
does not currently use the newNavigator
APIs (i.e. push/popWithTransition). As a result theNavBackStackEntry
s associated with theDialogFragment
all changeLifecycle.State
immediately instead of in sync with theDialogFragment
.This can create problems, for example if a user attempted to access the
ViewModel
of theirNavBackStackEntry
as the Dialog was being dismissed, but before it was destroyed, Navigation would crash stating that the entry is not available. It should still be there until the Dialog is actually destroyed.