Fixed
Status Update
Comments
jb...@google.com <jb...@google.com> #2
Hi Ed, Thank you so much for these suggestions. I've been reviewing them and merging them in. Hopefully it should be live. I've included a thank you note too in the article.
ap...@google.com <ap...@google.com> #3
Great! Thanks a lot, I'll look for the live updates soon!
ap...@google.com <ap...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-main
commit 51b4caa7f56c24dacfb3e17c7d2adbcd514cc960
Author: Jeremy Woods <jbwoods@google.com>
Date: Tue Jan 24 13:58:07 2023
Add prepareForTransition API to NavigatorState
There is currently no way for NavigatorState to address the intermediate
states during transitions. We should add an API that allows
NavBackStackEntries to not need to skip over states, specifically when
entries are being popped off the back stack.
RelNote: "`NavigatorState` now provides the `prepareForTransition` API to
allow the `Navigator` to move NavBackStackEntries to intermediate
`Lifecycle.State`s."
Test: TestNavigatorStateTest
Bug: 238686802
Change-Id: I42c214311d1ab67f589f5749a62133ec564044f4
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-runtime/src/main/java/androidx/navigation/NavController.kt
M navigation/navigation-testing/src/androidTest/java/androidx/navigation/testing/TestNavigatorStateTest.kt
M navigation/navigation-testing/src/main/java/androidx/navigation/testing/TestNavigatorState.kt
https://android-review.googlesource.com/2401934
Branch: androidx-main
commit 51b4caa7f56c24dacfb3e17c7d2adbcd514cc960
Author: Jeremy Woods <jbwoods@google.com>
Date: Tue Jan 24 13:58:07 2023
Add prepareForTransition API to NavigatorState
There is currently no way for NavigatorState to address the intermediate
states during transitions. We should add an API that allows
NavBackStackEntries to not need to skip over states, specifically when
entries are being popped off the back stack.
RelNote: "`NavigatorState` now provides the `prepareForTransition` API to
allow the `Navigator` to move NavBackStackEntries to intermediate
`Lifecycle.State`s."
Test: TestNavigatorStateTest
Bug: 238686802
Change-Id: I42c214311d1ab67f589f5749a62133ec564044f4
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-runtime/src/main/java/androidx/navigation/NavController.kt
M navigation/navigation-testing/src/androidTest/java/androidx/navigation/testing/TestNavigatorStateTest.kt
M navigation/navigation-testing/src/main/java/androidx/navigation/testing/TestNavigatorState.kt
ap...@google.com <ap...@google.com> #5
Project: platform/frameworks/support
Branch: androidx-main
commit d6c9bc593b36b91c8127822d0f06662373e2d6ad
Author: Jeremy Woods <jbwoods@google.com>
Date: Mon Jan 23 18:04:21 2023
Add OnBackStackChanged APIs to FragmentManager
Adding two new callbacks on the OnBackStackChangedListener interface.
onBackStackChangeStarted to indicate when a back stack change has
begun and onBackStackChangeCommitted to indicate when the
FragmentManager has committed the change.
These callbacks will be called on a record by record basis. So if using
reorderingAllowed and you do 3 different commits, you should expect 3
different callback from each function.
RelNote: "You can now get callbacks for individual fragments involved in
a `FragmentTransaction` when back stack changes occur in the
`FragmentManager`."
Test: Added OnBackStackChangedListenerTests
Bug: 238686802
Change-Id: Ib7ce5958d86ea1701f78e519ff607aa60a439def
M fragment/fragment/api/current.txt
M fragment/fragment/api/public_plus_experimental_current.txt
M fragment/fragment/api/restricted_current.txt
A fragment/fragment/src/androidTest/java/androidx/fragment/app/OnBackStackChangedListenerTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManager.java
https://android-review.googlesource.com/2399825
Branch: androidx-main
commit d6c9bc593b36b91c8127822d0f06662373e2d6ad
Author: Jeremy Woods <jbwoods@google.com>
Date: Mon Jan 23 18:04:21 2023
Add OnBackStackChanged APIs to FragmentManager
Adding two new callbacks on the OnBackStackChangedListener interface.
onBackStackChangeStarted to indicate when a back stack change has
begun and onBackStackChangeCommitted to indicate when the
FragmentManager has committed the change.
These callbacks will be called on a record by record basis. So if using
reorderingAllowed and you do 3 different commits, you should expect 3
different callback from each function.
RelNote: "You can now get callbacks for individual fragments involved in
a `FragmentTransaction` when back stack changes occur in the
`FragmentManager`."
Test: Added OnBackStackChangedListenerTests
Bug: 238686802
Change-Id: Ib7ce5958d86ea1701f78e519ff607aa60a439def
M fragment/fragment/api/current.txt
M fragment/fragment/api/public_plus_experimental_current.txt
M fragment/fragment/api/restricted_current.txt
A fragment/fragment/src/androidTest/java/androidx/fragment/app/OnBackStackChangedListenerTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManager.java
jb...@google.com <jb...@google.com> #6
This has been fixed internally and will be in the Navigation 2.6.0-alpha05
and Fragment 1.6.0-alpha05
releases.
pr...@google.com <pr...@google.com> #7
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.fragment:fragment:1.6.0-alpha05
androidx.navigation:navigation-common:2.6.0-alpha05
androidx.navigation:navigation-fragment:2.6.0-alpha05
androidx.navigation:navigation-runtime:2.6.0-alpha05
androidx.navigation:navigation-testing:2.6.0-alpha05
Description
Navigation 2.4 introduced new Navigator APIs that were equipped to handle transitions, ensuring that NavBackStackEntries would always be in the proper state. (i.e.
STARTED
until the incoming transition completes then movingRESUMED
orCREATED
until the outgoing transition completes and then moving toDESTROYED
).Now that these APIs are available, they should also be implemented in Navigation with Fragments. This would ensure that the state of Fragment also follows the same conventions of NavBackStackEntry and provides properly Lifecycle updates while handling animations, animators, and transitions.