disable alphanumeric string comparing, the current implementation is too slow

This commit is contained in:
tibbi 2019-04-01 23:03:34 +02:00
parent 25aeba4b99
commit b58448dde6
2 changed files with 4 additions and 4 deletions

View File

@ -166,8 +166,8 @@ fun Context.getSortedDirectories(source: ArrayList<Directory>): ArrayList<Direct
o1 as Directory
o2 as Directory
var result = when {
sorting and SORT_BY_NAME != 0 -> AlphanumericComparator().compare(o1.name.toLowerCase(), o2.name.toLowerCase())
sorting and SORT_BY_PATH != 0 -> AlphanumericComparator().compare(o1.path.toLowerCase(), o2.path.toLowerCase())
sorting and SORT_BY_NAME != 0 -> o1.name.toLowerCase().compareTo(o2.name.toLowerCase())
sorting and SORT_BY_PATH != 0 -> o1.path.toLowerCase().compareTo(o2.path.toLowerCase())
sorting and SORT_BY_SIZE != 0 -> o1.size.compareTo(o2.size)
sorting and SORT_BY_DATE_MODIFIED != 0 -> o1.modified.compareTo(o2.modified)
else -> o1.taken.compareTo(o2.taken)

View File

@ -287,8 +287,8 @@ class MediaFetcher(val context: Context) {
o1 as Medium
o2 as Medium
var result = when {
sorting and SORT_BY_NAME != 0 -> AlphanumericComparator().compare(o1.name.toLowerCase(), o2.name.toLowerCase())
sorting and SORT_BY_PATH != 0 -> AlphanumericComparator().compare(o1.path.toLowerCase(), o2.path.toLowerCase())
sorting and SORT_BY_NAME != 0 -> o1.name.toLowerCase().compareTo(o2.name.toLowerCase())
sorting and SORT_BY_PATH != 0 -> o1.path.toLowerCase().compareTo(o2.path.toLowerCase())
sorting and SORT_BY_SIZE != 0 -> o1.size.compareTo(o2.size)
sorting and SORT_BY_DATE_MODIFIED != 0 -> o1.modified.compareTo(o2.modified)
else -> o1.taken.compareTo(o2.taken)