store the new folder path in shared prefs, so its more accessible
This commit is contained in:
parent
551fc3a1c6
commit
189f9b7410
|
@ -57,7 +57,6 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
private var mLoadedInitialPhotos = false
|
||||
private var mLastMediaModified = 0
|
||||
private var mLastMediaHandler = Handler()
|
||||
private var mNewFolderPath = ""
|
||||
|
||||
private var mCurrAsyncTask: GetDirectoriesAsynctask? = null
|
||||
|
||||
|
@ -74,6 +73,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
mIsThirdPartyIntent = mIsPickImageIntent || mIsPickVideoIntent || mIsGetImageContentIntent || mIsGetVideoContentIntent ||
|
||||
mIsGetAnyContentIntent || mIsSetWallpaperIntent
|
||||
|
||||
config.tempFolderPath = ""
|
||||
directories_refresh_layout.setOnRefreshListener({ getDirectories() })
|
||||
mDirs = ArrayList()
|
||||
mStoredAnimateGifs = config.animateGifs
|
||||
|
@ -160,12 +160,13 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
super.onDestroy()
|
||||
config.temporarilyShowHidden = false
|
||||
|
||||
val newFolder = File(mNewFolderPath)
|
||||
val newFolder = File(config.tempFolderPath)
|
||||
if (newFolder.exists() && newFolder.isDirectory) {
|
||||
if (newFolder.list()?.isEmpty() == true) {
|
||||
deleteFileBg(newFolder, true) { }
|
||||
}
|
||||
}
|
||||
config.tempFolderPath = ""
|
||||
}
|
||||
|
||||
private fun tryloadGallery() {
|
||||
|
@ -314,7 +315,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
private fun createNewFolder() {
|
||||
FilePickerDialog(this, internalStoragePath, false, config.shouldShowHidden) {
|
||||
CreateNewFolderDialog(this, it) {
|
||||
mNewFolderPath = it
|
||||
config.tempFolderPath = it
|
||||
addTempFolderIfNeeded(mDirs, true)
|
||||
}
|
||||
}
|
||||
|
@ -322,8 +323,9 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
|
||||
private fun addTempFolderIfNeeded(dirs: ArrayList<Directory>, isFromCache: Boolean) {
|
||||
val directories = ArrayList<Directory>()
|
||||
if (mNewFolderPath.isNotEmpty()) {
|
||||
val newFolder = Directory(mNewFolderPath, "", mNewFolderPath.getFilenameFromPath(), 0, 0, 0, 0L)
|
||||
val tempFolderPath = config.tempFolderPath
|
||||
if (tempFolderPath.isNotEmpty()) {
|
||||
val newFolder = Directory(tempFolderPath, "", tempFolderPath.getFilenameFromPath(), 0, 0, 0, 0L)
|
||||
directories.add(newFolder)
|
||||
}
|
||||
directories.addAll(dirs)
|
||||
|
@ -449,7 +451,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
}
|
||||
|
||||
private fun storeDirectories() {
|
||||
if (!config.temporarilyShowHidden && mNewFolderPath.isEmpty()) {
|
||||
if (!config.temporarilyShowHidden && config.tempFolderPath.isEmpty()) {
|
||||
val directories = Gson().toJson(mDirs)
|
||||
config.directories = directories
|
||||
}
|
||||
|
|
|
@ -276,4 +276,8 @@ class Config(context: Context) : BaseConfig(context) {
|
|||
var loopSlideshow: Boolean
|
||||
get() = prefs.getBoolean(SLIDESHOW_LOOP, false)
|
||||
set(loopSlideshow) = prefs.edit().putBoolean(SLIDESHOW_LOOP, loopSlideshow).apply()
|
||||
|
||||
var tempFolderPath: String
|
||||
get() = prefs.getString(TEMP_FOLDER_PATH, "")
|
||||
set(tempFolderPath) = prefs.edit().putString(TEMP_FOLDER_PATH, tempFolderPath).apply()
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ val HIDE_SYSTEM_UI = "hide_system_ui"
|
|||
val REPLACE_SHARE_WITH_ROTATE = "replace_share_with_rotate"
|
||||
val DELETE_EMPTY_FOLDERS = "delete_empty_folders"
|
||||
val ALLOW_VIDEO_GESTURES = "allow_video_gestures"
|
||||
val TEMP_FOLDER_PATH = "temp_folder_path"
|
||||
|
||||
// slideshow
|
||||
val SLIDESHOW_INTERVAL = "slideshow_interval"
|
||||
|
|
Loading…
Reference in New Issue