diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt index cd120112d..ad27c0495 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt @@ -114,6 +114,18 @@ fun Context.getSortedDirectories(source: ArrayList): ArrayList() + config.customFoldersOrder.split("|||").forEach { path -> + val index = dirs.indexOfFirst { it.path == path } + if (index != -1) { + val dir = dirs.removeAt(index) + newDirsOrdered.add(dir) + } + } + + dirs.mapTo(newDirsOrdered, { it }) + return newDirsOrdered } dirs.sortWith(Comparator { o1, o2 ->