some code style update at the Directory and Medium classes
This commit is contained in:
parent
2640f99e22
commit
7a653ec0c6
|
@ -16,29 +16,23 @@ data class Directory(val path: String, val tmb: String, val name: String, var me
|
|||
|
||||
override fun compareTo(other: Directory): Int {
|
||||
var result: Int
|
||||
if (sorting and SORT_BY_NAME != 0) {
|
||||
result = AlphanumComparator().compare(name.toLowerCase(), other.name.toLowerCase())
|
||||
} else if (sorting and SORT_BY_SIZE != 0) {
|
||||
result = if (size == other.size)
|
||||
0
|
||||
else if (size > other.size)
|
||||
1
|
||||
else
|
||||
-1
|
||||
} else if (sorting and SORT_BY_DATE_MODIFIED != 0) {
|
||||
result = if (modified == other.modified)
|
||||
0
|
||||
else if (modified > other.modified)
|
||||
1
|
||||
else
|
||||
-1
|
||||
} else {
|
||||
result = if (taken == other.taken)
|
||||
0
|
||||
else if (taken > other.taken)
|
||||
1
|
||||
else
|
||||
-1
|
||||
when {
|
||||
sorting and SORT_BY_NAME != 0 -> result = AlphanumComparator().compare(name.toLowerCase(), other.name.toLowerCase())
|
||||
sorting and SORT_BY_SIZE != 0 -> result = when {
|
||||
size == other.size -> 0
|
||||
size > other.size -> 1
|
||||
else -> -1
|
||||
}
|
||||
sorting and SORT_BY_DATE_MODIFIED != 0 -> result = when {
|
||||
modified == other.modified -> 0
|
||||
modified > other.modified -> 1
|
||||
else -> -1
|
||||
}
|
||||
else -> result = when {
|
||||
taken == other.taken -> 0
|
||||
taken > other.taken -> 1
|
||||
else -> -1
|
||||
}
|
||||
}
|
||||
|
||||
if (sorting and SORT_DESCENDING != 0) {
|
||||
|
|
|
@ -25,29 +25,23 @@ data class Medium(var name: String, var path: String, val video: Boolean, val mo
|
|||
|
||||
override fun compareTo(other: Medium): Int {
|
||||
var result: Int
|
||||
if (sorting and SORT_BY_NAME != 0) {
|
||||
result = AlphanumComparator().compare(name.toLowerCase(), other.name.toLowerCase())
|
||||
} else if (sorting and SORT_BY_SIZE != 0) {
|
||||
result = if (size == other.size)
|
||||
0
|
||||
else if (size > other.size)
|
||||
1
|
||||
else
|
||||
-1
|
||||
} else if (sorting and SORT_BY_DATE_MODIFIED != 0) {
|
||||
result = if (modified == other.modified)
|
||||
0
|
||||
else if (modified > other.modified)
|
||||
1
|
||||
else
|
||||
-1
|
||||
} else {
|
||||
result = if (taken == other.taken)
|
||||
0
|
||||
else if (taken > other.taken)
|
||||
1
|
||||
else
|
||||
-1
|
||||
when {
|
||||
sorting and SORT_BY_NAME != 0 -> result = AlphanumComparator().compare(name.toLowerCase(), other.name.toLowerCase())
|
||||
sorting and SORT_BY_SIZE != 0 -> result = when {
|
||||
size == other.size -> 0
|
||||
size > other.size -> 1
|
||||
else -> -1
|
||||
}
|
||||
sorting and SORT_BY_DATE_MODIFIED != 0 -> result = when {
|
||||
modified == other.modified -> 0
|
||||
modified > other.modified -> 1
|
||||
else -> -1
|
||||
}
|
||||
else -> result = when {
|
||||
taken == other.taken -> 0
|
||||
taken > other.taken -> 1
|
||||
else -> -1
|
||||
}
|
||||
}
|
||||
|
||||
if (sorting and SORT_DESCENDING != 0) {
|
||||
|
|
Loading…
Reference in New Issue