feat: 优化代码

pull/120/head
kunfei 5 years ago
parent 7fae9506fd
commit 5727d11946
  1. 4
      app/src/main/java/io/legado/app/ui/book/search/SearchViewModel.kt

@ -85,8 +85,8 @@ class SearchViewModel(application: Application) : BaseViewModel(application) {
private fun precisionSearch(searchBooks: List<SearchBook>) {
val books = arrayListOf<SearchBook>()
searchBooks.forEach { searchBook ->
if (searchBook.name.equals(searchKey, true)
|| searchBook.author.equals(searchKey, true)
if (searchBook.name.contains(searchKey, true)
|| searchBook.author.contains(searchKey, true)
) books.add(searchBook)
}
App.db.searchBookDao().insert(*books.toTypedArray())

Loading…
Cancel
Save