From cc8212ac8cf74ed43458785b0d4c65673c7836ae Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 28 Aug 2019 08:11:03 +0800 Subject: [PATCH] up --- .../main/java/io/legado/app/ui/search/SearchViewModel.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/search/SearchViewModel.kt b/app/src/main/java/io/legado/app/ui/search/SearchViewModel.kt index e8276db87..33381933b 100644 --- a/app/src/main/java/io/legado/app/ui/search/SearchViewModel.kt +++ b/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() }