some code style update at the Directory and Medium classes
This commit is contained in:
parent
2640f99e22
commit
7a653ec0c6
2 changed files with 34 additions and 46 deletions
|
@ -16,29 +16,23 @@ 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) {
|
when {
|
||||||
result = AlphanumComparator().compare(name.toLowerCase(), other.name.toLowerCase())
|
sorting and SORT_BY_NAME != 0 -> result = AlphanumComparator().compare(name.toLowerCase(), other.name.toLowerCase())
|
||||||
} else if (sorting and SORT_BY_SIZE != 0) {
|
sorting and SORT_BY_SIZE != 0 -> result = when {
|
||||||
result = if (size == other.size)
|
size == other.size -> 0
|
||||||
0
|
size > other.size -> 1
|
||||||
else if (size > other.size)
|
else -> -1
|
||||||
1
|
}
|
||||||
else
|
sorting and SORT_BY_DATE_MODIFIED != 0 -> result = when {
|
||||||
-1
|
modified == other.modified -> 0
|
||||||
} else if (sorting and SORT_BY_DATE_MODIFIED != 0) {
|
modified > other.modified -> 1
|
||||||
result = if (modified == other.modified)
|
else -> -1
|
||||||
0
|
}
|
||||||
else if (modified > other.modified)
|
else -> result = when {
|
||||||
1
|
taken == other.taken -> 0
|
||||||
else
|
taken > other.taken -> 1
|
||||||
-1
|
else -> -1
|
||||||
} else {
|
}
|
||||||
result = if (taken == other.taken)
|
|
||||||
0
|
|
||||||
else if (taken > other.taken)
|
|
||||||
1
|
|
||||||
else
|
|
||||||
-1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sorting and SORT_DESCENDING != 0) {
|
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 {
|
override fun compareTo(other: Medium): Int {
|
||||||
var result: Int
|
var result: Int
|
||||||
if (sorting and SORT_BY_NAME != 0) {
|
when {
|
||||||
result = AlphanumComparator().compare(name.toLowerCase(), other.name.toLowerCase())
|
sorting and SORT_BY_NAME != 0 -> result = AlphanumComparator().compare(name.toLowerCase(), other.name.toLowerCase())
|
||||||
} else if (sorting and SORT_BY_SIZE != 0) {
|
sorting and SORT_BY_SIZE != 0 -> result = when {
|
||||||
result = if (size == other.size)
|
size == other.size -> 0
|
||||||
0
|
size > other.size -> 1
|
||||||
else if (size > other.size)
|
else -> -1
|
||||||
1
|
}
|
||||||
else
|
sorting and SORT_BY_DATE_MODIFIED != 0 -> result = when {
|
||||||
-1
|
modified == other.modified -> 0
|
||||||
} else if (sorting and SORT_BY_DATE_MODIFIED != 0) {
|
modified > other.modified -> 1
|
||||||
result = if (modified == other.modified)
|
else -> -1
|
||||||
0
|
}
|
||||||
else if (modified > other.modified)
|
else -> result = when {
|
||||||
1
|
taken == other.taken -> 0
|
||||||
else
|
taken > other.taken -> 1
|
||||||
-1
|
else -> -1
|
||||||
} else {
|
}
|
||||||
result = if (taken == other.taken)
|
|
||||||
0
|
|
||||||
else if (taken > other.taken)
|
|
||||||
1
|
|
||||||
else
|
|
||||||
-1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sorting and SORT_DESCENDING != 0) {
|
if (sorting and SORT_DESCENDING != 0) {
|
||||||
|
|
Loading…
Reference in a new issue