Fixed
Status Update
Comments
[Deleted User] <[Deleted User]> #2
Oh and one more thing I forgot. Fragment A's child fragment is also part of the nested navigation controller, for which the Fragment A contains the root NavHostFragment, and not the root nav controller Fragment A is part of. So maybe it's not due to FragmentManager, maybe it's the nested navigation controller prematurely removing it's own fragment, when exitAnimation starts for it's root/parent fragment A.
Other than that, instanceState of the child fragment is preserved properly when navigating back and forth.. It's just that it's view is removed prematurely for some reason.
Other than that, instanceState of the child fragment is preserved properly when navigating back and forth.. It's just that it's view is removed prematurely for some reason.
[Deleted User] <[Deleted User]> #3
Ok I just tested it, and it is due to nested navigation graph. When I include a child fragment directly into Fragment A, without navigation, it's not removed prematurely and it's working as intended.
So where do we go from here, is this a bug for you to fix, or there's something wrong with my nested navigation graph implementation, in which case I'd like you to point me in the right direction how to fix it?
So where do we go from here, is this a bug for you to fix, or there's something wrong with my nested navigation graph implementation, in which case I'd like you to point me in the right direction how to fix it?
il...@google.com <il...@google.com> #4
Can you attach a sample project that reproduces your issue?
[Deleted User] <[Deleted User]> #5
Here you go: https://drive.google.com/file/d/12Tz8YjCEbcs4LzxqL4352zUJyPvJ_GLt/view?usp=sharing
I slowed down the animations so you can see what's happening.
Root Fragment A is the one with BottomNavigationBar on the bottom.
GREEN - Fragment A's CHILD fragment (the one that's disappearing)
RED - Destination Fragment
Press "Settings" in the action menu on the upper right to start navigation. Observe how Root Fragment A is visible during the whole animation with it's BottomNavigationBar, but it's CHILD GREEN fragment disappears immediately, as it is part of the nested navigation graph hosted in the Fragment A itself.
On the way back, Fragment A is properly recreated with it's green child fragment, and both are visible properly (when going back in the direction A <- B).
I slowed down the animations so you can see what's happening.
Root Fragment A is the one with BottomNavigationBar on the bottom.
GREEN - Fragment A's CHILD fragment (the one that's disappearing)
RED - Destination Fragment
Press "Settings" in the action menu on the upper right to start navigation. Observe how Root Fragment A is visible during the whole animation with it's BottomNavigationBar, but it's CHILD GREEN fragment disappears immediately, as it is part of the nested navigation graph hosted in the Fragment A itself.
On the way back, Fragment A is properly recreated with it's green child fragment, and both are visible properly (when going back in the direction A <- B).
il...@google.com <il...@google.com> #6
I'm having trouble downloading your project from Google Drive for some reason. Would you mind attaching it here directly?
I suspect this is a Fragment issue and not something Navigation can control. I'd be interested to know if you run into the same issue if you have *any* Fragment, rather than a NavHostFragment, between your child of A and A itself.
I suspect this is a Fragment issue and not something Navigation can control. I'd be interested to know if you run into the same issue if you have *any* Fragment, rather than a NavHostFragment, between your child of A and A itself.
[Deleted User] <[Deleted User]> #7
I'll test that too when I have some time, though it might not be soon.
I'll attach the project directly so you can test it yourself, and if it is the problem with Fragments, then let's open the issue for Fragments..
I'll attach the project directly so you can test it yourself, and if it is the problem with Fragments, then let's open the issue for Fragments..
jb...@google.com <jb...@google.com>
ap...@google.com <ap...@google.com> #9
Project: platform/frameworks/support
Branch: androidx-master-dev
commit c53170c58309d7370d63d5386e83fce4cee02ba2
Author: jbwoods <jbwoods@google.com>
Date: Wed Jun 26 17:58:38 2019
Avoid grandchild Fragment animations running during parent Fragment transactions
Follow-up to aosp/951635. Child fragment views are not destroyed when the parent
is animated, but grandchild fragment views are.
This change checks up the ancestor hierarchy to ensure fragment views
will not be destroyed if any of its ancestors are being removed.
Test: Added unit Test
BUG: 116675313
Change-Id: Ie65ae2fb150340b51bb0362cfa84f320ee2e8c7e
M fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentAnimationTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/Fragment.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManagerImpl.java
https://android-review.googlesource.com/1001542
https://goto.google.com/android-sha1/c53170c58309d7370d63d5386e83fce4cee02ba2
Branch: androidx-master-dev
commit c53170c58309d7370d63d5386e83fce4cee02ba2
Author: jbwoods <jbwoods@google.com>
Date: Wed Jun 26 17:58:38 2019
Avoid grandchild Fragment animations running during parent Fragment transactions
Follow-up to aosp/951635. Child fragment views are not destroyed when the parent
is animated, but grandchild fragment views are.
This change checks up the ancestor hierarchy to ensure fragment views
will not be destroyed if any of its ancestors are being removed.
Test: Added unit Test
BUG: 116675313
Change-Id: Ie65ae2fb150340b51bb0362cfa84f320ee2e8c7e
M fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentAnimationTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/Fragment.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManagerImpl.java
jb...@google.com <jb...@google.com> #10
This has been fixed internally and will be available in the Fragment 1.2.0-alpha01 release.
il...@google.com <il...@google.com> #11
This actually just missed the 1.2.0-alpha01 cut off, so it'll actually be in 1.2.0-alpha02.
be...@gmail.com <be...@gmail.com> #12
Can confirm fix in "androidx.fragment:fragment:1.2.0-alpha02". Thanks a lot!
ad...@gmail.com <ad...@gmail.com> #13
Provide a 1 line caption in 15 words capturing key details. Start with introducing it like "This image" -
Description
Version used: 1.0.0-alpha6
Devices/Android versions reproduced on: irrelevant
Let's say that I use Navigation to transition from Fragment A to Fragment B, like this: A -> B. Let's also say that I use transition animation on the action, and now the most important part, let's also say that Fragment A has a CHILD fragment which also has it's own view..
The problem is, when I start navigation with transition animation, Fragment A's CHILD fragment view disappears immediately, which makes a jarring "pop", and essentially makes my transition animation useless. Root Fragment A is behaving properly, and stays visible for the whole duration of the animation.
Again, the issue is probably due to the FragmenManager itself, cause it seems like it's making only the ROOT fragment respect the configured exitAnim, but not it's child fragments (which disappear immediately)..
If this is a bug in the library, we would appreciate if you could attach:
- Sample project to trigger the issue. (ASK ME IF NECESSARY)
- A screenrecord or screenshots showing the issue (if UI related). (ASK ME IF NECESSARY)