pull/2675/head
kunfei 2 years ago
parent 8ea40e1457
commit 5574399371
  1. 8
      app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt

@ -187,11 +187,11 @@ class SearchActivity : VMBaseActivity<ActivityBookSearchBinding, SearchViewModel
searchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener { searchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
override fun onQueryTextSubmit(query: String?): Boolean { override fun onQueryTextSubmit(query: String?): Boolean {
searchView.clearFocus() searchView.clearFocus()
query?.let { query?.trim()?.let { searchKey ->
isManualStopSearch = false isManualStopSearch = false
viewModel.saveSearchKey(query) viewModel.saveSearchKey(searchKey)
viewModel.searchKey = "" viewModel.searchKey = ""
viewModel.search(it) viewModel.search(searchKey)
} }
visibleInputHelp(false) visibleInputHelp(false)
return true return true
@ -199,7 +199,7 @@ class SearchActivity : VMBaseActivity<ActivityBookSearchBinding, SearchViewModel
override fun onQueryTextChange(newText: String?): Boolean { override fun onQueryTextChange(newText: String?): Boolean {
if (newText.isNullOrBlank()) viewModel.stop() if (newText.isNullOrBlank()) viewModel.stop()
upHistory(newText) upHistory(newText?.trim())
return false return false
} }
}) })

Loading…
Cancel
Save