diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index 136aa71f5..ab35358a1 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt @@ -382,6 +382,12 @@ class ReadBookActivity : BaseReadBookActivity(), binding.readView.pageDelegate?.keyTurnPage(PageDirection.NEXT) return true } + keyCode == KeyEvent.KEYCODE_BACK -> { + if (isShowingSearchResult) { + exitSearchMenu() + return true + } + } } return super.onKeyDown(keyCode, event) } @@ -807,6 +813,7 @@ class ReadBookActivity : BaseReadBookActivity(), if (isShowingSearchResult) { isShowingSearchResult = false binding.searchMenu.invalidate() + binding.searchMenu.invisible() } } diff --git a/app/src/main/java/io/legado/app/ui/book/read/SearchMenu.kt b/app/src/main/java/io/legado/app/ui/book/read/SearchMenu.kt index 74712ea65..53f3b8868 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/SearchMenu.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/SearchMenu.kt @@ -119,7 +119,7 @@ class SearchMenu @JvmOverloads constructor( } private fun bindEvent() = binding.run { - + //搜索结果 llSearchResults.setOnClickListener { runMenuOut { callBack.openSearchActivity(selectedSearchResult?.query) @@ -134,11 +134,10 @@ class SearchMenu @JvmOverloads constructor( } } - //目录 + //退出 llSearchExit.setOnClickListener { runMenuOut { callBack.exitSearchMenu() - this@SearchMenu.invisible() } }