Replace Picasso with Glide

This commit is contained in:
Kirill Kamakin
2022-04-18 13:17:07 +02:00
parent 96bce0e5f4
commit 2686f757ea
19 changed files with 99 additions and 122 deletions

View File

@@ -2,11 +2,15 @@ package gq.kirmanak.mealient.extensions
import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
inline fun <T> Fragment.collectWithViewLifecycle(
inline fun <T> Fragment.collectWhenViewResumed(
flow: Flow<T>,
crossinline collector: suspend (T) -> Unit,
) = viewLifecycleOwner.lifecycleScope.launch { flow.collect(collector) }
) = launchWhenViewResumed { flow.collect(collector) }
fun Fragment.launchWhenViewResumed(
block: suspend CoroutineScope.() -> Unit,
) = viewLifecycleOwner.lifecycleScope.launchWhenResumed(block)