From f3e76cfb509de9d73a387be00609c04f30801d78 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 13 Feb 2022 17:02:28 +0100 Subject: [PATCH] fix sorting of folders with Group direct subfolders enabled --- .../gallery/pro/extensions/Context.kt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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 d91d6ce0d..8ade06fee 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 @@ -130,6 +130,14 @@ fun Context.getSortedDirectories(source: ArrayList): ArrayList { + if (o1.sortValue.isEmpty()) { + o1.sortValue = o1.name.toLowerCase() + } + + if (o2.sortValue.isEmpty()) { + o2.sortValue = o2.name.toLowerCase() + } + if (sorting and SORT_USE_NUMERIC_VALUE != 0) { AlphanumericComparator().compare(o1.sortValue.toLowerCase(), o2.sortValue.toLowerCase()) } else { @@ -137,6 +145,14 @@ fun Context.getSortedDirectories(source: ArrayList): ArrayList { + if (o1.sortValue.isEmpty()) { + o1.sortValue = o1.path.toLowerCase() + } + + if (o2.sortValue.isEmpty()) { + o2.sortValue = o2.path.toLowerCase() + } + if (sorting and SORT_USE_NUMERIC_VALUE != 0) { AlphanumericComparator().compare(o1.sortValue.toLowerCase(), o2.sortValue.toLowerCase()) } else {