Last active
April 14, 2022 05:08
Revisions
-
chanzmao revised this gist
Sep 7, 2021 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,3 @@ /** * Launches a new coroutine and repeats `block` every time the Fragment's viewLifecycleOwner * is in and out of `minActiveState` lifecycle state. -
chanzmao revised this gist
Sep 6, 2021 . No changes.There are no files selected for viewing
-
chanzmao revised this gist
Sep 6, 2021 . No changes.There are no files selected for viewing
-
chanzmao revised this gist
Sep 6, 2021 . No changes.There are no files selected for viewing
-
chanzmao created this gist
Sep 6, 2021 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ // https://sourcegraph.com/github.com/google/iosched/-/blob/mobile/src/main/java/com/google/samples/apps/iosched/util/UiUtils.kt?L56-69 /** * Launches a new coroutine and repeats `block` every time the Fragment's viewLifecycleOwner * is in and out of `minActiveState` lifecycle state. */ inline fun Fragment.launchAndRepeatWithViewLifecycle( minActiveState: Lifecycle.State = Lifecycle.State.STARTED, crossinline block: suspend CoroutineScope.() -> Unit ) { viewLifecycleOwner.lifecycleScope.launch { viewLifecycleOwner.lifecycle.repeatOnLifecycle(minActiveState) { block() } } }