|
|
@@ -1,14 +1,26 @@
|
|
|
package io.legado.app.help.coroutine
|
|
|
|
|
|
import io.legado.app.utils.printOnDebug
|
|
|
-import kotlinx.coroutines.*
|
|
|
-
|
|
|
+import kotlinx.coroutines.CancellationException
|
|
|
+import kotlinx.coroutines.CompletionHandler
|
|
|
+import kotlinx.coroutines.CoroutineScope
|
|
|
+import kotlinx.coroutines.CoroutineStart
|
|
|
+import kotlinx.coroutines.Dispatchers
|
|
|
+import kotlinx.coroutines.DisposableHandle
|
|
|
+import kotlinx.coroutines.Job
|
|
|
+import kotlinx.coroutines.MainScope
|
|
|
+import kotlinx.coroutines.ensureActive
|
|
|
+import kotlinx.coroutines.isActive
|
|
|
+import kotlinx.coroutines.launch
|
|
|
+import kotlinx.coroutines.plus
|
|
|
+import kotlinx.coroutines.withContext
|
|
|
+import kotlinx.coroutines.withTimeout
|
|
|
import kotlin.coroutines.CoroutineContext
|
|
|
|
|
|
/**
|
|
|
* 链式协程
|
|
|
*/
|
|
|
-@Suppress("unused")
|
|
|
+@Suppress("unused", "MemberVisibilityCanBePrivate")
|
|
|
class Coroutine<T>(
|
|
|
val scope: CoroutineScope,
|
|
|
context: CoroutineContext = Dispatchers.IO,
|