From bb486122937d24850cfa8c27445cdc7215566694 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 15 Feb 2021 22:29:04 +0100 Subject: [PATCH] reordering some search related things, do not trigger search at opening --- .editorconfig | 2 +- .../gallery/pro/activities/SearchActivity.kt | 32 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.editorconfig b/.editorconfig index 1606d61fc..c79c990fb 100644 --- a/.editorconfig +++ b/.editorconfig @@ -17,7 +17,7 @@ insert_final_newline = true charset = utf-8 indent_style = space indent_size = 4 -continuation_indent_size = 8 +continuation_indent_size = 4 [*.xml] continuation_indent_size = 4 diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SearchActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SearchActivity.kt index 769d65e90..450296e20 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SearchActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SearchActivity.kt @@ -76,22 +76,6 @@ class SearchActivity : SimpleActivity(), MediaOperationsListener { private fun setupSearch(menu: Menu) { val searchManager = getSystemService(Context.SEARCH_SERVICE) as SearchManager 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 { override fun onMenuItemActionExpand(item: MenuItem?): Boolean { mIsSearchOpen = true @@ -108,6 +92,22 @@ class SearchActivity : SimpleActivity(), MediaOperationsListener { } }) 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) {