搜索结果界面:按返回键关闭搜索界面

pull/1572/head
Xwite 3 years ago
parent b68cc7b4d9
commit ab913a304c
  1. 7
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  2. 5
      app/src/main/java/io/legado/app/ui/book/read/SearchMenu.kt

@ -382,6 +382,12 @@ class ReadBookActivity : BaseReadBookActivity(),
binding.readView.pageDelegate?.keyTurnPage(PageDirection.NEXT) binding.readView.pageDelegate?.keyTurnPage(PageDirection.NEXT)
return true return true
} }
keyCode == KeyEvent.KEYCODE_BACK -> {
if (isShowingSearchResult) {
exitSearchMenu()
return true
}
}
} }
return super.onKeyDown(keyCode, event) return super.onKeyDown(keyCode, event)
} }
@ -807,6 +813,7 @@ class ReadBookActivity : BaseReadBookActivity(),
if (isShowingSearchResult) { if (isShowingSearchResult) {
isShowingSearchResult = false isShowingSearchResult = false
binding.searchMenu.invalidate() binding.searchMenu.invalidate()
binding.searchMenu.invisible()
} }
} }

@ -119,7 +119,7 @@ class SearchMenu @JvmOverloads constructor(
} }
private fun bindEvent() = binding.run { private fun bindEvent() = binding.run {
//搜索结果
llSearchResults.setOnClickListener { llSearchResults.setOnClickListener {
runMenuOut { runMenuOut {
callBack.openSearchActivity(selectedSearchResult?.query) callBack.openSearchActivity(selectedSearchResult?.query)
@ -134,11 +134,10 @@ class SearchMenu @JvmOverloads constructor(
} }
} }
//目录 //退出
llSearchExit.setOnClickListener { llSearchExit.setOnClickListener {
runMenuOut { runMenuOut {
callBack.exitSearchMenu() callBack.exitSearchMenu()
this@SearchMenu.invisible()
} }
} }

Loading…
Cancel
Save