From bd084a09b45a2d993b267620f543891bae38003f Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 14 Aug 2018 10:12:51 +0200 Subject: [PATCH] fix #901, make sure "Temporarily show hidden" persists through device rotation --- .../gallery/activities/MainActivity.kt | 17 ++++++++++------- .../gallery/activities/MediaActivity.kt | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt index 33cb4bf9c..7e24ff8bd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -85,8 +85,12 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { mMediumDao = galleryDB.MediumDao() mDirectoryDao = galleryDB.DirectoryDao() - config.temporarilyShowHidden = false - config.tempSkipDeleteConfirmation = false + if (savedInstanceState == null) { + config.temporarilyShowHidden = false + config.tempSkipDeleteConfirmation = false + removeTempFolder() + } + mIsPickImageIntent = isPickImageIntent(intent) mIsPickVideoIntent = isPickVideoIntent(intent) mIsGetImageContentIntent = isGetImageContentIntent(intent) @@ -97,7 +101,6 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { mIsThirdPartyIntent = mIsPickImageIntent || mIsPickVideoIntent || mIsGetImageContentIntent || mIsGetVideoContentIntent || mIsGetAnyContentIntent || mIsSetWallpaperIntent - removeTempFolder() directories_refresh_layout.setOnRefreshListener { getDirectories() } storeStateVariables() checkWhatsNewDialog() @@ -216,11 +219,11 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { override fun onDestroy() { super.onDestroy() - config.temporarilyShowHidden = false - config.tempSkipDeleteConfirmation = false - mTempShowHiddenHandler.removeCallbacksAndMessages(null) - removeTempFolder() if (!isChangingConfigurations) { + config.temporarilyShowHidden = false + config.tempSkipDeleteConfirmation = false + mTempShowHiddenHandler.removeCallbacksAndMessages(null) + removeTempFolder() GalleryDatabase.destroyInstance() } } 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 3fb257835..da35cc221 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -188,7 +188,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { override fun onDestroy() { super.onDestroy() - if (config.showAll) { + if (config.showAll && !isChangingConfigurations) { config.temporarilyShowHidden = false config.tempSkipDeleteConfirmation = false }