diff --git a/app/src/main/java/eu/kanade/presentation/track/anime/AnimeTrackInfoDialogHome.kt b/app/src/main/java/eu/kanade/presentation/track/anime/AnimeTrackInfoDialogHome.kt index dbe0d4ad3d..972f0ab65c 100644 --- a/app/src/main/java/eu/kanade/presentation/track/anime/AnimeTrackInfoDialogHome.kt +++ b/app/src/main/java/eu/kanade/presentation/track/anime/AnimeTrackInfoDialogHome.kt @@ -38,6 +38,7 @@ import eu.kanade.presentation.theme.TachiyomiPreviewTheme import eu.kanade.presentation.track.components.TrackLogoIcon import eu.kanade.presentation.track.manga.TrackDetailsItem import eu.kanade.presentation.track.manga.TrackInfoItemMenu +import eu.kanade.tachiyomi.data.track.AnimeTracker import eu.kanade.tachiyomi.data.track.Tracker import eu.kanade.tachiyomi.ui.entries.anime.track.AnimeTrackItem import eu.kanade.tachiyomi.util.lang.toLocalDate @@ -77,7 +78,7 @@ fun AnimeTrackInfoDialogHome( TrackInfoItem( title = item.track.title, tracker = item.tracker, - status = item.tracker.getStatus(item.track.status), + status = (item.tracker as? AnimeTracker)?.getStatusForAnime(item.track.status), onStatusClick = { onStatusClick(item) }, episodes = "${item.track.lastEpisodeSeen.toInt()}".let { val totalEpisodes = item.track.totalEpisodes diff --git a/app/src/main/java/eu/kanade/presentation/track/manga/MangaTrackInfoDialogHome.kt b/app/src/main/java/eu/kanade/presentation/track/manga/MangaTrackInfoDialogHome.kt index d0e630122e..7843458475 100644 --- a/app/src/main/java/eu/kanade/presentation/track/manga/MangaTrackInfoDialogHome.kt +++ b/app/src/main/java/eu/kanade/presentation/track/manga/MangaTrackInfoDialogHome.kt @@ -49,6 +49,7 @@ import dev.icerock.moko.resources.StringResource import eu.kanade.presentation.components.DropdownMenu import eu.kanade.presentation.theme.TachiyomiPreviewTheme import eu.kanade.presentation.track.components.TrackLogoIcon +import eu.kanade.tachiyomi.data.track.MangaTracker import eu.kanade.tachiyomi.data.track.Tracker import eu.kanade.tachiyomi.ui.entries.manga.track.MangaTrackItem import eu.kanade.tachiyomi.util.lang.toLocalDate @@ -88,7 +89,7 @@ fun MangaTrackInfoDialogHome( TrackInfoItem( title = item.track.title, tracker = item.tracker, - status = item.tracker.getStatus(item.track.status), + status = (item.tracker as? MangaTracker)?.getStatusForManga(item.track.status), onStatusClick = { onStatusClick(item) }, chapters = "${item.track.lastChapterRead.toInt()}".let { val totalChapters = item.track.totalChapters diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/AnimeTracker.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/AnimeTracker.kt index daf4ae76f2..f38431a985 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/AnimeTracker.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/AnimeTracker.kt @@ -1,6 +1,7 @@ package eu.kanade.tachiyomi.data.track import android.app.Application +import dev.icerock.moko.resources.StringResource import eu.kanade.domain.track.anime.interactor.AddAnimeTracks import eu.kanade.domain.track.anime.model.toDomainTrack import eu.kanade.tachiyomi.data.database.models.anime.AnimeTrack @@ -112,4 +113,6 @@ interface AnimeTracker { withUIContext { Injekt.get().toast(e.message) } } } + + fun getStatusForAnime(status: Long): StringResource? } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/MangaTracker.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/MangaTracker.kt index 9c81d5c554..7dfbbf6925 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/MangaTracker.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/MangaTracker.kt @@ -1,6 +1,7 @@ package eu.kanade.tachiyomi.data.track import android.app.Application +import dev.icerock.moko.resources.StringResource import eu.kanade.domain.track.manga.interactor.AddMangaTracks import eu.kanade.domain.track.manga.model.toDomainTrack import eu.kanade.tachiyomi.data.database.models.manga.MangaTrack @@ -112,4 +113,6 @@ interface MangaTracker { withUIContext { Injekt.get().toast(e.message) } } } + + fun getStatusForManga(status: Long): StringResource? } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/Tracker.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/Tracker.kt index 67ec1886a9..4f5f81b1c9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/Tracker.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/Tracker.kt @@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.data.track import androidx.annotation.CallSuper import androidx.annotation.ColorInt import androidx.annotation.DrawableRes -import dev.icerock.moko.resources.StringResource import kotlinx.collections.immutable.ImmutableList import kotlinx.coroutines.flow.Flow import okhttp3.OkHttpClient @@ -25,8 +24,6 @@ interface Tracker { @ColorInt fun getLogoColor(): Int - fun getStatus(status: Long): StringResource? - fun getCompletionStatus(): Long fun getScoreList(): ImmutableList diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/Anilist.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/Anilist.kt index e27eb69ff9..4c39de0378 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/Anilist.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/Anilist.kt @@ -84,13 +84,20 @@ class Anilist(id: Long) : return listOf(WATCHING, PLANNING_ANIME, COMPLETED, REPEATING_ANIME, PAUSED, DROPPED) } - override fun getStatus(status: Long): StringResource? = when (status) { - WATCHING -> MR.strings.watching + override fun getStatusForManga(status: Long): StringResource? = when (status) { READING -> MR.strings.reading PLANNING -> MR.strings.plan_to_read - PLANNING_ANIME -> MR.strings.plan_to_watch COMPLETED -> MR.strings.completed REPEATING -> MR.strings.repeating + PAUSED -> MR.strings.paused + DROPPED -> MR.strings.dropped + else -> null + } + + override fun getStatusForAnime(status: Long): StringResource? = when (status) { + WATCHING -> MR.strings.watching + PLANNING_ANIME -> MR.strings.plan_to_watch + COMPLETED -> MR.strings.completed REPEATING_ANIME -> MR.strings.repeating_anime PAUSED -> MR.strings.paused DROPPED -> MR.strings.dropped diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/Bangumi.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/Bangumi.kt index 033b1102e5..7852b27768 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/Bangumi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/Bangumi.kt @@ -164,7 +164,7 @@ class Bangumi(id: Long) : BaseTracker(id, "Bangumi"), MangaTracker, AnimeTracker return listOf(READING, COMPLETED, ON_HOLD, DROPPED, PLAN_TO_READ) } - override fun getStatus(status: Long): StringResource? = when (status) { + override fun getStatusForManga(status: Long): StringResource? = when (status) { READING -> MR.strings.reading PLAN_TO_READ -> MR.strings.plan_to_read COMPLETED -> MR.strings.completed @@ -173,6 +173,15 @@ class Bangumi(id: Long) : BaseTracker(id, "Bangumi"), MangaTracker, AnimeTracker else -> null } + override fun getStatusForAnime(status: Long): StringResource? = when (status) { + READING -> MR.strings.watching + PLAN_TO_READ -> MR.strings.plan_to_watch + COMPLETED -> MR.strings.completed + ON_HOLD -> MR.strings.on_hold + DROPPED -> MR.strings.dropped + else -> null + } + override fun getReadingStatus(): Long = READING override fun getWatchingStatus(): Long = READING diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/jellyfin/Jellyfin.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/jellyfin/Jellyfin.kt index 674b7a82aa..8c5460438f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/jellyfin/Jellyfin.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/jellyfin/Jellyfin.kt @@ -39,7 +39,7 @@ class Jellyfin(id: Long) : BaseTracker(id, "Jellyfin"), EnhancedAnimeTracker, An override fun getStatusListAnime(): List = listOf(UNSEEN, WATCHING, COMPLETED) - override fun getStatus(status: Long): StringResource? = when (status) { + override fun getStatusForAnime(status: Long): StringResource? = when (status) { UNSEEN -> MR.strings.unseen WATCHING -> MR.strings.watching COMPLETED -> MR.strings.completed diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/kavita/Kavita.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/kavita/Kavita.kt index 29ff48ff62..a6f46a50b7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/kavita/Kavita.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/kavita/Kavita.kt @@ -41,7 +41,7 @@ class Kavita(id: Long) : BaseTracker(id, "Kavita"), EnhancedMangaTracker, MangaT override fun getStatusListManga(): List = listOf(UNREAD, READING, COMPLETED) - override fun getStatus(status: Long): StringResource? = when (status) { + override fun getStatusForManga(status: Long): StringResource? = when (status) { UNREAD -> MR.strings.unread READING -> MR.strings.reading COMPLETED -> MR.strings.completed diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/Kitsu.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/Kitsu.kt index 19f8ea72cd..977d524169 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/Kitsu.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/Kitsu.kt @@ -62,10 +62,17 @@ class Kitsu(id: Long) : return listOf(WATCHING, PLAN_TO_WATCH, COMPLETED, ON_HOLD, DROPPED) } - override fun getStatus(status: Long): StringResource? = when (status) { + override fun getStatusForManga(status: Long): StringResource? = when (status) { READING -> MR.strings.currently_reading - WATCHING -> MR.strings.currently_watching PLAN_TO_READ -> MR.strings.want_to_read + COMPLETED -> MR.strings.completed + ON_HOLD -> MR.strings.on_hold + DROPPED -> MR.strings.dropped + else -> null + } + + override fun getStatusForAnime(status: Long): StringResource? = when (status) { + WATCHING -> MR.strings.currently_watching PLAN_TO_WATCH -> MR.strings.want_to_watch COMPLETED -> MR.strings.completed ON_HOLD -> MR.strings.on_hold diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/komga/Komga.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/komga/Komga.kt index cc53b33828..bc20dcf4ea 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/komga/Komga.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/komga/Komga.kt @@ -38,7 +38,7 @@ class Komga(id: Long) : BaseTracker(id, "Komga"), EnhancedMangaTracker, MangaTra override fun getStatusListManga(): List = listOf(UNREAD, READING, COMPLETED) - override fun getStatus(status: Long): StringResource? = when (status) { + override fun getStatusForManga(status: Long): StringResource? = when (status) { UNREAD -> MR.strings.unread READING -> MR.strings.reading COMPLETED -> MR.strings.completed diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/mangaupdates/MangaUpdates.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/mangaupdates/MangaUpdates.kt index f2ced6528b..32a9c2b975 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/mangaupdates/MangaUpdates.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/mangaupdates/MangaUpdates.kt @@ -51,7 +51,7 @@ class MangaUpdates(id: Long) : BaseTracker(id, "MangaUpdates"), MangaTracker, De return listOf(READING_LIST, COMPLETE_LIST, ON_HOLD_LIST, UNFINISHED_LIST, WISH_LIST) } - override fun getStatus(status: Long): StringResource? = when (status) { + override fun getStatusForManga(status: Long): StringResource? = when (status) { READING_LIST -> MR.strings.reading_list WISH_LIST -> MR.strings.wish_list COMPLETE_LIST -> MR.strings.complete_list diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeList.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeList.kt index 32943d94fe..26d9fa9f89 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeList.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeList.kt @@ -69,15 +69,22 @@ class MyAnimeList(id: Long) : return listOf(WATCHING, COMPLETED, ON_HOLD, DROPPED, PLAN_TO_WATCH, REWATCHING) } - override fun getStatus(status: Long): StringResource? = when (status) { + override fun getStatusForManga(status: Long): StringResource? = when (status) { READING -> MR.strings.reading - WATCHING -> MR.strings.watching COMPLETED -> MR.strings.completed ON_HOLD -> MR.strings.on_hold DROPPED -> MR.strings.dropped PLAN_TO_READ -> MR.strings.plan_to_read - PLAN_TO_WATCH -> MR.strings.plan_to_watch REREADING -> MR.strings.repeating + else -> null + } + + override fun getStatusForAnime(status: Long): StringResource? = when (status) { + WATCHING -> MR.strings.watching + COMPLETED -> MR.strings.completed + ON_HOLD -> MR.strings.on_hold + DROPPED -> MR.strings.dropped + PLAN_TO_WATCH -> MR.strings.plan_to_watch REWATCHING -> MR.strings.repeating_anime else -> null } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/Shikimori.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/Shikimori.kt index 110901729d..15dd3fb20a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/Shikimori.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/Shikimori.kt @@ -186,7 +186,7 @@ class Shikimori(id: Long) : return listOf(READING, COMPLETED, ON_HOLD, DROPPED, PLAN_TO_READ, REREADING) } - override fun getStatus(status: Long): StringResource? = when (status) { + override fun getStatusForManga(status: Long): StringResource? = when (status) { READING -> MR.strings.reading PLAN_TO_READ -> MR.strings.plan_to_read COMPLETED -> MR.strings.completed @@ -196,6 +196,16 @@ class Shikimori(id: Long) : else -> null } + override fun getStatusForAnime(status: Long): StringResource? = when (status) { + READING -> MR.strings.watching + PLAN_TO_READ -> MR.strings.plan_to_watch + COMPLETED -> MR.strings.completed + ON_HOLD -> MR.strings.on_hold + DROPPED -> MR.strings.dropped + REREADING -> MR.strings.repeating_anime + else -> null + } + override fun getReadingStatus(): Long = READING override fun getWatchingStatus(): Long = READING diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/simkl/Simkl.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/simkl/Simkl.kt index 6fcac037b2..440c212848 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/simkl/Simkl.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/simkl/Simkl.kt @@ -100,7 +100,7 @@ class Simkl(id: Long) : BaseTracker(id, "Simkl"), AnimeTracker { return listOf(WATCHING, COMPLETED, ON_HOLD, NOT_INTERESTING, PLAN_TO_WATCH) } - override fun getStatus(status: Long): StringResource? = when (status) { + override fun getStatusForAnime(status: Long): StringResource? = when (status) { WATCHING -> MR.strings.watching PLAN_TO_WATCH -> MR.strings.plan_to_watch COMPLETED -> MR.strings.completed diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/suwayomi/Suwayomi.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/suwayomi/Suwayomi.kt index efa96b3a07..7dc92f78cb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/suwayomi/Suwayomi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/suwayomi/Suwayomi.kt @@ -31,7 +31,7 @@ class Suwayomi(id: Long) : BaseTracker(id, "Suwayomi"), EnhancedMangaTracker, Ma override fun getStatusListManga(): List = listOf(UNREAD, READING, COMPLETED) - override fun getStatus(status: Long): StringResource? = when (status) { + override fun getStatusForManga(status: Long): StringResource? = when (status) { UNREAD -> MR.strings.unread READING -> MR.strings.reading COMPLETED -> MR.strings.completed diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/entries/anime/track/AnimeTrackInfoDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/entries/anime/track/AnimeTrackInfoDialog.kt index dcebaf4811..a9052d64ff 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/entries/anime/track/AnimeTrackInfoDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/entries/anime/track/AnimeTrackInfoDialog.kt @@ -301,7 +301,9 @@ private data class TrackStatusSelectorScreen( ) : StateScreenModel(State(track.status)) { fun getSelections(): Map { - return tracker.animeService.getStatusListAnime().associateWith { tracker.getStatus(it) } + return tracker.animeService.getStatusListAnime().associateWith { + (tracker as? AnimeTracker)?.getStatusForAnime(it) + } } fun setSelection(selection: Long) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/entries/manga/track/MangaTrackInfoDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/entries/manga/track/MangaTrackInfoDialog.kt index 8955430bec..53a2c4fa1e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/entries/manga/track/MangaTrackInfoDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/entries/manga/track/MangaTrackInfoDialog.kt @@ -301,7 +301,9 @@ private data class TrackStatusSelectorScreen( ) : StateScreenModel(State(track.status)) { fun getSelections(): Map { - return tracker.mangaService.getStatusListManga().associateWith { tracker.getStatus(it) } + return tracker.mangaService.getStatusListManga().associateWith { + (tracker as? MangaTracker)?.getStatusForManga(it) + } } fun setSelection(selection: Long) { diff --git a/app/src/main/java/eu/kanade/test/DummyTracker.kt b/app/src/main/java/eu/kanade/test/DummyTracker.kt index 0c6ac38478..8ad8af58e8 100644 --- a/app/src/main/java/eu/kanade/test/DummyTracker.kt +++ b/app/src/main/java/eu/kanade/test/DummyTracker.kt @@ -1,7 +1,6 @@ package eu.kanade.test import android.graphics.Color -import dev.icerock.moko.resources.StringResource import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.track.Tracker import eu.kanade.tachiyomi.data.track.model.AnimeTrackSearch @@ -11,7 +10,6 @@ import kotlinx.collections.immutable.toImmutableList import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flowOf import okhttp3.OkHttpClient -import tachiyomi.i18n.MR data class DummyTracker( override val id: Long, @@ -36,18 +34,6 @@ data class DummyTracker( override fun getLogo(): Int = valLogo - override fun getStatus(status: Long): StringResource? = when (status) { - 1L -> MR.strings.reading - 2L -> MR.strings.plan_to_read - 3L -> MR.strings.completed - 4L -> MR.strings.on_hold - 5L -> MR.strings.dropped - 6L -> MR.strings.repeating - 7L -> MR.strings.watching - 8L -> MR.strings.plan_to_watch - else -> null - } - override fun getCompletionStatus(): Long = valCompletionStatus override fun getScoreList(): ImmutableList = valScoreList