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()