From e1e3ec1dda427cbca7257f8da6570aa771cc929b Mon Sep 17 00:00:00 2001 From: gedoor Date: Tue, 15 Dec 2020 16:06:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=97=E8=A1=A8=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ui/book/search/SearchActivity.kt | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) 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 34a947270..7aa11f1c5 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 @@ -44,7 +44,7 @@ class SearchActivity : VMBaseActivity>? = null private var bookData: LiveData>? = null private var menu: Menu? = null @@ -57,7 +57,7 @@ class SearchActivity : VMBaseActivity startActivity() @@ -99,8 +99,8 @@ class SearchActivity : VMBaseActivity - if (!hasFocus && serchView.query.toString().trim().isEmpty()) { + searchView.setOnQueryTextFocusChangeListener { _, hasFocus -> + if (!hasFocus && searchView.query.toString().trim().isEmpty()) { finish() } else { openOrCloseHistory(hasFocus) @@ -207,9 +207,9 @@ class SearchActivity : VMBaseActivity { - serchView.setQuery(key, true) + searchView.query.toString() == key -> { + searchView.setQuery(key, true) } withContext(IO) { App.db.bookDao.findByName(key).isEmpty() } -> { - serchView.setQuery(key, true) + searchView.setQuery(key, true) } else -> { - serchView.setQuery(key, false) + searchView.setQuery(key, false) } } }