Coroutine timeout

pull/32/head
Administrator 5 years ago
parent 929255a171
commit 0e2636068a
  1. 2
      app/src/main/java/io/legado/app/help/coroutine/Coroutine.kt
  2. 5
      app/src/main/java/io/legado/app/ui/search/SearchViewModel.kt

@ -1,6 +1,5 @@
package io.legado.app.help.coroutine
import android.util.Log
import kotlinx.coroutines.*
class Coroutine<T>(scope: CoroutineScope, private val domain: suspend CoroutineScope.() -> T) {
@ -75,7 +74,6 @@ class Coroutine<T>(scope: CoroutineScope, private val domain: suspend CoroutineS
private suspend fun executeDomain(domain: suspend CoroutineScope.() -> T): T? {
return withContext(Dispatchers.IO) {
Log.e("TAG!", "executeDomain")
domain()
}
}

@ -5,12 +5,7 @@ import android.util.Log
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import io.legado.app.base.BaseViewModel
import io.legado.app.data.api.CommonHttpApi
import io.legado.app.data.entities.SearchBook
import io.legado.app.help.http.HttpHelper
import kotlinx.coroutines.delay
import kotlinx.coroutines.withTimeout
import org.jetbrains.anko.error
class SearchViewModel(application: Application) : BaseViewModel(application) {

Loading…
Cancel
Save