Fixed
Status Update
Comments
il...@google.com <il...@google.com>
jb...@google.com <jb...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 92bd7222fcfd7523e8fa80b7f72e967b8bbf4750
Author: Ian Lake <ilake@google.com>
Date: Tue Aug 27 10:07:52 2019
Split LifecycleCallbacks from FragmentManager
Create a separate FragmentLifecycleCallbacksDispatcher
object that is responsible for dispatching
FragmentLifecycleCallbacks events.
Test: existing FragmentLifecycleTest pass
BUG: 139536619
Change-Id: I64cc2b364af65760b0008efb317a742df2c0718d
A fragment/fragment/src/main/java/androidx/fragment/app/FragmentLifecycleCallbacksDispatcher.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManager.java
https://android-review.googlesource.com/1110155
https://goto.google.com/android-sha1/92bd7222fcfd7523e8fa80b7f72e967b8bbf4750
Branch: androidx-master-dev
commit 92bd7222fcfd7523e8fa80b7f72e967b8bbf4750
Author: Ian Lake <ilake@google.com>
Date: Tue Aug 27 10:07:52 2019
Split LifecycleCallbacks from FragmentManager
Create a separate FragmentLifecycleCallbacksDispatcher
object that is responsible for dispatching
FragmentLifecycleCallbacks events.
Test: existing FragmentLifecycleTest pass
BUG: 139536619
Change-Id: I64cc2b364af65760b0008efb317a742df2c0718d
A fragment/fragment/src/main/java/androidx/fragment/app/FragmentLifecycleCallbacksDispatcher.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManager.java
jb...@google.com <jb...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 092d14cd22c174405221b930665869f7c9fc8b65
Author: Ian Lake <ilake@google.com>
Date: Tue Aug 27 14:46:02 2019
Remove FragmentState mInstance
Make FragmentState a simple Parcelable by removing
its mInstance field and its instantiate() method.
This required we change the order of restoring:
instead of reconnecting retained Fragments with their
FragmentState instances, we first iterate through
all FragmentState instances and do one of two things:
1) Reconnect the retained fragment if it exists
2) Create a new fragment from the FragmentState
This allows us to do just one pass through our
FragmentState objects and run the edge case of
detecting retained fragments created after the
state was saved after creating the set of active
fragments.
Test: all existing tests pass
BUG: 139536619
Change-Id: Iba7cc300c127bc05127d122fa5acc1ccc871a76b
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManager.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManagerViewModel.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentState.java
https://android-review.googlesource.com/1108716
https://goto.google.com/android-sha1/092d14cd22c174405221b930665869f7c9fc8b65
Branch: androidx-master-dev
commit 092d14cd22c174405221b930665869f7c9fc8b65
Author: Ian Lake <ilake@google.com>
Date: Tue Aug 27 14:46:02 2019
Remove FragmentState mInstance
Make FragmentState a simple Parcelable by removing
its mInstance field and its instantiate() method.
This required we change the order of restoring:
instead of reconnecting retained Fragments with their
FragmentState instances, we first iterate through
all FragmentState instances and do one of two things:
1) Reconnect the retained fragment if it exists
2) Create a new fragment from the FragmentState
This allows us to do just one pass through our
FragmentState objects and run the edge case of
detecting retained fragments created after the
state was saved after creating the set of active
fragments.
Test: all existing tests pass
BUG: 139536619
Change-Id: Iba7cc300c127bc05127d122fa5acc1ccc871a76b
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManager.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManagerViewModel.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentState.java
ap...@google.com <ap...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 66d98b470d8887fdd16461c2da0df69ec62dd8d8
Author: Ian Lake <ilake@google.com>
Date: Fri Aug 16 13:22:20 2019
Add skeleton for FragmentStateManager
Store a HashMap of mWho to FragmentStateManager
instances. This serves as the minimal starting
point for moving logic that interacts with a
single Fragment from FragmentManager into
FragmentStateManager.
Test: existing tests pass, new FragmentStateManagerTest
BUG: 139536619
Change-Id: Ifaea272a3202e918143f65245fb98157ad971827
A fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentStateManagerTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/BackStackState.java
M fragment/fragment/src/main/java/androidx/fragment/app/Fragment.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManager.java
A fragment/fragment/src/main/java/androidx/fragment/app/FragmentStateManager.java
https://android-review.googlesource.com/1109796
https://goto.google.com/android-sha1/66d98b470d8887fdd16461c2da0df69ec62dd8d8
Branch: androidx-master-dev
commit 66d98b470d8887fdd16461c2da0df69ec62dd8d8
Author: Ian Lake <ilake@google.com>
Date: Fri Aug 16 13:22:20 2019
Add skeleton for FragmentStateManager
Store a HashMap of mWho to FragmentStateManager
instances. This serves as the minimal starting
point for moving logic that interacts with a
single Fragment from FragmentManager into
FragmentStateManager.
Test: existing tests pass, new FragmentStateManagerTest
BUG: 139536619
Change-Id: Ifaea272a3202e918143f65245fb98157ad971827
A fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentStateManagerTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/BackStackState.java
M fragment/fragment/src/main/java/androidx/fragment/app/Fragment.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManager.java
A fragment/fragment/src/main/java/androidx/fragment/app/FragmentStateManager.java
il...@google.com <il...@google.com> #5
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 92d322f39a3436da8ce0e59f55194c70abe1fb8e
Author: Ian Lake <ilake@google.com>
Date: Tue Aug 27 16:46:05 2019
Move saving/restore Fragment state to FragmentStateManager
Separate the saving and restoring of Fragment
instances from FragmentManager, allowing
FragmentStateManager to fully manage the
restoration of Fragments.
Test: new FragmentStateManagerTest, existing tests
BUG: 139536619
Change-Id: Iba0df8f617d7805995612eaad52e26f5f2e99707
M fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentStateManagerTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManager.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentStateManager.java
https://android-review.googlesource.com/1109797
https://goto.google.com/android-sha1/92d322f39a3436da8ce0e59f55194c70abe1fb8e
Branch: androidx-master-dev
commit 92d322f39a3436da8ce0e59f55194c70abe1fb8e
Author: Ian Lake <ilake@google.com>
Date: Tue Aug 27 16:46:05 2019
Move saving/restore Fragment state to FragmentStateManager
Separate the saving and restoring of Fragment
instances from FragmentManager, allowing
FragmentStateManager to fully manage the
restoration of Fragments.
Test: new FragmentStateManagerTest, existing tests
BUG: 139536619
Change-Id: Iba0df8f617d7805995612eaad52e26f5f2e99707
M fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentStateManagerTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManager.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentStateManager.java
Description
When using the new state manager released in fragment 1.3.0-alpha08, if you manually (without using the hide/show fragment transactions) set the visibility state of your view after the SpecialEffectsController has started any animations/transitions on your view, the visibility changes are ignored.
The reason this happens is because the new state manager saves the visibility state of the view in
onViewCreated()
as the final state and then restores that visibility state once the special effect completes afteronStart()
. This means that any changes made by the user to the view visibility state betweenonViewCreate()
andonStart()
are completely ignored.This becomes apparent in two particular cases:
There is a fragment that is always added, but has its visibility state updated based on some internal data (i.e. an error screen that is set to
View.INVISIBLE
when there is no error andView.VISIBLE
when there is one). If the view state changes toINVISIBLE
inonStart()
, the fragment should not be shown once the add transaction completes.A entering fragment is postponed and while it is postponed, its view visibility state is set to
View.INVISIBLE
. Even once the fragment is no longer postponed, its view should still beINVISIBLE
until the user changes it again manually.The new state manager should defer view visibility state control to the user no matter when the state is changed. Doing so would ensure that the user always has the source of truth for their Fragment's view visibility.