mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-30 08:18:00 +01:00
properly handle grouping by some numeric values, like dates
This commit is contained in:
parent
24c9104620
commit
a20cc9aa08
1 changed files with 10 additions and 1 deletions
|
@ -324,7 +324,16 @@ class MediaFetcher(val context: Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
val sortDescending = currentGrouping and GROUP_DESCENDING != 0
|
val sortDescending = currentGrouping and GROUP_DESCENDING != 0
|
||||||
val sorted = mediumGroups.toSortedMap(if (sortDescending) compareByDescending { it } else compareBy { it })
|
val sorted = if (currentGrouping and GROUP_BY_DATE_TAKEN != 0 || currentGrouping and GROUP_BY_LAST_MODIFIED != 0) {
|
||||||
|
mediumGroups.toSortedMap(if (sortDescending) compareByDescending {
|
||||||
|
it.toLongOrNull() ?: 0L
|
||||||
|
} else {
|
||||||
|
compareBy { it.toLongOrNull() ?: 0L }
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
mediumGroups.toSortedMap(if (sortDescending) compareByDescending { it } else compareBy { it })
|
||||||
|
}
|
||||||
|
|
||||||
mediumGroups.clear()
|
mediumGroups.clear()
|
||||||
for ((key, value) in sorted) {
|
for ((key, value) in sorted) {
|
||||||
mediumGroups[key] = value
|
mediumGroups[key] = value
|
||||||
|
|
Loading…
Reference in a new issue