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 d0fb5c1c9..d0939fa2e 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 @@ -39,6 +39,9 @@ class SearchActivity : SimpleActivity() { override fun onQueryTextSubmit(query: String) = false override fun onQueryTextChange(newText: String): Boolean { + if (mIsSearchOpen) { + textChanged(newText) + } return true } }) @@ -46,14 +49,23 @@ class SearchActivity : SimpleActivity() { MenuItemCompat.setOnActionExpandListener(mSearchMenuItem, object : MenuItemCompat.OnActionExpandListener { override fun onMenuItemActionExpand(item: MenuItem?): Boolean { + mIsSearchOpen = true return true } // this triggers on device rotation too, avoid doing anything override fun onMenuItemActionCollapse(item: MenuItem?): Boolean { + if (mIsSearchOpen) { + mIsSearchOpen = false + textChanged("") + } return true } }) mSearchMenuItem?.expandActionView() } + + private fun textChanged(text: String) { + + } } diff --git a/app/src/main/res/layout/activity_search.xml b/app/src/main/res/layout/activity_search.xml index 852cec099..7b5f29da2 100644 --- a/app/src/main/res/layout/activity_search.xml +++ b/app/src/main/res/layout/activity_search.xml @@ -1,71 +1,65 @@ - - + android:layout_height="wrap_content" + android:gravity="center_horizontal" + android:paddingLeft="@dimen/big_margin" + android:paddingTop="@dimen/activity_margin" + android:paddingRight="@dimen/big_margin" + android:text="@string/no_media_with_filters" + android:textSize="@dimen/bigger_text_size" + android:visibility="gone"/> - + - + - + - + - + - + - + - - - - - + +