Fixed
Status Update
Comments
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #2
Hi Ed, Thank you so much for these suggestions. I've been reviewing them and merging them in. Hopefully it should be live. I've included a thank you note too in the article.
an...@google.com <an...@google.com> #3
Great! Thanks a lot, I'll look for the live updates soon!
jb...@google.com <jb...@google.com> #4
This has been addressed internally and will be available in the Fragment 1.2.4 and 1.3.0-alpha03 releases.
il...@google.com <il...@google.com> #5
Specifically, because DialogFragments cannot go onto the FragmentManager back stack, it makes no effective difference on whether you use this
or viewLifecycleOwner
for a DialogFragment, so the Lint check to verify that you're using the right one is unnecessary.
Description
Version used: 1.2.2
Devices/Android versions reproduced on: Pixel 3 running Android 10
If a DialogFragment doesn't return a View in onCreateView then onViewCreated isn't called. In such case if one tries to use viewLifecycleOwner he's probably doing it in onCreateDialog or earlier. But using viewLifecycleOwner isn't possible before view is created. There is a lint error with a message that explains that. But this message doesn't take into account that it's a DialogFragment which should be treated differently (viewLifecycleOwner shouldn't be used). It would be good to detect that viewLifecycleOwner is being used in DialogFragment and show a better message.