Browse Source

Improve View.scope util property

merge-requests/382/head
Geoffrey Métais 7 years ago
parent
commit
8b1c02ee7d
  1. 6
      vlc-android/src/org/videolan/vlc/util/Kextensions.kt

6
vlc-android/src/org/videolan/vlc/util/Kextensions.kt

@ -213,7 +213,11 @@ fun generateResolutionClass(width: Int, height: Int) : String? = if (width <= 0
}
val View.scope : CoroutineScope
get() = context as? CoroutineScope ?: AppScope
get() = when(val ctx = context) {
is CoroutineScope -> ctx
is LifecycleOwner -> ctx.lifecycleScope
else -> AppScope
}
fun Activity.manageHttpException(e: Exception) {
when (e) {

Loading…
Cancel
Save