Assigned
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 4ba20c0183e46f83483af4a8019ad6fb84d1c0c2
Author: Ian Lake <ilake@google.com>
Date: Wed Jun 03 10:46:12 2020
Request Insets only once the Fragment's View is attached
Instead of unconditionally calling
requestApplyInsets() directly before onViewCreated(),
we should always wait for the View to be attached
to its window so that requestApplyInsets() actually
works correctly for every Fragment.
This is a half step towards the final solution in
b/149024125 in delaying onViewCreated() until
the View is attached.
Test: tested in sample app
BUG: 158095749
Change-Id: Ie187051553437d77fd788ece52d8ec083e29f2e4
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentStateManager.java
https://android-review.googlesource.com/1323649
Branch: androidx-master-dev
commit 4ba20c0183e46f83483af4a8019ad6fb84d1c0c2
Author: Ian Lake <ilake@google.com>
Date: Wed Jun 03 10:46:12 2020
Request Insets only once the Fragment's View is attached
Instead of unconditionally calling
requestApplyInsets() directly before onViewCreated(),
we should always wait for the View to be attached
to its window so that requestApplyInsets() actually
works correctly for every Fragment.
This is a half step towards the final solution in
the View is attached.
Test: tested in sample app
BUG: 158095749
Change-Id: Ie187051553437d77fd788ece52d8ec083e29f2e4
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentStateManager.java
ar...@gmail.com <ar...@gmail.com> #3
👍👍👍👍
Description
Component used: Fragment Version used: 1.2.1
The default flow for Views (outside of the Fragment world) is that they are always attached before having their state restored.
However, Fragments currently do not wait for the view to be attached before continuing through to
onViewCreated()
andonViewStateRestored()
. This leads to cases where sometimes they are attached (i.e., you've done a Fragment transaction when your Activity is resumed) and sometimes they are not attached (when doing a FragmentTransaction in your Activity'sonCreate()
).This means that the fix for requesting insets only sometimes works and other times it does not.
It also means that if we made this change that Views that expect to be attached before having their view state restored would be able to guarantee that this invariant holds for Fragments.