pull/1319/head 3.21.090920
gedoor 3 years ago
parent 805120d76a
commit a95804c153
  1. 6
      app/src/main/java/io/legado/app/model/webBook/SearchModel.kt
  2. 1
      app/src/main/java/io/legado/app/ui/book/search/SearchViewModel.kt

@ -91,11 +91,11 @@ class SearchModel(private val scope: CoroutineScope, private val callBack: CallB
} }
@Synchronized @Synchronized
private fun onSuccess(searchId: Long, searchBooks: ArrayList<SearchBook>) { private fun onSuccess(searchId: Long, items: ArrayList<SearchBook>) {
if (searchId == mSearchId) { if (searchId == mSearchId) {
appDb.searchBookDao.insert(*items.toTypedArray())
val precision = appCtx.getPrefBoolean(PreferKey.precisionSearch) val precision = appCtx.getPrefBoolean(PreferKey.precisionSearch)
appDb.searchBookDao.insert(*searchBooks.toTypedArray()) mergeItems(scope, items, precision)
mergeItems(scope, searchBooks, precision)
callBack.onSearchSuccess(searchBooks) callBack.onSearchSuccess(searchBooks)
} }
} }

@ -59,6 +59,7 @@ class SearchViewModel(application: Application) : BaseViewModel(application), Se
isLoading = true isLoading = true
} }
@Synchronized
override fun onSearchSuccess(searchBooks: ArrayList<SearchBook>) { override fun onSearchSuccess(searchBooks: ArrayList<SearchBook>) {
this.searchBooks = searchBooks this.searchBooks = searchBooks
upAdapter() upAdapter()

Loading…
Cancel
Save