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