Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Yigit, do you have time to fix it?
reemission of the same liveData is racy
reemission of the same liveData is racy
ap...@google.com <ap...@google.com> #3
yea i'll take it.
jb...@google.com <jb...@google.com> #4
Thanks for the detailed analysis. This may not be an issue anymore since we've started using Main.immediate there but I' not sure; I'll try to create a test case.
Description
Component used: Fragment
Version used: 1.3.0-alpha02
Devices/Android versions reproduced on: all
The changes introduced into DialogFragment in version 1.3.0-alpha02 are causing BottomSheetDialogFragment to not be display properly. Instead of the Dialog being full screen width, it is a centered, floating dialog.
This reason for this is the recent changes use observe() with a LifecycleObserver on the DialogFragment's viewLifecycleOwnerLiveData , and calls setContentView in the observer's onChanged, instead of in the deprecated onActivityCreated() . But because it uses observe, the observer is not active until the LifecycleOwner is started, so onChanged is not called until the Dialog is started, which means it is shown before setContentView is called.
Instead of observe, the viewLifecycleOwnereLiveData should use observeForever() so that the observer can receive events before the LifecycleOwner is started.