Status Update
Comments
il...@google.com <il...@google.com>
jb...@google.com <jb...@google.com> #2
Branch: androidx-main
commit 3765621e2b049eaec4f249a7d39ee8d9dde848a8
Author: Clara Fok <clarafok@google.com>
Date: Mon Jun 12 13:43:01 2023
Fix zIndex in NavHost
Currently zIndex is based on currentBackStack size, which causes zIndex ordering issues such as zIndex decreasing instead of increasing while navigating forward with pop. Now zIndex increment/decrement is based on direction of navigaton (forward/backward).
Test: manual test
Bug: 285153947
Change-Id: Ib1c3a329755b2cbec3d28568d03d73e5aa9b9128
M navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHost.kt
yo...@gmail.com <yo...@gmail.com> #3
Fixed internally and will be available in navigation-compose 2.7.0-beta02
jb...@google.com <jb...@google.com> #4
Branch: androidx-main
commit 62f4fb24bcfb6c77684dad3a33d4a70b22fdf5aa
Author: Clara Fok <clarafok@google.com>
Date: Wed Jun 14 13:15:57 2023
Add screenshot test for NavHost zIndex
Test: ./gradlew navigation:navigation-compose:cC
Bug: 285153947
Change-Id: Id810649107018fcc480cc26a33171a2dded5bdb0
M navigation/navigation-compose/build.gradle
M navigation/navigation-compose/src/androidTest/java/androidx/navigation/compose/NavHostTest.kt
yo...@gmail.com <yo...@gmail.com> #5
shardViewModel.onGetTypeSecond.observe(viewLifecycleOwner) { isType1 ->
if (isType1) {
val graph = findNavController().graph
val carInstallmentNavGraph =
graph.findNode(R.id.nav_second) as NavGraph
carInstallmentNavGraph.setStartDestination(R.id.secondTypeOneFragment)
findNavController().navigate(SecondFragmentDirections.actionSecondFragmentToSecondTypeOneFragment())
} else {
val graph = findNavController().graph
val carInstallmentNavGraph =
graph.findNode(R.id.nav_second) as NavGraph
carInstallmentNavGraph.setStartDestination(R.id.secondTypeTwoFragment)
findNavController().navigate(SecondFragmentDirections.actionSecondFragmentToSecondTypeTwoFragment())
}
}
and removed app:popUpTo="@id/secondFragment" and app:popUpToInclusive="true"
<fragment
android:id="@+id/secondFragment"
android:name="com.example.navigationdeeplink.SecondFragment"
android:label="fragment_second"
tools:layout="@layout/fragment_second" >
<action
android:id="@+id/action_secondFragment_to_secondTypeOneFragment"
app:destination="@id/secondTypeOneFragment" />
<action
android:id="@+id/action_secondFragment_to_secondTypeTwoFragment"
app:destination="@id/secondTypeTwoFragment"
app:popUpTo="@id/secondFragment" />
</fragment>
ja...@gmail.com <ja...@gmail.com> #6
Is there a planned fix for this issue? We've been stuck on Navigation 2.5.3 for some time due to issues in 2.6.x and now this issue, and the suggested workaround of restructuring our navigation graph is a pretty big lift. If that's the only recommended path it would be helpful to know so we can try to plan for that work, otherwise we'd want to just wait for the fix that doesn't require restructuring.
jb...@google.com <jb...@google.com> #7
This was fixed by
ap...@google.com <ap...@google.com> #8
Branch: androidx-main
commit b292676aa37122f0ca0215023dcdbe27168b2469
Author: Jeremy Woods <jbwoods@google.com>
Date: Wed Sep 27 21:25:35 2023
Add a test for navigate with popUpTo nested graph
Adding a test to ensure that if the start destination of a nested graph
is popped off the back stack when a fragment is created, Navigation does
not crash and gets to the correct position.
Bug: 287133013
Test: adding a test
Change-Id: Ie1e03aeeb00b730b7688311741847b2312bdbaa0
M navigation/navigation-fragment/src/androidTest/java/androidx/navigation/fragment/NavControllerWithFragmentTest.kt
na...@google.com <na...@google.com> #9
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.navigation:navigation-fragment:2.8.0-alpha01
Description
Version used: navigation-fragment-ktx, navigation-ui-ktx 2.6.0
Devices/Android versions reproduced on: All
If this is a bug in the library, we would appreciate if you could attach:
- Sample project to trigger the issue in the following github link:
When I open an app by the deep-link and back-pressing, it crashes. Also, bottom navigation tab 2 has dynamic fragment logic. It will change fragments when the API has a data response. (A sample project doesn't use the API.)
FATAL EXCEPTION: main
Process: com.example.navigationdeeplink, PID: 21948
java.lang.IllegalArgumentException: The fragment SecondFragment{389b31b} (e54e1f09-0f45-4e6c-a668-35e52c4c6ffc id=0x7f0800cc tag=cf5dd8f1-9576-4c91-975d-73e99d7e34b2) is unknown to the FragmentNavigator. Please use the navigate() function to add fragments to the FragmentNavigator managed FragmentManager.
at androidx.navigation.fragment.FragmentNavigator$onAttach$2.onBackStackChangeCommitted(FragmentNavigator.kt:143)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1918)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1845)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1782)
at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:565)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7884)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Issue does not occur when downgrade version 2.6.0 to 2.5.3 or normal open an app
Steps to reproduce
1. run script deeplink (file name test_deeplink.sh in a project)
2. press back system
3. App crashes with the above error