pull/2675/head
kunfei 2 years ago
parent 5574399371
commit 5e02358c3c
  1. 10
      app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt
  2. 4
      app/src/main/java/io/legado/app/ui/book/searchContent/SearchContentActivity.kt

@ -185,9 +185,9 @@ class SearchActivity : VMBaseActivity<ActivityBookSearchBinding, SearchViewModel
searchView.queryHint = getString(R.string.search_book_key)
searchView.clearFocus()
searchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
override fun onQueryTextSubmit(query: String?): Boolean {
override fun onQueryTextSubmit(query: String): Boolean {
searchView.clearFocus()
query?.trim()?.let { searchKey ->
query.trim().let { searchKey ->
isManualStopSearch = false
viewModel.saveSearchKey(searchKey)
viewModel.searchKey = ""
@ -197,9 +197,9 @@ class SearchActivity : VMBaseActivity<ActivityBookSearchBinding, SearchViewModel
return true
}
override fun onQueryTextChange(newText: String?): Boolean {
if (newText.isNullOrBlank()) viewModel.stop()
upHistory(newText?.trim())
override fun onQueryTextChange(newText: String): Boolean {
if (newText.isBlank()) viewModel.stop()
upHistory(newText.trim())
return false
}
})

@ -78,12 +78,12 @@ class SearchContentActivity :
searchView.clearFocus()
searchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
override fun onQueryTextSubmit(query: String): Boolean {
startContentSearch(query)
startContentSearch(query.trim())
searchView.clearFocus()
return false
}
override fun onQueryTextChange(newText: String?): Boolean {
override fun onQueryTextChange(newText: String): Boolean {
return false
}
})

Loading…
Cancel
Save