优化中文排序

pull/525/head
gedoor 4 years ago
parent 0f3ddb7892
commit d566295aaf
  1. 4
      app/src/main/java/io/legado/app/ui/book/cache/CacheActivity.kt
  2. 2
      app/src/main/java/io/legado/app/utils/FileUtils.kt

@ -129,7 +129,9 @@ class CacheActivity : VMBaseActivity<ActivityCacheBookBinding, CacheViewModel>()
} }
val books = when (getPrefInt(PreferKey.bookshelfSort)) { val books = when (getPrefInt(PreferKey.bookshelfSort)) {
1 -> booksDownload.sortedByDescending { it.latestChapterTime } 1 -> booksDownload.sortedByDescending { it.latestChapterTime }
2 -> booksDownload.sortedBy { it.name } 2 -> booksDownload.sortedWith { o1, o2 ->
o1.name.cnCompare(o2.name)
}
3 -> booksDownload.sortedBy { it.order } 3 -> booksDownload.sortedBy { it.order }
else -> booksDownload.sortedByDescending { it.durChapterTime } else -> booksDownload.sortedByDescending { it.durChapterTime }
} }

@ -710,7 +710,7 @@ object FileUtils {
val s1 = f1.name val s1 = f1.name
val s2 = f2.name val s2 = f2.name
if (caseSensitive) { if (caseSensitive) {
s1.compareTo(s2) s1.cnCompare(s2)
} else { } else {
s1.compareTo(s2, ignoreCase = true) s1.compareTo(s2, ignoreCase = true)
} }

Loading…
Cancel
Save