pull/84/head
kunfei 5 years ago
parent bed1bc8f7a
commit 0ff380e183
  1. 3
      app/src/main/java/io/legado/app/ui/changecover/ChangeCoverViewModel.kt

@ -8,7 +8,6 @@ import io.legado.app.help.AppConfig
import io.legado.app.help.coroutine.Coroutine import io.legado.app.help.coroutine.Coroutine
import io.legado.app.model.WebBook import io.legado.app.model.WebBook
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.asCoroutineDispatcher import kotlinx.coroutines.asCoroutineDispatcher
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import java.util.concurrent.Executors import java.util.concurrent.Executors
@ -49,7 +48,7 @@ class ChangeCoverViewModel(application: Application) : BaseViewModel(application
App.db.searchBookDao().insert(searchBook) App.db.searchBookDao().insert(searchBook)
callBack?.adapter?.let { adapter -> callBack?.adapter?.let { adapter ->
if (!adapter.getItems().contains(searchBook)) { if (!adapter.getItems().contains(searchBook)) {
withContext(Main) { withContext(Dispatchers.Main) {
adapter.addItem(searchBook) adapter.addItem(searchBook)
} }
} }

Loading…
Cancel
Save