Fixed
Status Update
Comments
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #2
jb...@google.com <jb...@google.com> #3
I suspect that we're just not setting the default state to be capped at STARTED and you'd see the same oscillation with setUserVisibleHint(). We should just fix it for both cases though
Description
Version used: 1.3.0-alpha04
Devices/Android versions reproduced on: any version
Since all the extension functions for Fragment result API are not "inline", calling setFragmentResultListener requires a double listener allocation: one for the Function2 passed to the extension function, and one for the actual FragmentResultListener that wraps Function2.
This applies for both Fragment.kt and FragmentResultOwner.kt files.
The fix is straightforward: mark the functions as "inline" and the listeners as "crossinline".
Now only the FragmentResultListener will be allocated.