mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-23 05:13:07 +03:00
fix: Use different status strings for anime trackers
This commit is contained in:
parent
03e1ecd75e
commit
74b32a3a0b
19 changed files with 72 additions and 37 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<Application>().toast(e.message) }
|
||||
}
|
||||
}
|
||||
|
||||
fun getStatusForAnime(status: Long): StringResource?
|
||||
}
|
||||
|
|
|
@ -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<Application>().toast(e.message) }
|
||||
}
|
||||
}
|
||||
|
||||
fun getStatusForManga(status: Long): StringResource?
|
||||
}
|
||||
|
|
|
@ -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<String>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -39,7 +39,7 @@ class Jellyfin(id: Long) : BaseTracker(id, "Jellyfin"), EnhancedAnimeTracker, An
|
|||
|
||||
override fun getStatusListAnime(): List<Long> = 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
|
||||
|
|
|
@ -41,7 +41,7 @@ class Kavita(id: Long) : BaseTracker(id, "Kavita"), EnhancedMangaTracker, MangaT
|
|||
|
||||
override fun getStatusListManga(): List<Long> = 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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -38,7 +38,7 @@ class Komga(id: Long) : BaseTracker(id, "Komga"), EnhancedMangaTracker, MangaTra
|
|||
|
||||
override fun getStatusListManga(): List<Long> = 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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -31,7 +31,7 @@ class Suwayomi(id: Long) : BaseTracker(id, "Suwayomi"), EnhancedMangaTracker, Ma
|
|||
|
||||
override fun getStatusListManga(): List<Long> = 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
|
||||
|
|
|
@ -301,7 +301,9 @@ private data class TrackStatusSelectorScreen(
|
|||
) : StateScreenModel<Model.State>(State(track.status)) {
|
||||
|
||||
fun getSelections(): Map<Long, StringResource?> {
|
||||
return tracker.animeService.getStatusListAnime().associateWith { tracker.getStatus(it) }
|
||||
return tracker.animeService.getStatusListAnime().associateWith {
|
||||
(tracker as? AnimeTracker)?.getStatusForAnime(it)
|
||||
}
|
||||
}
|
||||
|
||||
fun setSelection(selection: Long) {
|
||||
|
|
|
@ -301,7 +301,9 @@ private data class TrackStatusSelectorScreen(
|
|||
) : StateScreenModel<Model.State>(State(track.status)) {
|
||||
|
||||
fun getSelections(): Map<Long, StringResource?> {
|
||||
return tracker.mangaService.getStatusListManga().associateWith { tracker.getStatus(it) }
|
||||
return tracker.mangaService.getStatusListManga().associateWith {
|
||||
(tracker as? MangaTracker)?.getStatusForManga(it)
|
||||
}
|
||||
}
|
||||
|
||||
fun setSelection(selection: Long) {
|
||||
|
|
|
@ -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<String> = valScoreList
|
||||
|
|
Loading…
Reference in a new issue