Fixed
Status Update
Comments
ve...@google.com <ve...@google.com>
ve...@google.com <ve...@google.com> #2
We have passed this to the development team and will update this case with more information as it becomes available.
il...@google.com <il...@google.com>
il...@google.com <il...@google.com>
jb...@google.com <jb...@google.com> #3
Container and Fragment animations (or transitions) should not be used together. Attempting to do so can cause unexpected behavior.
If both animations are turned on, we will defer to the container animations and ensure that Fragments behave appropriately (being destroyed, detached, etc.).
If both animations are turned on, we will defer to the container animations and ensure that Fragments behave appropriately (being destroyed, detached, etc.).
ap...@google.com <ap...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 7770cec83cfc63d351c2ca5013acca1094f77bf1
Author: jbwoods <jbwoods@google.com>
Date: Thu May 16 14:23:39 2019
Defer to container animations
If a FrameLayout containing a Fragment sets animateLayoutChanges=true,
and that Fragment has set custom animations or a transition, there is a
conflict in the Fragment animation. This conflict keeps a Fragment that
is replaced (without being added to the back stack from) from being
destroyed or detached.
This change disables the Fragment animations (and transitions) if
animations on its container have already been enabled. Therefore,
Fragments that are replaced can be properly destroyed.
Test: Added Test and reran old test
Fixes: 116257087
Change-Id: I2cd1f657839b443d00f7ded12d03334f75e9d660
A fragment/src/androidTest/java/androidx/fragment/app/FragmentAnimatedContainerTest.kt
A fragment/src/androidTest/res/layout/animated_container.xml
M fragment/src/main/java/androidx/fragment/app/FragmentManagerImpl.java
https://android-review.googlesource.com/962786
https://goto.google.com/android-sha1/7770cec83cfc63d351c2ca5013acca1094f77bf1
Branch: androidx-master-dev
commit 7770cec83cfc63d351c2ca5013acca1094f77bf1
Author: jbwoods <jbwoods@google.com>
Date: Thu May 16 14:23:39 2019
Defer to container animations
If a FrameLayout containing a Fragment sets animateLayoutChanges=true,
and that Fragment has set custom animations or a transition, there is a
conflict in the Fragment animation. This conflict keeps a Fragment that
is replaced (without being added to the back stack from) from being
destroyed or detached.
This change disables the Fragment animations (and transitions) if
animations on its container have already been enabled. Therefore,
Fragments that are replaced can be properly destroyed.
Test: Added Test and reran old test
Fixes: 116257087
Change-Id: I2cd1f657839b443d00f7ded12d03334f75e9d660
A fragment/src/androidTest/java/androidx/fragment/app/FragmentAnimatedContainerTest.kt
A fragment/src/androidTest/res/layout/animated_container.xml
M fragment/src/main/java/androidx/fragment/app/FragmentManagerImpl.java
ar...@gmail.com <ar...@gmail.com> #5
Its unclear to me whether this is the same issue as I have experienced. I also have animateLayoutChanges=true on my linearLayouts, but those are not being animated when my fragments get stuck in isRemoving. I moving back from MainFragment > DestinationFragment to MainFragment, and my main fragment has a google map view which animates on return (due to changed address). If I don't delay the map-zoom until after fragment transition is complete, I'm pretty certain the DestinationFragment will get stuck on isRemoving (I'm not sure if was 100% or 75% of the time).
I'm just reaching out with this info, to let you know Google map-animation has also been an issue with this.
I am using androidx.legacy:legacy-support-v13:1.0.0, and androidx.fragment.app.FragmentManager.
Best Alex
I'm just reaching out with this info, to let you know Google map-animation has also been an issue with this.
I am using androidx.legacy:legacy-support-v13:1.0.0, and androidx.fragment.app.FragmentManager.
Best Alex
il...@google.com <il...@google.com> #6
Re #5 - this was fixed for Fragments 1.1.0-beta01. If you're still seeing an issue, please file a new issue with a sample project that reproduces your issue.
ap...@google.com <ap...@google.com> #7
Project: platform/frameworks/support
Branch: androidx-master-dev
commit b1757aa46967a53eb649512d49962fd9cccbee70
Author: jbwoods <jbwoods@google.com>
Date: Wed Jun 12 11:17:06 2019
Create custom ViewGroup for Fragments
Existing ViewGroups can turn on view animations (and transitions) by
setting animateLayoutChanges to true. When attempting to use both view
and fragment animations, it is possible to observe unexpected behavior
because the animation systems are not synced very well. aosp/962786
disables fragment animations if animateLayoutChanges is true on its
view.
This custom ViewGroup disables view animations (and transitions). If a
developer attempts to set transitions on the view, either through
setting animateLayoutChange to true or explicitly using
setLayoutTransition(), an UnsupportedOperationException will be thrown.
Test: Added FragmentContainerViewTest, ./gradlew checkApi
BUG: 116257087
Change-Id: I7498950b502e8c51f941c8c1e59dbfe11649b6bc
M fragment/fragment/api/restricted_1.2.0-alpha01.txt
M fragment/fragment/api/restricted_current.txt
A fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentContainerViewTest.kt
A fragment/fragment/src/androidTest/res/layout/fragment_container_view.xml
A fragment/fragment/src/androidTest/res/layout/fragment_container_view_unsupported_operation.xml
A fragment/fragment/src/main/java/androidx/fragment/app/FragmentContainerView.java
https://android-review.googlesource.com/982228
https://goto.google.com/android-sha1/b1757aa46967a53eb649512d49962fd9cccbee70
Branch: androidx-master-dev
commit b1757aa46967a53eb649512d49962fd9cccbee70
Author: jbwoods <jbwoods@google.com>
Date: Wed Jun 12 11:17:06 2019
Create custom ViewGroup for Fragments
Existing ViewGroups can turn on view animations (and transitions) by
setting animateLayoutChanges to true. When attempting to use both view
and fragment animations, it is possible to observe unexpected behavior
because the animation systems are not synced very well. aosp/962786
disables fragment animations if animateLayoutChanges is true on its
view.
This custom ViewGroup disables view animations (and transitions). If a
developer attempts to set transitions on the view, either through
setting animateLayoutChange to true or explicitly using
setLayoutTransition(), an UnsupportedOperationException will be thrown.
Test: Added FragmentContainerViewTest, ./gradlew checkApi
BUG: 116257087
Change-Id: I7498950b502e8c51f941c8c1e59dbfe11649b6bc
M fragment/fragment/api/restricted_1.2.0-alpha01.txt
M fragment/fragment/api/restricted_current.txt
A fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentContainerViewTest.kt
A fragment/fragment/src/androidTest/res/layout/fragment_container_view.xml
A fragment/fragment/src/androidTest/res/layout/fragment_container_view_unsupported_operation.xml
A fragment/fragment/src/main/java/androidx/fragment/app/FragmentContainerView.java
Description
proper behavior:
when replacing fragment on empty container, fragment is added
when replacing fragment on container with other fragment, the old fragment is removed from view and destroyed, new one is added
when removing fragment from container, fragment is removed and destroyed
observed behavior:
when replacing fragment on container with other fragment, old fragment is removed from view, but not destroyed, new one is added
The problem is with "double animation" - when container have animateLayoutChanges="true" and replacing fragments with animation (system or custom)
can this be fixed, so that i can have animation of showing fragment and animation of changing container size?
sample project to show the issue:
tested on Android 8.0
tested with build tools 28 and 27.0.3
tested on support libraries 27.1.1 and 28.0.0-RC02
in sample project there are two containers the fragments are replaced in in the same time, in one with animateLayoutChanges old fragment is not destroyed nor detached, in the one without layout changes old fragment is properly destroyed and detached