moving the default folder related code up

This commit is contained in:
tibbi 2020-11-09 13:40:17 +01:00
parent 58a838f770
commit 564e56b20d

View file

@ -1123,6 +1123,29 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
mDirs = dirs.clone() as ArrayList<Directory> mDirs = dirs.clone() as ArrayList<Directory>
} }
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<Directory>) { private fun checkPlaceholderVisibility(dirs: ArrayList<Directory>) {
directories_empty_placeholder.beVisibleIf(dirs.isEmpty() && mLoadedInitialPhotos) directories_empty_placeholder.beVisibleIf(dirs.isEmpty() && mLoadedInitialPhotos)
directories_empty_placeholder_2.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) 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)
}
}
} }