mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-30 08:18:00 +01:00
update commons to 2.25.1 for proper alphanumeric sorting
This commit is contained in:
parent
a493595207
commit
1074043c93
3 changed files with 11 additions and 17 deletions
|
@ -37,7 +37,7 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.simplemobiletools:commons:2.25.0'
|
compile 'com.simplemobiletools:commons:2.25.1'
|
||||||
compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0'
|
compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0'
|
||||||
compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0'
|
compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0'
|
||||||
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'
|
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
package com.simplemobiletools.gallery.models
|
package com.simplemobiletools.gallery.models
|
||||||
|
|
||||||
import com.simplemobiletools.commons.helpers.SORT_BY_DATE_MODIFIED
|
import com.simplemobiletools.commons.helpers.*
|
||||||
import com.simplemobiletools.commons.helpers.SORT_BY_NAME
|
|
||||||
import com.simplemobiletools.commons.helpers.SORT_BY_SIZE
|
|
||||||
import com.simplemobiletools.commons.helpers.SORT_DESCENDING
|
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
|
|
||||||
data class Directory(val path: String, val tmb: String, val name: String, var mediaCnt: Int, val modified: Long, val taken: Long,
|
data class Directory(val path: String, val tmb: String, val name: String, var mediaCnt: Int, val modified: Long, val taken: Long,
|
||||||
|
@ -20,7 +17,7 @@ data class Directory(val path: String, val tmb: String, val name: String, var me
|
||||||
override fun compareTo(other: Directory): Int {
|
override fun compareTo(other: Directory): Int {
|
||||||
var result: Int
|
var result: Int
|
||||||
if (sorting and SORT_BY_NAME != 0) {
|
if (sorting and SORT_BY_NAME != 0) {
|
||||||
result = name.toLowerCase().compareTo(other.name.toLowerCase())
|
result = AlphanumComparator().compare(name.toLowerCase(), other.name.toLowerCase())
|
||||||
} else if (sorting and SORT_BY_SIZE != 0) {
|
} else if (sorting and SORT_BY_SIZE != 0) {
|
||||||
result = if (size == other.size)
|
result = if (size == other.size)
|
||||||
0
|
0
|
||||||
|
|
|
@ -3,10 +3,7 @@ package com.simplemobiletools.gallery.models
|
||||||
import com.simplemobiletools.commons.extensions.getMimeType
|
import com.simplemobiletools.commons.extensions.getMimeType
|
||||||
import com.simplemobiletools.commons.extensions.isGif
|
import com.simplemobiletools.commons.extensions.isGif
|
||||||
import com.simplemobiletools.commons.extensions.isPng
|
import com.simplemobiletools.commons.extensions.isPng
|
||||||
import com.simplemobiletools.commons.helpers.SORT_BY_DATE_MODIFIED
|
import com.simplemobiletools.commons.helpers.*
|
||||||
import com.simplemobiletools.commons.helpers.SORT_BY_NAME
|
|
||||||
import com.simplemobiletools.commons.helpers.SORT_BY_SIZE
|
|
||||||
import com.simplemobiletools.commons.helpers.SORT_DESCENDING
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
|
|
||||||
|
@ -27,25 +24,25 @@ data class Medium(var name: String, var path: String, val video: Boolean, val mo
|
||||||
fun getMimeType() = File(path).getMimeType()
|
fun getMimeType() = File(path).getMimeType()
|
||||||
|
|
||||||
override fun compareTo(other: Medium): Int {
|
override fun compareTo(other: Medium): Int {
|
||||||
var res: Int
|
var result: Int
|
||||||
if (sorting and SORT_BY_NAME != 0) {
|
if (sorting and SORT_BY_NAME != 0) {
|
||||||
res = name.toLowerCase().compareTo(other.name.toLowerCase())
|
result = AlphanumComparator().compare(name.toLowerCase(), other.name.toLowerCase())
|
||||||
} else if (sorting and SORT_BY_SIZE != 0) {
|
} else if (sorting and SORT_BY_SIZE != 0) {
|
||||||
res = if (size == other.size)
|
result = if (size == other.size)
|
||||||
0
|
0
|
||||||
else if (size > other.size)
|
else if (size > other.size)
|
||||||
1
|
1
|
||||||
else
|
else
|
||||||
-1
|
-1
|
||||||
} else if (sorting and SORT_BY_DATE_MODIFIED != 0) {
|
} else if (sorting and SORT_BY_DATE_MODIFIED != 0) {
|
||||||
res = if (modified == other.modified)
|
result = if (modified == other.modified)
|
||||||
0
|
0
|
||||||
else if (modified > other.modified)
|
else if (modified > other.modified)
|
||||||
1
|
1
|
||||||
else
|
else
|
||||||
-1
|
-1
|
||||||
} else {
|
} else {
|
||||||
res = if (taken == other.taken)
|
result = if (taken == other.taken)
|
||||||
0
|
0
|
||||||
else if (taken > other.taken)
|
else if (taken > other.taken)
|
||||||
1
|
1
|
||||||
|
@ -54,8 +51,8 @@ data class Medium(var name: String, var path: String, val video: Boolean, val mo
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sorting and SORT_DESCENDING != 0) {
|
if (sorting and SORT_DESCENDING != 0) {
|
||||||
res *= -1
|
result *= -1
|
||||||
}
|
}
|
||||||
return res
|
return result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue