From 527b8f25a065c09304a17a98cf2610e89611046f Mon Sep 17 00:00:00 2001 From: Administrator Date: Thu, 16 Jan 2020 13:42:12 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B9=A6=E7=B1=8D?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E2=80=9C=E7=B2=BE=E5=87=86=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/ui/book/search/SearchViewModel.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 6bca4a5f4..1a695cccd 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 @@ -72,8 +72,8 @@ class SearchViewModel(application: Application) : BaseViewModel(application) { val books = arrayListOf() searchBooks.forEach { searchBook -> if (context.getPrefBoolean(PreferKey.precisionSearch)) { - if (searchBook.name.contains(searchKey) - || searchBook.author.contains(searchKey) + if (searchBook.name.equals(searchKey, true) + || searchBook.author.equals(searchKey, true) ) books.add(searchBook) } else books.add(searchBook) From 5ed5352634b49555e7a1bebba7f861ddcc441885 Mon Sep 17 00:00:00 2001 From: Administrator Date: Thu, 16 Jan 2020 14:03:54 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E9=9A=8FmenuItem=E7=82=B9=E5=87=BB=E5=88=B7?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/ui/book/search/SearchActivity.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt b/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt index 2cf9cae3d..ae44ddaad 100644 --- a/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt @@ -76,6 +76,9 @@ class SearchActivity : VMBaseActivity(R.layout.activity_book_se !getPrefBoolean(PreferKey.precisionSearch) ) precisionSearchMenuItem?.isChecked = getPrefBoolean(PreferKey.precisionSearch) + search_view.query.toString().trim()?.let { + search_view.setQuery(it, true) + } } R.id.menu_source_manage -> startActivity() else -> if (item.groupId == R.id.source_group) { @@ -85,6 +88,9 @@ class SearchActivity : VMBaseActivity(R.layout.activity_book_se } else { putPrefString("searchGroup", item.title.toString()) } + search_view.query.toString().trim()?.let { + search_view.setQuery(it, true) + } } } return super.onCompatOptionsItemSelected(item)