From 762b712246d3d49886e894a5d113fd9b2ea4d287 Mon Sep 17 00:00:00 2001 From: Tibor Kaputa Date: Fri, 21 Jul 2023 21:33:13 +0200 Subject: [PATCH] minor code style update --- .../gallery/pro/extensions/Context.kt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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 96e83c074..7072abedb 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 @@ -23,7 +23,6 @@ import com.bumptech.glide.load.resource.bitmap.RoundedCorners import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions import com.bumptech.glide.request.RequestListener import com.bumptech.glide.request.RequestOptions -import com.bumptech.glide.request.target.Target import com.bumptech.glide.signature.ObjectKey import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.* @@ -136,6 +135,7 @@ fun Context.getSortedDirectories(source: ArrayList): ArrayList { if (o1.sortValue.isEmpty()) { o1.sortValue = o1.path.toLowerCase() @@ -151,6 +151,7 @@ fun Context.getSortedDirectories(source: ArrayList): ArrayList AlphanumericComparator().compare(o1.sortValue.toLowerCase(), o2.sortValue.toLowerCase()) sorting and SORT_BY_SIZE != 0 -> (o1.sortValue.toLongOrNull() ?: 0).compareTo(o2.sortValue.toLongOrNull() ?: 0) sorting and SORT_BY_DATE_MODIFIED != 0 -> (o1.sortValue.toLongOrNull() ?: 0).compareTo(o2.sortValue.toLongOrNull() ?: 0) @@ -196,7 +197,13 @@ fun Context.getDirsToShow(dirs: ArrayList, allDirs: ArrayList, currentPathPrefix: String): ArrayList { val folders = dirs.map { it.path }.sorted().toMutableSet() as HashSet // Sort by path length, to ensure that parents get processed first - val foldersByPathLength = dirs.filter { currentPathPrefix.isEmpty() || (it.path.startsWith(currentPathPrefix, true) && it.path != currentPathPrefix) }.sortedBy { it.path.length } + val foldersByPathLength = dirs.filter { + currentPathPrefix.isEmpty() || + (it.path.startsWith(currentPathPrefix, true) && it.path != currentPathPrefix) + }.sortedBy { + it.path.length + } + var newDirId = 1000L val groups = mutableMapOf>()