fix anime tracker & airing sort

This commit is contained in:
LuftVerbot 2023-11-26 15:18:03 +01:00
parent eafc64aed0
commit 2b9fe5c389
2 changed files with 9 additions and 2 deletions

View file

@ -149,6 +149,13 @@ private fun ColumnScope.SortPage(
val sortingMode = category.sort.type
val sortDescending = !category.sort.isAscending
val trackerSortOption =
if (screenModel.trackers.isEmpty()) {
emptyList()
} else {
listOf(R.string.action_sort_tracker_score to AnimeLibrarySort.Type.TrackerMean)
}
listOf(
R.string.action_sort_alpha to AnimeLibrarySort.Type.Alphabetical,
R.string.action_sort_total_episodes to AnimeLibrarySort.Type.TotalEpisodes,
@ -159,7 +166,7 @@ private fun ColumnScope.SortPage(
R.string.action_sort_episode_fetch_date to AnimeLibrarySort.Type.EpisodeFetchDate,
R.string.action_sort_date_added to AnimeLibrarySort.Type.DateAdded,
R.string.action_sort_airing_time to AnimeLibrarySort.Type.AiringTime,
).map { (titleRes, mode) ->
).plus(trackerSortOption).map { (titleRes, mode) ->
SortItem(
label = stringResource(titleRes),
sortDescending = sortDescending.takeIf { sortingMode == mode },

View file

@ -33,7 +33,7 @@ data class AnimeLibrarySort(
data object EpisodeFetchDate : Type(0b00011000)
data object DateAdded : Type(0b00011100)
data object TrackerMean : Type(0b000100000)
data object AiringTime : Type(0b00100000)
data object AiringTime : Type(0b00110000)
companion object {
fun valueOf(flag: Long): Type {