Fixed
Status Update
Comments
il...@google.com <il...@google.com>
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.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).
ap...@google.com <ap...@google.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
Description
Version used: 1.2.4
Devices/Android versions reproduced on: any
Fragment.getDefaultViewModelProviderFactory() makes a call to requireActivity() in order to obtain an instance of Application. This will fail if the Fragment is hosted in a FragmentHostCallback that doesn't reference an Activity (i.e. its context is not an Activity). getDefaultViewModelProviderFactory() and onCreateContextMenu() (which doesn't make sense for non-Activity Fragments) are the only places requireActivity() is used. Everywhere else uses get/requireContext() or allows getActivity() to return null.
Because Fragments are so prevalent, this makes the entire HasDefaultViewModelProviderFactory interface untrustworthy in codebases that may have non-Activity Fragments.
A simple fix would be to return a NewInstanceFactory() if mFragmentManager is non-null but getActivity() is null. This wouldn't support AndroidViewModels, but other ViewModels would still be able to be instantiated. Expanding SavedStateViewModelFactory to not require an Application would also help since the SavedStateHandler infrastructure doesn't appear to require the Application for anything else. Ideally, the Application would be able to be obtained elsewhere for non-Activity Fragments, but not supporting AndroidViewModels would be an acceptable trade off if that's not possible.
A less ideal solution would be to add another constructor to AndroidViewModels that takes a Context for use when an Application is not available, but that would clutter the API and is probably not worth it.