Status Update
Comments
jb...@google.com <jb...@google.com>
cs...@supercharge.io <cs...@supercharge.io> #2
This happens when fragments use animation whereby it doesn't wait for animations to complete and moves directly to RESUMED state.
The entry's listener to Fragment state does not get attached because it was attaching only if Fragment was in CREATED / STARTED state.
jb...@google.com <jb...@google.com> #3
Branch: androidx-main
commit 16afaea63fc18ca7cc298e6650e0463083ba8ad7
Author: Clara Fok <clarafok@google.com>
Date: Mon Feb 27 17:27:15 2023
Fix FragmentNavigator resume states
Entries previously were not attaching fragment lifecycle observers because it would do so only if Fragment was STARTED or CREATED. But when using animations, Fragments would jump straight to RESUME and no observers would be attached.
Observers are now attached as long as Fragment is atleast STARTED. Since initial entry is not added to backStack, we store its entry to later attach an observer when its fragment is attached.
This CL also lays the foundation for attaching observers upon configuration changes / recreates.
Test: ./gradlew navigation:navigation-fragment:cC
Bug: 269646882
Relnote: "Fixes regression in navigation 2.6.0-alpha06 where NavBackStackEntry is not moved to RESUMED state"
Change-Id: Ib35896636c187da5bd11ea06234a3ea815fdeb68
M navigation/navigation-fragment/src/androidTest/java/androidx/navigation/fragment/FragmentNavigatorTest.kt
A navigation/navigation-fragment/src/androidTest/res/anim/fade_enter.xml
A navigation/navigation-fragment/src/androidTest/res/anim/fade_exit.xml
M navigation/navigation-fragment/src/main/java/androidx/navigation/fragment/FragmentNavigator.kt
cs...@supercharge.io <cs...@supercharge.io> #4
This has been fixed internally and will be available in navigation 2.6.0-alpha07
ap...@google.com <ap...@google.com> #5
Branch: androidx-main
commit c73552953192ba60a879f5e51218f6e157a24beb
Author: Clara Fok <clarafok@google.com>
Date: Tue Feb 28 14:47:30 2023
Add FragmentNavigator test
Ensure initial fragments and their entries are correctly replaced and destroyed when navigate and popping consecutively
Test: ./gradlew navigation:navigation-fragment:cC
Bug: 269646882
Change-Id: I552ddd3d74f20612c4c91336eb4af9e6aa99c146
M navigation/navigation-fragment/src/androidTest/java/androidx/navigation/fragment/FragmentNavigatorTest.kt
M navigation/navigation-fragment/src/androidTest/res/navigation/nav_simple.xml
cl...@google.com <cl...@google.com> #6
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.navigation:navigation-fragment:2.6.0-alpha07
pr...@google.com <pr...@google.com> #7
NavBackStackEntry is still not triggering RESUMED on androidx.navigation:navigation-fragment:2.6.0-alpha09
in certain cases, where after a locale or uiMode change with
AppCompatDelegate.setApplicationLocales
AppCompatDelegate.setDefaultNightMode
Issue can be reproduced with attaching LifecycleObserver to the currentBackStackEntry of a Home fragment like so:
findNavController().currentBackStackEntry?.lifecycle?.let {
if (it.currentState.isAtLeast(Lifecycle.State.RESUMED)) {
Timber.d(Constants.LOG_INFO, "lifecycle.currentState", "resumed")
} else {
val testLifecycleObserver = object : DefaultLifecycleObserver {
override fun onResume(owner: LifecycleOwner) {
Timber.d(Constants.LOG_INFO, "lifecycle.currentState", "onResumed")
it.removeObserver(this)
}
}
it.addObserver(testLifecycleObserver)
}
}
After performing a config change as mentioned above on a Settings fragment, upon performing a popBackStack/navigateUp to Home fragment, the DefaultLifecycleObserver's onResume will not be triggered. Issue does not occur if a config change is not performed.
cs...@supercharge.io <cs...@supercharge.io> #8
I believe this was actually addressed as part of the Navigation
il...@google.com <il...@google.com> #9
We've added a note to the release notes - thanks again!
In the future, note that you can add a Relnote:
line in the pull request's description to ensure it gets into the release notes automatically.
ko...@gmail.com <ko...@gmail.com> #10
Thanks! I followed the Relnote:
, maybe it should be added there.
Description
Version used: 2.8.3
@Serializable
class MyRoute(
val platforms: List<Platform>
)
enum class Platform {
ANDROID, IOS
}
composable<MyRoute> { MyScreen() }
This will result in an exception:
java.lang.IllegalArgumentException: Route MyRoute could not find any NavType for argument platforms of type kotlin.collections.ArrayList - typeMap received was {}
Please support list of enums by default.