mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-22 12:38:00 +01:00
reordering some search related things, do not trigger search at opening
This commit is contained in:
parent
4217d53697
commit
bb48612293
2 changed files with 17 additions and 17 deletions
|
@ -17,7 +17,7 @@ insert_final_newline = true
|
||||||
charset = utf-8
|
charset = utf-8
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
continuation_indent_size = 8
|
continuation_indent_size = 4
|
||||||
|
|
||||||
[*.xml]
|
[*.xml]
|
||||||
continuation_indent_size = 4
|
continuation_indent_size = 4
|
||||||
|
|
|
@ -76,22 +76,6 @@ class SearchActivity : SimpleActivity(), MediaOperationsListener {
|
||||||
private fun setupSearch(menu: Menu) {
|
private fun setupSearch(menu: Menu) {
|
||||||
val searchManager = getSystemService(Context.SEARCH_SERVICE) as SearchManager
|
val searchManager = getSystemService(Context.SEARCH_SERVICE) as SearchManager
|
||||||
mSearchMenuItem = menu.findItem(R.id.search)
|
mSearchMenuItem = menu.findItem(R.id.search)
|
||||||
(mSearchMenuItem?.actionView as? SearchView)?.apply {
|
|
||||||
setSearchableInfo(searchManager.getSearchableInfo(componentName))
|
|
||||||
isSubmitButtonEnabled = false
|
|
||||||
setOnQueryTextListener(object : SearchView.OnQueryTextListener {
|
|
||||||
override fun onQueryTextSubmit(query: String) = false
|
|
||||||
|
|
||||||
override fun onQueryTextChange(newText: String): Boolean {
|
|
||||||
if (mIsSearchOpen) {
|
|
||||||
mLastSearchedText = newText
|
|
||||||
textChanged(newText)
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
MenuItemCompat.setOnActionExpandListener(mSearchMenuItem, object : MenuItemCompat.OnActionExpandListener {
|
MenuItemCompat.setOnActionExpandListener(mSearchMenuItem, object : MenuItemCompat.OnActionExpandListener {
|
||||||
override fun onMenuItemActionExpand(item: MenuItem?): Boolean {
|
override fun onMenuItemActionExpand(item: MenuItem?): Boolean {
|
||||||
mIsSearchOpen = true
|
mIsSearchOpen = true
|
||||||
|
@ -108,6 +92,22 @@ class SearchActivity : SimpleActivity(), MediaOperationsListener {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
mSearchMenuItem?.expandActionView()
|
mSearchMenuItem?.expandActionView()
|
||||||
|
|
||||||
|
(mSearchMenuItem?.actionView as? SearchView)?.apply {
|
||||||
|
setSearchableInfo(searchManager.getSearchableInfo(componentName))
|
||||||
|
isSubmitButtonEnabled = false
|
||||||
|
setOnQueryTextListener(object : SearchView.OnQueryTextListener {
|
||||||
|
override fun onQueryTextSubmit(query: String) = false
|
||||||
|
|
||||||
|
override fun onQueryTextChange(newText: String): Boolean {
|
||||||
|
if (mIsSearchOpen) {
|
||||||
|
mLastSearchedText = newText
|
||||||
|
textChanged(newText)
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun textChanged(text: String) {
|
private fun textChanged(text: String) {
|
||||||
|
|
Loading…
Reference in a new issue