repeatWhenAttached
This new View extension function replaces WindowAddedViewLifecycleOwner and is intended for use with views that are not part of an activity. It is more correct because it properly disposes itself and stops all previously launched coroutines/jobs when the view is detached from its view hierarchy. Test: Extensive unit tests included. Also tested manually making sure that there are no crashes and that jobs scheduled by a view-binder are properly cleaned up when the view is detached and replaced by a different view when changing device configuration using: $ adb shell wm density 1000 Bug: 235403546 Change-Id: Ied36c9e1735333c482fc82cfbe28e665083795ae
Loading
Please register or sign in to comment