store custom folder order in shared prefs

This commit is contained in:
tibbi 2021-05-13 18:56:09 +02:00
parent fc2d42490a
commit 5dcad025bb
3 changed files with 8 additions and 0 deletions

View file

@ -175,6 +175,9 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
override fun onActionModeDestroyed() { override fun onActionModeDestroyed() {
if (isChangingOrder) { if (isChangingOrder) {
notifyDataSetChanged() notifyDataSetChanged()
val reorderedFoldersList = dirs.map { it.path }
config.customFoldersOrder = TextUtils.join("|||", reorderedFoldersList)
} }
isChangingOrder = false isChangingOrder = false

View file

@ -515,4 +515,8 @@ class Config(context: Context) : BaseConfig(context) {
var fileRoundedCorners: Boolean var fileRoundedCorners: Boolean
get() = prefs.getBoolean(FILE_ROUNDED_CORNERS, false) get() = prefs.getBoolean(FILE_ROUNDED_CORNERS, false)
set(fileRoundedCorners) = prefs.edit().putBoolean(FILE_ROUNDED_CORNERS, fileRoundedCorners).apply() set(fileRoundedCorners) = prefs.edit().putBoolean(FILE_ROUNDED_CORNERS, fileRoundedCorners).apply()
var customFoldersOrder: String
get() = prefs.getString(CUSTOM_FOLDERS_ORDER, "")!!
set(customFoldersOrder) = prefs.edit().putString(CUSTOM_FOLDERS_ORDER, customFoldersOrder).apply()
} }

View file

@ -88,6 +88,7 @@ const val FOLDER_MEDIA_COUNT = "folder_media_count"
const val LIMIT_FOLDER_TITLE = "folder_limit_title" const val LIMIT_FOLDER_TITLE = "folder_limit_title"
const val THUMBNAIL_SPACING = "thumbnail_spacing" const val THUMBNAIL_SPACING = "thumbnail_spacing"
const val FILE_ROUNDED_CORNERS = "file_rounded_corners" const val FILE_ROUNDED_CORNERS = "file_rounded_corners"
const val CUSTOM_FOLDERS_ORDER = "custom_folders_order"
// slideshow // slideshow
const val SLIDESHOW_INTERVAL = "slideshow_interval" const val SLIDESHOW_INTERVAL = "slideshow_interval"