diff --git a/app/src/main/java/eu/kanade/presentation/library/anime/AnimeLibrarySettingsDialog.kt b/app/src/main/java/eu/kanade/presentation/library/anime/AnimeLibrarySettingsDialog.kt index 84a052c6d..7fadd4708 100644 --- a/app/src/main/java/eu/kanade/presentation/library/anime/AnimeLibrarySettingsDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/library/anime/AnimeLibrarySettingsDialog.kt @@ -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 }, diff --git a/domain/src/main/java/tachiyomi/domain/library/anime/model/AnimeLibrarySortMode.kt b/domain/src/main/java/tachiyomi/domain/library/anime/model/AnimeLibrarySortMode.kt index 86f7f826f..ea24ad938 100644 --- a/domain/src/main/java/tachiyomi/domain/library/anime/model/AnimeLibrarySortMode.kt +++ b/domain/src/main/java/tachiyomi/domain/library/anime/model/AnimeLibrarySortMode.kt @@ -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 {