From d69351fa99f21bb309d804e20a9ce8dec94c34bc Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 24 Jun 2018 15:46:14 +0200 Subject: [PATCH] avoid doing any action on Search Collapsed during device rotation --- .../gallery/activities/MediaActivity.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index b23f895e8..6d51be4fb 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -274,10 +274,13 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { return true } + // this triggers on device rotation too, avoid doing anything override fun onMenuItemActionCollapse(item: MenuItem?): Boolean { - mIsSearchOpen = false - media_refresh_layout.isEnabled = config.enablePullToRefresh - searchQueryChanged("") + if (mIsSearchOpen) { + mIsSearchOpen = false + media_refresh_layout.isEnabled = config.enablePullToRefresh + searchQueryChanged("") + } return true } })