From 797e236bf3b405283abc32102e804805c391f922 Mon Sep 17 00:00:00 2001 From: kunfei Date: Mon, 21 Feb 2022 15:13:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/book/changesource/ChangeSourceDialog.kt | 2 ++ .../legado/app/ui/book/changesource/ChangeSourceViewModel.kt | 5 +---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt index 2732356f5..e468bce50 100644 --- a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.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() diff --git a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceViewModel.kt b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceViewModel.kt index 197b3f1de..459cc972c 100644 --- a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceViewModel.kt @@ -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