Status Update
Comments
se...@google.com <se...@google.com>
dh...@gmail.com <dh...@gmail.com> #2
Jeremy, is this still an issue? I think the problem was that you had two transitions targeting the same View for the same action (e.g. two Slide() transitions).
il...@google.com <il...@google.com> #3
I have a similar issue with plain AnimatorSet:
set.start()
set.pause()
set.setCurrentPlayTime(100)
set.setCurrentPlayTime(0)
set.setCurrentPlayTime(100)
set.resume()
doesn't play animation in resume().
ap...@google.com <ap...@google.com> #4
Should clarify that if I filter out setCurrentPlayTime(0)
(or replace it with setCurrentPlayTime(1)
) it works well.
Also even with setCurrentPlayTime(0)
, onAnimationEnd
is notified with correct delay (as if the animation has played).
dh...@gmail.com <dh...@gmail.com> #5
@
I think that is intended for Animator. If you set the currentPlayTime
to 0 or the total duration the animator completes. We do some
il...@google.com <il...@google.com> #6
Did some investigation on the Fragment side and it seems like the merged transition is targeting correctly.
Exiting Transition: Slide@aa9288e: tgts(android.widget.LinearLayout{f9add3d})
>>>>> ExitingViews <<<<<
View: android.widget.LinearLayout{f9add3d}
Entering Transition: Slide@35b8af: tgts(android.widget.LinearLayout{b7f24bc})
>>>>> EnteringViews <<<<<
View: android.widget.LinearLayout{b7f24bc}
Final merged transition: TransitionSet@7bc1c45:
TransitionSet@e133f9a:
Slide@aa9288e: tgts(android.widget.LinearLayout{f9add3d})
Slide@35b8af: tgts(android.widget.LinearLayout{b7f24bc})
merged transition passed to controlDelayedTransition: TransitionSet@7bc1c45:
TransitionSet@e133f9a:
Slide@aa9288e: tgts(android.widget.LinearLayout{f9add3d})
Slide@35b8af: tgts(android.widget.LinearLayout{b7f24bc})
Still digging.
Description
Devices/Android versions reproduced on: robolectric, emulator, real devices
I have an activity, and a fragment in it (MasterFragment).
Than I add nested fragment (NestedFragmentWithViewModel) to a MasterFragment.
NestedFragmentWithViewModel obtains viewmodel by `ViewModelProviders.of(this)`
Than I replace it (with adding to a backstack) with another fragment (NestedFragment).
After that, activity gets recreated, which is causing:
- MasterFragment to recrete
- NestedFragment (as it is on top of backstack) to recreate
After that, activity gets destroyed, which is causing:
- MasterFragment to destroy and clear its ViewModelStore
- NestedFragment to destroy and clear its ViewModelStore
But no one cares neither about NestedFragmentWithViewModel in the backstack, nor about clearing its ViewModelStore.
It is not cleared when fragment is added to a backstack (cause backstack can be popped to show fragment again).
And it is not cleared when MasterFragment destroys, cause it calls onDestroy on all its 'created' nested fragments, but fragments in a backstack were not created after activity get recreated, so should not be destroyed.
Fragment's ViewModelStore is cleared in fragment's onDestroy() in case activity.isFinishing(). That never happens so, whole ViewModelStore gets leaked.
It is not a totally FragmentManager issue, cause its respects lifecycle of fragments - 'what is dead may never die'.
So it seems fragment's logic to clear its ViewModelStore should be fixed.
Project with described scenario is attached.