Make sure random library sort is at the bottom

This commit is contained in:
AntsyLich 2024-10-15 05:00:56 +06:00
parent 788235feec
commit 2e2c8d36c1
No known key found for this signature in database

View File

@ -166,13 +166,13 @@ private fun ColumnScope.SortPage(
val sortingMode = category.sort.type val sortingMode = category.sort.type
val sortDescending = !category.sort.isAscending val sortDescending = !category.sort.isAscending
val trackerSortOption = if (trackers.isEmpty()) { val options = remember(trackers.isEmpty()) {
emptyList() val trackerMeanPair = if (trackers.isNotEmpty()) {
MR.strings.action_sort_tracker_score to LibrarySort.Type.TrackerMean
} else { } else {
listOf(MR.strings.action_sort_tracker_score to LibrarySort.Type.TrackerMean) null
} }
listOfNotNull(
listOf(
MR.strings.action_sort_alpha to LibrarySort.Type.Alphabetical, MR.strings.action_sort_alpha to LibrarySort.Type.Alphabetical,
MR.strings.action_sort_total to LibrarySort.Type.TotalChapters, MR.strings.action_sort_total to LibrarySort.Type.TotalChapters,
MR.strings.action_sort_last_read to LibrarySort.Type.LastRead, MR.strings.action_sort_last_read to LibrarySort.Type.LastRead,
@ -181,8 +181,12 @@ private fun ColumnScope.SortPage(
MR.strings.action_sort_latest_chapter to LibrarySort.Type.LatestChapter, MR.strings.action_sort_latest_chapter to LibrarySort.Type.LatestChapter,
MR.strings.action_sort_chapter_fetch_date to LibrarySort.Type.ChapterFetchDate, MR.strings.action_sort_chapter_fetch_date to LibrarySort.Type.ChapterFetchDate,
MR.strings.action_sort_date_added to LibrarySort.Type.DateAdded, MR.strings.action_sort_date_added to LibrarySort.Type.DateAdded,
trackerMeanPair,
MR.strings.action_sort_random to LibrarySort.Type.Random, MR.strings.action_sort_random to LibrarySort.Type.Random,
).plus(trackerSortOption).map { (titleRes, mode) -> )
}
options.map { (titleRes, mode) ->
if (mode == LibrarySort.Type.Random) { if (mode == LibrarySort.Type.Random) {
BaseSortItem( BaseSortItem(
label = stringResource(titleRes), label = stringResource(titleRes),