Fixed
Status Update
Comments
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-master-dev
commit f2e484344ac8e77f8ffe104529efa679c2af809e
Author: Ian Lake <ilake@google.com>
Date: Mon Jun 24 15:33:43 2019
Call requestApplyInsets before onViewCreated()
Rather than having each Fragment that cares about
insets call requestApplyInsets() themselves, call it
immediately before onViewCreated() - i.e., immediately
after adding the View.
Test: manually tested
BUG: 135945162
Change-Id: I6d40ad3fdac90515ec85b3f63fb867cde11fa8a3
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManagerImpl.java
https://android-review.googlesource.com/987661
https://goto.google.com/android-sha1/f2e484344ac8e77f8ffe104529efa679c2af809e
Branch: androidx-master-dev
commit f2e484344ac8e77f8ffe104529efa679c2af809e
Author: Ian Lake <ilake@google.com>
Date: Mon Jun 24 15:33:43 2019
Call requestApplyInsets before onViewCreated()
Rather than having each Fragment that cares about
insets call requestApplyInsets() themselves, call it
immediately before onViewCreated() - i.e., immediately
after adding the View.
Test: manually tested
BUG: 135945162
Change-Id: I6d40ad3fdac90515ec85b3f63fb867cde11fa8a3
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManagerImpl.java
il...@google.com <il...@google.com> #3
This has been fixed internally and will be available in Fragments 1.2.0-alpha01
ap...@google.com <ap...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-master-dev
commit c7782e3df384027df9484f615880a22d26975f18
Author: Ian Lake <ilake@google.com>
Date: Wed Jul 10 10:53:39 2019
Fall back to commitAllowingStateLoss() on ISE
When FragmentPagerAdapter or FragmentStatePagerAdapter
runs finishUpdate() in response to a measure/layout
pass, it runs commitNowAllowingStateLoss() as all
normal devices don't do measure/layout while processing
pending FragmentTransactions.
However, with b/135945162 , FragmentManager does call
requestApplyInsets() as part of processing Fragments.
This gets posted on real devices, but Robolectric will
run it inline, causing this to throw an
IllegalStateException. To ensure that Robolectric
continues to work, we can call commitAllowingStateLoss()
in this particular case to ensure that it runs even
while pending FragmentTransactions are being processed.
Test: manual testing
Fixes: 137201343
Change-Id: I62b6312ffbd754af6c6bedf0f1adc30c40641575
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentPagerAdapter.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentStatePagerAdapter.java
https://android-review.googlesource.com/1013911
https://goto.google.com/android-sha1/c7782e3df384027df9484f615880a22d26975f18
Branch: androidx-master-dev
commit c7782e3df384027df9484f615880a22d26975f18
Author: Ian Lake <ilake@google.com>
Date: Wed Jul 10 10:53:39 2019
Fall back to commitAllowingStateLoss() on ISE
When FragmentPagerAdapter or FragmentStatePagerAdapter
runs finishUpdate() in response to a measure/layout
pass, it runs commitNowAllowingStateLoss() as all
normal devices don't do measure/layout while processing
pending FragmentTransactions.
However, with
requestApplyInsets() as part of processing Fragments.
This gets posted on real devices, but Robolectric will
run it inline, causing this to throw an
IllegalStateException. To ensure that Robolectric
continues to work, we can call commitAllowingStateLoss()
in this particular case to ensure that it runs even
while pending FragmentTransactions are being processed.
Test: manual testing
Fixes: 137201343
Change-Id: I62b6312ffbd754af6c6bedf0f1adc30c40641575
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentPagerAdapter.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentStatePagerAdapter.java
Description
Version used: 1.1.0-beta01
When a new Fragment is added, developers need to manually call ViewCompat.requestApplyInsets() (or the equivalent framework APIs) in order for the new View to get the correct insets set on the container.
FragmentManager should do that for you.