pull/32/head
kunfei 5 years ago
parent f4a21709e5
commit cc8212ac8c
  1. 6
      app/src/main/java/io/legado/app/ui/search/SearchViewModel.kt

@ -35,11 +35,13 @@ class SearchViewModel(application: Application) : BaseViewModel(application) {
.timeout(30000L)
.onSuccess(Dispatchers.IO) {
it?.let { list ->
App.db.searchBookDao().insert(*list.toTypedArray())
list.map { searchBook ->
if (searchBook.name.contains(key) || searchBook.author.contains(key))
App.db.searchBookDao().insert(searchBook)
}
}
}
}
}.onError {
it.printStackTrace()
}

Loading…
Cancel
Save