Fixed
Status Update
Comments
il...@google.com <il...@google.com> #2
Do you have a sample project that reproduces your issue?
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
commit 161a33e17d95b4a7f8a14ac41352d79c9d459653
Author: Jeremy Woods <jbwoods@google.com>
Date: Wed Apr 07 10:17:04 2021
Ensure FragmentContainerView dispatches insets once
FragmentContainerView overrides onApplyWindowInsets() and dispatches new
insets to all children, but since it is a ViewGroup, and does not
consume the window insets, it makes a call to dispatchApplyWindowInsets
again. On this 2nd pass, if the first child consumes the WindowInsets,
all other children receive empty insets.
We should have FragmentContainerView override dispatchApplyWindowInsets
and dispatch them to the child views there.
RelNote: "When using `FragmentContainerView`, a new set of
`WindowInsets` are now dispatched to child views only once."
Test: modified windowInsetsDispatchToChildren test
Bug: 172153900
Change-Id: I63f685e6715334a77e477180ae94771eeef827c3
M fragment/fragment/build.gradle
M fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentContainerViewTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentContainerView.java
https://android-review.googlesource.com/1666194
Branch: androidx-main
commit 161a33e17d95b4a7f8a14ac41352d79c9d459653
Author: Jeremy Woods <jbwoods@google.com>
Date: Wed Apr 07 10:17:04 2021
Ensure FragmentContainerView dispatches insets once
FragmentContainerView overrides onApplyWindowInsets() and dispatches new
insets to all children, but since it is a ViewGroup, and does not
consume the window insets, it makes a call to dispatchApplyWindowInsets
again. On this 2nd pass, if the first child consumes the WindowInsets,
all other children receive empty insets.
We should have FragmentContainerView override dispatchApplyWindowInsets
and dispatch them to the child views there.
RelNote: "When using `FragmentContainerView`, a new set of
`WindowInsets` are now dispatched to child views only once."
Test: modified windowInsetsDispatchToChildren test
Bug: 172153900
Change-Id: I63f685e6715334a77e477180ae94771eeef827c3
M fragment/fragment/build.gradle
M fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentContainerViewTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentContainerView.java
jb...@google.com <jb...@google.com> #4
This has been fixed internally and will be available in the Fragment 1.3.0
release.
jb...@google.com <jb...@google.com> #5
Sorry about that, I meant Fragment 1.3.3
.
Description
Component used: Fragment Version used: 1.3.0-beta01
FragmentContainerView
overridesonApplyWindowInsets
and dispatches fresh copy ofWindowInsets
to all children correctly. But it does not consumeWindowInsets
and being aViewGroup
it then dispatches the insets again from theViewGroup.dispatchApplyWindowInsets
. As a result the insets are dispatched second time toFragmentContainerView
children, but this time incorrectly - e.g. if first child consumes system window insets, other children receive empty window insets.