pull/1649/head
kunfei 3 years ago
parent a0c287550f
commit 797e236bf3
  1. 2
      app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt
  2. 5
      app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceViewModel.kt

@ -27,6 +27,7 @@ import io.legado.app.ui.book.source.manage.BookSourceActivity
import io.legado.app.ui.widget.recycler.VerticalDivider
import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
@ -145,6 +146,7 @@ class ChangeSourceDialog() : BaseDialogFragment(R.layout.dialog_change_source),
viewModel.searchDataFlow
.collect {
adapter.setItems(it)
delay(1000)
}
appDb.bookSourceDao.flowGroupEnabled().collect {
groups.clear()

@ -21,7 +21,6 @@ import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.ExecutorCoroutineDispatcher
import kotlinx.coroutines.asCoroutineDispatcher
import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.callbackFlow
import kotlinx.coroutines.flow.conflate
import kotlinx.coroutines.flow.flowOn
@ -82,9 +81,7 @@ class ChangeSourceViewModel(application: Application) : BaseViewModel(applicatio
}
}.conflate()
.map {
val data = searchBooks.sortedBy { it.originOrder }
delay(1000)
data
searchBooks.sortedBy { it.originOrder }
}.flowOn(IO)
@Volatile

Loading…
Cancel
Save