From 564e56b20d33b28d0018c8087ec705beeb60785e Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 9 Nov 2020 13:40:17 +0100 Subject: [PATCH] moving the default folder related code up --- .../gallery/pro/activities/MainActivity.kt | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt index ba2395584..a0879f06e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt @@ -1123,6 +1123,29 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { mDirs = dirs.clone() as ArrayList } + private fun setAsDefaultFolder() { + config.defaultFolder = "" + invalidateOptionsMenu() + } + + private fun openDefaultFolder() { + if (config.defaultFolder.isEmpty()) { + return + } + + val defaultDir = File(config.defaultFolder) + + if ((!defaultDir.exists() || !defaultDir.isDirectory) && (config.defaultFolder != RECYCLE_BIN && config.defaultFolder != FAVORITES)) { + config.defaultFolder = "" + return + } + + Intent(this, MediaActivity::class.java).apply { + putExtra(DIRECTORY, config.defaultFolder) + handleMediaIntent(this) + } + } + private fun checkPlaceholderVisibility(dirs: ArrayList) { directories_empty_placeholder.beVisibleIf(dirs.isEmpty() && mLoadedInitialPhotos) directories_empty_placeholder_2.beVisibleIf(dirs.isEmpty() && mLoadedInitialPhotos) @@ -1412,27 +1435,4 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { checkWhatsNew(this, BuildConfig.VERSION_CODE) } } - - private fun setAsDefaultFolder() { - config.defaultFolder = "" - invalidateOptionsMenu() - } - - private fun openDefaultFolder() { - if (config.defaultFolder.isEmpty()) { - return - } - - val defaultDir = File(config.defaultFolder) - - if ((!defaultDir.exists() || !defaultDir.isDirectory) && (config.defaultFolder != RECYCLE_BIN && config.defaultFolder != FAVORITES)) { - config.defaultFolder = "" - return - } - - Intent(this, MediaActivity::class.java).apply { - putExtra(DIRECTORY, config.defaultFolder) - handleMediaIntent(this) - } - } }