Make tracker status wording/ordering more consistent

This commit is contained in:
arkon 2022-01-08 15:49:39 -05:00
parent 375a27a93d
commit 3dc4fd8dd1
10 changed files with 41 additions and 43 deletions

View File

@ -17,10 +17,10 @@ class Anilist(private val context: Context, id: Int) : TrackService(id) {
companion object { companion object {
const val READING = 1 const val READING = 1
const val COMPLETED = 2 const val COMPLETED = 2
const val PAUSED = 3 const val ON_HOLD = 3
const val DROPPED = 4 const val DROPPED = 4
const val PLANNING = 5 const val PLAN_TO_READ = 5
const val REPEATING = 6 const val REREADING = 6
const val POINT_100 = "POINT_100" const val POINT_100 = "POINT_100"
const val POINT_10 = "POINT_10" const val POINT_10 = "POINT_10"
@ -57,24 +57,24 @@ class Anilist(private val context: Context, id: Int) : TrackService(id) {
override fun getLogoColor() = Color.rgb(18, 25, 35) override fun getLogoColor() = Color.rgb(18, 25, 35)
override fun getStatusList(): List<Int> { override fun getStatusList(): List<Int> {
return listOf(READING, PLANNING, COMPLETED, REPEATING, PAUSED, DROPPED) return listOf(READING, COMPLETED, ON_HOLD, DROPPED, PLAN_TO_READ, REREADING)
} }
override fun getStatus(status: Int): String = with(context) { override fun getStatus(status: Int): String = with(context) {
when (status) { when (status) {
READING -> getString(R.string.reading) READING -> getString(R.string.reading)
PLANNING -> getString(R.string.plan_to_read) PLAN_TO_READ -> getString(R.string.plan_to_read)
COMPLETED -> getString(R.string.completed) COMPLETED -> getString(R.string.completed)
REPEATING -> getString(R.string.repeating) ON_HOLD -> getString(R.string.on_hold)
PAUSED -> getString(R.string.paused)
DROPPED -> getString(R.string.dropped) DROPPED -> getString(R.string.dropped)
REREADING -> getString(R.string.repeating)
else -> "" else -> ""
} }
} }
override fun getReadingStatus(): Int = READING override fun getReadingStatus(): Int = READING
override fun getRereadingStatus(): Int = REPEATING override fun getRereadingStatus(): Int = REREADING
override fun getCompletionStatus(): Int = COMPLETED override fun getCompletionStatus(): Int = COMPLETED
@ -151,7 +151,7 @@ class Anilist(private val context: Context, id: Int) : TrackService(id) {
if (track.last_chapter_read.toInt() == track.total_chapters && track.total_chapters > 0) { if (track.last_chapter_read.toInt() == track.total_chapters && track.total_chapters > 0) {
track.status = COMPLETED track.status = COMPLETED
track.finished_reading_date = System.currentTimeMillis() track.finished_reading_date = System.currentTimeMillis()
} else if (track.status != REPEATING) { } else if (track.status != REREADING) {
track.status = READING track.status = READING
if (track.last_chapter_read == 1F) { if (track.last_chapter_read == 1F) {
track.started_reading_date = System.currentTimeMillis() track.started_reading_date = System.currentTimeMillis()
@ -170,14 +170,14 @@ class Anilist(private val context: Context, id: Int) : TrackService(id) {
track.library_id = remoteTrack.library_id track.library_id = remoteTrack.library_id
if (track.status != COMPLETED) { if (track.status != COMPLETED) {
val isRereading = track.status == REPEATING val isRereading = track.status == REREADING
track.status = if (isRereading.not() && hasReadChapters) READING else track.status track.status = if (isRereading.not() && hasReadChapters) READING else track.status
} }
update(track) update(track)
} else { } else {
// Set default fields if it's not found in the list // Set default fields if it's not found in the list
track.status = if (hasReadChapters) READING else PLANNING track.status = if (hasReadChapters) READING else PLAN_TO_READ
track.score = 0F track.score = 0F
add(track) add(track)
} }

View File

@ -64,10 +64,10 @@ data class ALUserManga(
fun toTrackStatus() = when (list_status) { fun toTrackStatus() = when (list_status) {
"CURRENT" -> Anilist.READING "CURRENT" -> Anilist.READING
"COMPLETED" -> Anilist.COMPLETED "COMPLETED" -> Anilist.COMPLETED
"PAUSED" -> Anilist.PAUSED "PAUSED" -> Anilist.ON_HOLD
"DROPPED" -> Anilist.DROPPED "DROPPED" -> Anilist.DROPPED
"PLANNING" -> Anilist.PLANNING "PLANNING" -> Anilist.PLAN_TO_READ
"REPEATING" -> Anilist.REPEATING "REPEATING" -> Anilist.REREADING
else -> throw NotImplementedError("Unknown status: $list_status") else -> throw NotImplementedError("Unknown status: $list_status")
} }
} }
@ -75,10 +75,10 @@ data class ALUserManga(
fun Track.toAnilistStatus() = when (status) { fun Track.toAnilistStatus() = when (status) {
Anilist.READING -> "CURRENT" Anilist.READING -> "CURRENT"
Anilist.COMPLETED -> "COMPLETED" Anilist.COMPLETED -> "COMPLETED"
Anilist.PAUSED -> "PAUSED" Anilist.ON_HOLD -> "PAUSED"
Anilist.DROPPED -> "DROPPED" Anilist.DROPPED -> "DROPPED"
Anilist.PLANNING -> "PLANNING" Anilist.PLAN_TO_READ -> "PLANNING"
Anilist.REPEATING -> "REPEATING" Anilist.REREADING -> "REPEATING"
else -> throw NotImplementedError("Unknown status: $status") else -> throw NotImplementedError("Unknown status: $status")
} }

View File

@ -66,7 +66,7 @@ class Bangumi(private val context: Context, id: Int) : TrackService(id) {
refresh(track) refresh(track)
} else { } else {
// Set default fields if it's not found in the list // Set default fields if it's not found in the list
track.status = if (hasReadChapters) READING else PLANNING track.status = if (hasReadChapters) READING else PLAN_TO_READ
track.score = 0F track.score = 0F
add(track) add(track)
update(track) update(track)
@ -91,16 +91,16 @@ class Bangumi(private val context: Context, id: Int) : TrackService(id) {
override fun getLogoColor() = Color.rgb(240, 145, 153) override fun getLogoColor() = Color.rgb(240, 145, 153)
override fun getStatusList(): List<Int> { override fun getStatusList(): List<Int> {
return listOf(READING, COMPLETED, ON_HOLD, DROPPED, PLANNING) return listOf(READING, COMPLETED, ON_HOLD, DROPPED, PLAN_TO_READ)
} }
override fun getStatus(status: Int): String = with(context) { override fun getStatus(status: Int): String = with(context) {
when (status) { when (status) {
READING -> getString(R.string.reading) READING -> getString(R.string.reading)
PLAN_TO_READ -> getString(R.string.plan_to_read)
COMPLETED -> getString(R.string.completed) COMPLETED -> getString(R.string.completed)
ON_HOLD -> getString(R.string.on_hold) ON_HOLD -> getString(R.string.on_hold)
DROPPED -> getString(R.string.dropped) DROPPED -> getString(R.string.dropped)
PLANNING -> getString(R.string.plan_to_read)
else -> "" else -> ""
} }
} }
@ -146,6 +146,6 @@ class Bangumi(private val context: Context, id: Int) : TrackService(id) {
const val COMPLETED = 2 const val COMPLETED = 2
const val ON_HOLD = 4 const val ON_HOLD = 4
const val DROPPED = 5 const val DROPPED = 5
const val PLANNING = 1 const val PLAN_TO_READ = 1
} }
} }

View File

@ -7,7 +7,7 @@ fun Track.toBangumiStatus() = when (status) {
Bangumi.COMPLETED -> "collect" Bangumi.COMPLETED -> "collect"
Bangumi.ON_HOLD -> "on_hold" Bangumi.ON_HOLD -> "on_hold"
Bangumi.DROPPED -> "dropped" Bangumi.DROPPED -> "dropped"
Bangumi.PLANNING -> "wish" Bangumi.PLAN_TO_READ -> "wish"
else -> throw NotImplementedError("Unknown status: $status") else -> throw NotImplementedError("Unknown status: $status")
} }
@ -16,6 +16,6 @@ fun toTrackStatus(status: String) = when (status) {
"collect" -> Bangumi.COMPLETED "collect" -> Bangumi.COMPLETED
"on_hold" -> Bangumi.ON_HOLD "on_hold" -> Bangumi.ON_HOLD
"dropped" -> Bangumi.DROPPED "dropped" -> Bangumi.DROPPED
"wish" -> Bangumi.PLANNING "wish" -> Bangumi.PLAN_TO_READ
else -> throw NotImplementedError("Unknown status: $status") else -> throw NotImplementedError("Unknown status: $status")
} }

View File

@ -39,13 +39,13 @@ class Kitsu(private val context: Context, id: Int) : TrackService(id) {
override fun getLogoColor() = Color.rgb(51, 37, 50) override fun getLogoColor() = Color.rgb(51, 37, 50)
override fun getStatusList(): List<Int> { override fun getStatusList(): List<Int> {
return listOf(READING, PLAN_TO_READ, COMPLETED, ON_HOLD, DROPPED) return listOf(READING, COMPLETED, ON_HOLD, DROPPED, PLAN_TO_READ)
} }
override fun getStatus(status: Int): String = with(context) { override fun getStatus(status: Int): String = with(context) {
when (status) { when (status) {
READING -> getString(R.string.currently_reading) READING -> getString(R.string.reading)
PLAN_TO_READ -> getString(R.string.want_to_read) PLAN_TO_READ -> getString(R.string.plan_to_read)
COMPLETED -> getString(R.string.completed) COMPLETED -> getString(R.string.completed)
ON_HOLD -> getString(R.string.on_hold) ON_HOLD -> getString(R.string.on_hold)
DROPPED -> getString(R.string.dropped) DROPPED -> getString(R.string.dropped)

View File

@ -40,7 +40,7 @@ class Komga(private val context: Context, id: Int) : TrackService(id), EnhancedT
override fun getStatus(status: Int): String = with(context) { override fun getStatus(status: Int): String = with(context) {
when (status) { when (status) {
UNREAD -> getString(R.string.unread) UNREAD -> getString(R.string.unread)
READING -> getString(R.string.currently_reading) READING -> getString(R.string.reading)
COMPLETED -> getString(R.string.completed) COMPLETED -> getString(R.string.completed)
else -> "" else -> ""
} }

View File

@ -47,10 +47,10 @@ class MyAnimeList(private val context: Context, id: Int) : TrackService(id) {
override fun getStatus(status: Int): String = with(context) { override fun getStatus(status: Int): String = with(context) {
when (status) { when (status) {
READING -> getString(R.string.reading) READING -> getString(R.string.reading)
PLAN_TO_READ -> getString(R.string.plan_to_read)
COMPLETED -> getString(R.string.completed) COMPLETED -> getString(R.string.completed)
ON_HOLD -> getString(R.string.on_hold) ON_HOLD -> getString(R.string.on_hold)
DROPPED -> getString(R.string.dropped) DROPPED -> getString(R.string.dropped)
PLAN_TO_READ -> getString(R.string.plan_to_read)
REREADING -> getString(R.string.repeating) REREADING -> getString(R.string.repeating)
else -> "" else -> ""
} }

View File

@ -19,8 +19,8 @@ class Shikimori(private val context: Context, id: Int) : TrackService(id) {
const val COMPLETED = 2 const val COMPLETED = 2
const val ON_HOLD = 3 const val ON_HOLD = 3
const val DROPPED = 4 const val DROPPED = 4
const val PLANNING = 5 const val PLAN_TO_READ = 5
const val REPEATING = 6 const val REREADING = 6
} }
private val json: Json by injectLazy() private val json: Json by injectLazy()
@ -49,7 +49,7 @@ class Shikimori(private val context: Context, id: Int) : TrackService(id) {
if (didReadChapter) { if (didReadChapter) {
if (track.last_chapter_read.toInt() == track.total_chapters && track.total_chapters > 0) { if (track.last_chapter_read.toInt() == track.total_chapters && track.total_chapters > 0) {
track.status = COMPLETED track.status = COMPLETED
} else if (track.status != REPEATING) { } else if (track.status != REREADING) {
track.status = READING track.status = READING
} }
} }
@ -65,14 +65,14 @@ class Shikimori(private val context: Context, id: Int) : TrackService(id) {
track.library_id = remoteTrack.library_id track.library_id = remoteTrack.library_id
if (track.status != COMPLETED) { if (track.status != COMPLETED) {
val isRereading = track.status == REPEATING val isRereading = track.status == REREADING
track.status = if (isRereading.not() && hasReadChapters) READING else track.status track.status = if (isRereading.not() && hasReadChapters) READING else track.status
} }
update(track) update(track)
} else { } else {
// Set default fields if it's not found in the list // Set default fields if it's not found in the list
track.status = if (hasReadChapters) READING else PLANNING track.status = if (hasReadChapters) READING else PLAN_TO_READ
track.score = 0F track.score = 0F
add(track) add(track)
} }
@ -95,24 +95,24 @@ class Shikimori(private val context: Context, id: Int) : TrackService(id) {
override fun getLogoColor() = Color.rgb(40, 40, 40) override fun getLogoColor() = Color.rgb(40, 40, 40)
override fun getStatusList(): List<Int> { override fun getStatusList(): List<Int> {
return listOf(READING, COMPLETED, ON_HOLD, DROPPED, PLANNING, REPEATING) return listOf(READING, COMPLETED, ON_HOLD, DROPPED, PLAN_TO_READ, REREADING)
} }
override fun getStatus(status: Int): String = with(context) { override fun getStatus(status: Int): String = with(context) {
when (status) { when (status) {
READING -> getString(R.string.reading) READING -> getString(R.string.reading)
PLAN_TO_READ -> getString(R.string.plan_to_read)
COMPLETED -> getString(R.string.completed) COMPLETED -> getString(R.string.completed)
ON_HOLD -> getString(R.string.on_hold) ON_HOLD -> getString(R.string.on_hold)
DROPPED -> getString(R.string.dropped) DROPPED -> getString(R.string.dropped)
PLANNING -> getString(R.string.plan_to_read) REREADING -> getString(R.string.repeating)
REPEATING -> getString(R.string.repeating)
else -> "" else -> ""
} }
} }
override fun getReadingStatus(): Int = READING override fun getReadingStatus(): Int = READING
override fun getRereadingStatus(): Int = REPEATING override fun getRereadingStatus(): Int = REREADING
override fun getCompletionStatus(): Int = COMPLETED override fun getCompletionStatus(): Int = COMPLETED

View File

@ -7,8 +7,8 @@ fun Track.toShikimoriStatus() = when (status) {
Shikimori.COMPLETED -> "completed" Shikimori.COMPLETED -> "completed"
Shikimori.ON_HOLD -> "on_hold" Shikimori.ON_HOLD -> "on_hold"
Shikimori.DROPPED -> "dropped" Shikimori.DROPPED -> "dropped"
Shikimori.PLANNING -> "planned" Shikimori.PLAN_TO_READ -> "planned"
Shikimori.REPEATING -> "rewatching" Shikimori.REREADING -> "rewatching"
else -> throw NotImplementedError("Unknown status: $status") else -> throw NotImplementedError("Unknown status: $status")
} }
@ -17,7 +17,7 @@ fun toTrackStatus(status: String) = when (status) {
"completed" -> Shikimori.COMPLETED "completed" -> Shikimori.COMPLETED
"on_hold" -> Shikimori.ON_HOLD "on_hold" -> Shikimori.ON_HOLD
"dropped" -> Shikimori.DROPPED "dropped" -> Shikimori.DROPPED
"planned" -> Shikimori.PLANNING "planned" -> Shikimori.PLAN_TO_READ
"rewatching" -> Shikimori.REPEATING "rewatching" -> Shikimori.REREADING
else -> throw NotImplementedError("Unknown status: $status") else -> throw NotImplementedError("Unknown status: $status")
} }

View File

@ -629,13 +629,11 @@
<string name="add_tracking">Add tracking</string> <string name="add_tracking">Add tracking</string>
<string name="unread">Unread</string> <string name="unread">Unread</string>
<string name="reading">Reading</string> <string name="reading">Reading</string>
<string name="currently_reading">Currently reading</string>
<string name="completed">Completed</string> <string name="completed">Completed</string>
<string name="dropped">Dropped</string> <string name="dropped">Dropped</string>
<string name="on_hold">On hold</string> <string name="on_hold">On hold</string>
<string name="paused">Paused</string> <string name="paused">Paused</string>
<string name="plan_to_read">Plan to read</string> <string name="plan_to_read">Plan to read</string>
<string name="want_to_read">Want to read</string>
<string name="repeating">Rereading</string> <string name="repeating">Rereading</string>
<string name="score">Score</string> <string name="score">Score</string>
<string name="title">Title</string> <string name="title">Title</string>