From a95804c15315e515107e6edc17c537bf96aca842 Mon Sep 17 00:00:00 2001 From: gedoor Date: Thu, 9 Sep 2021 20:12:29 +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 --- .../main/java/io/legado/app/model/webBook/SearchModel.kt | 6 +++--- .../java/io/legado/app/ui/book/search/SearchViewModel.kt | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/webBook/SearchModel.kt b/app/src/main/java/io/legado/app/model/webBook/SearchModel.kt index c31509820..8a3fe58a3 100644 --- a/app/src/main/java/io/legado/app/model/webBook/SearchModel.kt +++ b/app/src/main/java/io/legado/app/model/webBook/SearchModel.kt @@ -91,11 +91,11 @@ class SearchModel(private val scope: CoroutineScope, private val callBack: CallB } @Synchronized - private fun onSuccess(searchId: Long, searchBooks: ArrayList) { + private fun onSuccess(searchId: Long, items: ArrayList) { if (searchId == mSearchId) { + appDb.searchBookDao.insert(*items.toTypedArray()) val precision = appCtx.getPrefBoolean(PreferKey.precisionSearch) - appDb.searchBookDao.insert(*searchBooks.toTypedArray()) - mergeItems(scope, searchBooks, precision) + mergeItems(scope, items, precision) callBack.onSearchSuccess(searchBooks) } } diff --git a/app/src/main/java/io/legado/app/ui/book/search/SearchViewModel.kt b/app/src/main/java/io/legado/app/ui/book/search/SearchViewModel.kt index 6f91f224f..0c706734a 100644 --- a/app/src/main/java/io/legado/app/ui/book/search/SearchViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/search/SearchViewModel.kt @@ -59,6 +59,7 @@ class SearchViewModel(application: Application) : BaseViewModel(application), Se isLoading = true } + @Synchronized override fun onSearchSuccess(searchBooks: ArrayList) { this.searchBooks = searchBooks upAdapter()