mirror of
https://github.com/mihonapp/mihon.git
synced 2025-02-08 00:05:02 +01:00
Update app/src/main/java/eu/kanade/presentation/library/LibrarySettingsDialog.kt
Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com>
This commit is contained in:
parent
d328ded17f
commit
2eb1580788
@ -183,40 +183,37 @@ private fun ColumnScope.SortPage(
|
|||||||
MR.strings.action_sort_date_added to LibrarySort.Type.DateAdded,
|
MR.strings.action_sort_date_added to LibrarySort.Type.DateAdded,
|
||||||
MR.strings.action_sort_random to LibrarySort.Type.Random,
|
MR.strings.action_sort_random to LibrarySort.Type.Random,
|
||||||
).plus(trackerSortOption).map { (titleRes, mode) ->
|
).plus(trackerSortOption).map { (titleRes, mode) ->
|
||||||
when(mode) {
|
if (mode == LibrarySort.Type.Random) {
|
||||||
LibrarySort.Type.Random -> {
|
NondirectionalSortItem(
|
||||||
NondirectionalSortItem(
|
label = stringResource(titleRes),
|
||||||
label = stringResource(titleRes),
|
enabled = sortingMode == LibrarySort.Type.Random,
|
||||||
enabled = sortingMode == LibrarySort.Type.Random,
|
enabledIcon = Icons.Default.Refresh,
|
||||||
enabledIcon = Icons.Default.Refresh,
|
onClick = {
|
||||||
onClick = {
|
screenModel.setSort(category, mode, LibrarySort.Direction.Ascending)
|
||||||
screenModel.setSort(category, mode, LibrarySort.Direction.Ascending)
|
},
|
||||||
},
|
)
|
||||||
)
|
return@map
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
SortItem(
|
|
||||||
label = stringResource(titleRes),
|
|
||||||
sortDescending = sortDescending.takeIf { sortingMode == mode },
|
|
||||||
onClick = {
|
|
||||||
val isTogglingDirection = sortingMode == mode
|
|
||||||
val direction = when {
|
|
||||||
isTogglingDirection -> if (sortDescending) {
|
|
||||||
LibrarySort.Direction.Ascending
|
|
||||||
} else {
|
|
||||||
LibrarySort.Direction.Descending
|
|
||||||
}
|
|
||||||
else -> if (sortDescending) {
|
|
||||||
LibrarySort.Direction.Descending
|
|
||||||
} else {
|
|
||||||
LibrarySort.Direction.Ascending
|
|
||||||
}
|
|
||||||
}
|
|
||||||
screenModel.setSort(category, mode, direction)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
SortItem(
|
||||||
|
label = stringResource(titleRes),
|
||||||
|
sortDescending = sortDescending.takeIf { sortingMode == mode },
|
||||||
|
onClick = {
|
||||||
|
val isTogglingDirection = sortingMode == mode
|
||||||
|
val direction = when {
|
||||||
|
isTogglingDirection -> if (sortDescending) {
|
||||||
|
LibrarySort.Direction.Ascending
|
||||||
|
} else {
|
||||||
|
LibrarySort.Direction.Descending
|
||||||
|
}
|
||||||
|
else -> if (sortDescending) {
|
||||||
|
LibrarySort.Direction.Descending
|
||||||
|
} else {
|
||||||
|
LibrarySort.Direction.Ascending
|
||||||
|
}
|
||||||
|
}
|
||||||
|
screenModel.setSort(category, mode, direction)
|
||||||
|
},
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user