fix some strings, reorder some tabs

This commit is contained in:
jmir1 2021-05-30 17:26:54 +02:00
parent 9da1e69445
commit 1ef49c8c92
17 changed files with 62 additions and 23 deletions

View file

@ -29,7 +29,7 @@ android {
targetSdkVersion(AndroidConfig.targetSdk)
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
versionCode = 61
versionName = "0.10.12.4-mi"
versionName = "0.10.12.5-mi"
buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"")
buildConfigField("String", "COMMIT_SHA", "\"${getGitSha()}\"")

View file

@ -36,6 +36,8 @@ abstract class TrackService(val id: Int) {
abstract fun getStatusList(): List<Int>
abstract fun getStatusListAnime(): List<Int>
abstract fun getStatus(status: Int): String
abstract fun getCompletionStatus(): Int

View file

@ -18,12 +18,13 @@ class Anilist(private val context: Context, id: Int) : TrackService(id) {
companion object {
const val READING = 1
const val WATCHING = 1
const val WATCHING = 11
const val COMPLETED = 2
const val PAUSED = 3
const val DROPPED = 4
const val PLANNING = 5
const val REPEATING = 6
const val REPEATING_ANIME = 16
const val POINT_100 = "POINT_100"
const val POINT_10 = "POINT_10"
@ -63,12 +64,18 @@ class Anilist(private val context: Context, id: Int) : TrackService(id) {
return listOf(READING, PLANNING, COMPLETED, REPEATING, PAUSED, DROPPED)
}
override fun getStatusListAnime(): List<Int> {
return listOf(WATCHING, PLANNING, COMPLETED, REPEATING_ANIME, PAUSED, DROPPED)
}
override fun getStatus(status: Int): String = with(context) {
when (status) {
WATCHING -> getString(R.string.watching)
READING -> getString(R.string.reading)
PLANNING -> getString(R.string.plan_to_watch)
COMPLETED -> getString(R.string.completed)
REPEATING -> getString(R.string.repeating)
REPEATING_ANIME -> getString(R.string.repeating_anime)
PAUSED -> getString(R.string.paused)
DROPPED -> getString(R.string.dropped)
else -> ""
@ -203,7 +210,7 @@ class Anilist(private val context: Context, id: Int) : TrackService(id) {
update(track)
} else {
// Set default fields if it's not found in the list
track.status = READING
track.status = WATCHING
track.score = 0F
add(track)
}

View file

@ -126,7 +126,7 @@ data class ALUserAnime(
}
fun toTrackStatus() = when (list_status) {
"CURRENT" -> Anilist.READING
"CURRENT" -> Anilist.WATCHING
"COMPLETED" -> Anilist.COMPLETED
"PAUSED" -> Anilist.PAUSED
"DROPPED" -> Anilist.DROPPED

View file

@ -127,6 +127,10 @@ class Bangumi(private val context: Context, id: Int) : TrackService(id) {
return listOf(READING, COMPLETED, ON_HOLD, DROPPED, PLANNING)
}
override fun getStatusListAnime(): List<Int> {
return listOf(READING, COMPLETED, ON_HOLD, DROPPED, PLANNING)
}
override fun getStatus(status: Int): String = with(context) {
when (status) {
READING -> getString(R.string.reading)

View file

@ -42,6 +42,10 @@ class Kitsu(private val context: Context, id: Int) : TrackService(id) {
return listOf(READING, PLAN_TO_READ, COMPLETED, ON_HOLD, DROPPED)
}
override fun getStatusListAnime(): List<Int> {
return listOf(READING, PLAN_TO_READ, COMPLETED, ON_HOLD, DROPPED)
}
override fun getStatus(status: Int): String = with(context) {
when (status) {
READING -> getString(R.string.currently_reading)

View file

@ -44,6 +44,8 @@ class Komga(private val context: Context, id: Int) : TrackService(id), Unattende
override fun getStatusList() = listOf(UNREAD, READING, COMPLETED)
override fun getStatusListAnime() = listOf(UNREAD, READING, COMPLETED)
override fun getStatus(status: Int): String = with(context) {
when (status) {
UNREAD -> getString(R.string.unread)

View file

@ -18,11 +18,14 @@ class MyAnimeList(private val context: Context, id: Int) : TrackService(id) {
companion object {
const val READING = 1
const val WATCHING = 11
const val COMPLETED = 2
const val ON_HOLD = 3
const val DROPPED = 4
const val PLAN_TO_READ = 6
const val PLAN_TO_WATCH = 16
const val REREADING = 7
const val REWATCHING = 17
private const val SEARCH_ID_PREFIX = "id:"
private const val SEARCH_LIST_PREFIX = "my:"
@ -46,14 +49,21 @@ class MyAnimeList(private val context: Context, id: Int) : TrackService(id) {
return listOf(READING, COMPLETED, ON_HOLD, DROPPED, PLAN_TO_READ, REREADING)
}
override fun getStatusListAnime(): List<Int> {
return listOf(WATCHING, COMPLETED, ON_HOLD, DROPPED, PLAN_TO_WATCH, REWATCHING)
}
override fun getStatus(status: Int): String = with(context) {
when (status) {
READING -> getString(R.string.reading)
WATCHING -> getString(R.string.watching)
COMPLETED -> getString(R.string.completed)
ON_HOLD -> getString(R.string.on_hold)
DROPPED -> getString(R.string.dropped)
PLAN_TO_READ -> getString(R.string.plan_to_read)
PLAN_TO_WATCH -> getString(R.string.plan_to_watch)
REREADING -> getString(R.string.repeating)
REWATCHING -> getString(R.string.repeating_anime)
else -> ""
}
}
@ -79,7 +89,7 @@ class MyAnimeList(private val context: Context, id: Int) : TrackService(id) {
}
private suspend fun add(track: AnimeTrack): AnimeTrack {
track.status = READING
track.status = WATCHING
track.score = 0F
return api.updateItem(track)
}

View file

@ -195,7 +195,7 @@ class MyAnimeListApi(private val client: OkHttpClient, interceptor: MyAnimeListI
return withIOContext {
val formBodyBuilder = FormBody.Builder()
.add("status", track.toMyAnimeListStatus() ?: "watching")
.add("is_rewatching", (track.status == MyAnimeList.REREADING).toString())
.add("is_rewatching", (track.status == MyAnimeList.REWATCHING).toString())
.add("score", track.score.toString())
.add("num_watched_episodes", track.last_episode_seen.toString())
convertToIsoDate(track.started_watching_date)?.let {
@ -345,7 +345,7 @@ class MyAnimeListApi(private val client: OkHttpClient, interceptor: MyAnimeListI
val obj = response.jsonObject
return track.apply {
val isRereading = obj["is_rewatching"]!!.jsonPrimitive.boolean
status = if (isRereading) MyAnimeList.REREADING else getStatus(obj["status"]!!.jsonPrimitive.content)
status = if (isRereading) MyAnimeList.REWATCHING else getStatus(obj["status"]!!.jsonPrimitive.content)
last_episode_seen = obj["num_episodes_watched"]!!.jsonPrimitive.int
score = obj["score"]!!.jsonPrimitive.int.toFloat()
obj["start_date"]?.let {

View file

@ -14,22 +14,25 @@ fun Track.toMyAnimeListStatus() = when (status) {
}
fun AnimeTrack.toMyAnimeListStatus() = when (status) {
MyAnimeList.WATCHING -> "watching"
MyAnimeList.READING -> "watching"
MyAnimeList.COMPLETED -> "completed"
MyAnimeList.ON_HOLD -> "on_hold"
MyAnimeList.DROPPED -> "dropped"
MyAnimeList.PLAN_TO_READ -> "plan_to_watch"
MyAnimeList.REREADING -> "watching"
MyAnimeList.PLAN_TO_WATCH -> "plan_to_watch"
MyAnimeList.REWATCHING -> "watching"
else -> null
}
fun getStatus(status: String) = when (status) {
"reading" -> MyAnimeList.READING
"watching" -> MyAnimeList.READING
"watching" -> MyAnimeList.WATCHING
"completed" -> MyAnimeList.COMPLETED
"on_hold" -> MyAnimeList.ON_HOLD
"dropped" -> MyAnimeList.DROPPED
"plan_to_read" -> MyAnimeList.PLAN_TO_READ
"plan_to_watch" -> MyAnimeList.PLAN_TO_READ
"plan_to_watch" -> MyAnimeList.PLAN_TO_WATCH
else -> MyAnimeList.READING
}

View file

@ -122,6 +122,10 @@ class Shikimori(private val context: Context, id: Int) : TrackService(id) {
return listOf(READING, COMPLETED, ON_HOLD, DROPPED, PLANNING, REPEATING)
}
override fun getStatusListAnime(): List<Int> {
return listOf(READING, COMPLETED, ON_HOLD, DROPPED, PLANNING, REPEATING)
}
override fun getStatus(status: Int): String = with(context) {
when (status) {
READING -> getString(R.string.reading)

View file

@ -831,7 +831,7 @@ class AnimePresenter(
fun setTrackerStatus(item: TrackItem, index: Int) {
val track = item.track!!
track.status = item.service.getStatusList()[index]
track.status = item.service.getStatusListAnime()[index]
if (track.status == item.service.getCompletionStatus() && track.total_episodes != 0) {
track.last_episode_seen = track.total_episodes
}

View file

@ -37,7 +37,7 @@ class SetTrackStatusDialog<T> : DialogController
override fun onCreateDialog(savedViewState: Bundle?): Dialog {
val item = item
val statusList = item.service.getStatusList()
val statusList = item.service.getStatusListAnime()
val statusString = statusList.map { item.service.getStatus(it) }
val selectedIndex = statusList.indexOf(item.track?.status)

View file

@ -122,10 +122,10 @@ class BrowseController :
private inner class BrowseAdapter : RouterPagerAdapter(this@BrowseController) {
private val tabTitles = listOf(
R.string.label_sources,
R.string.label_animesources,
R.string.label_extensions,
R.string.label_mangasources,
R.string.label_animeextensions,
R.string.label_mangaextensions,
R.string.label_migration
)
.map { resources!!.getString(it) }
@ -156,10 +156,10 @@ class BrowseController :
companion object {
const val TO_EXTENSIONS_EXTRA = "to_extensions"
const val SOURCES_CONTROLLER = 0
const val ANIMESOURCES_CONTROLLER = 1
const val EXTENSIONS_CONTROLLER = 2
const val ANIMEEXTENSIONS_CONTROLLER = 3
const val SOURCES_CONTROLLER = 1
const val ANIMESOURCES_CONTROLLER = 0
const val EXTENSIONS_CONTROLLER = 3
const val ANIMEEXTENSIONS_CONTROLLER = 2
const val MIGRATION_CONTROLLER = 4
}
}

View file

@ -132,7 +132,7 @@ class LibraryController(
}
override fun getTitle(): String? {
return currentTitle ?: resources?.getString(R.string.label_library)
return currentTitle ?: resources?.getString(R.string.label_mangalibrary)
}
private fun updateTitle() {
@ -140,7 +140,7 @@ class LibraryController(
val currentCategory = adapter?.categories?.getOrNull(binding.libraryPager.currentItem)
var title = if (showCategoryTabs) {
resources?.getString(R.string.label_library)
resources?.getString(R.string.label_mangalibrary)
} else {
currentCategory?.name
}

View file

@ -62,8 +62,8 @@ class UpdatesTabsController() :
private inner class UpdatesTabsAdapter : RouterPagerAdapter(this@UpdatesTabsController) {
private val tabTitles = listOf(
R.string.label_updates,
R.string.label_animeupdates
R.string.label_animeupdates,
R.string.label_updates
)
.map { resources!!.getString(it) }
@ -88,7 +88,7 @@ class UpdatesTabsController() :
}
companion object {
const val UPDATES_CONTROLLER = 0
const val ANIME_UPDATES_CONTROLLER = 1
const val UPDATES_CONTROLLER = 1
const val ANIME_UPDATES_CONTROLLER = 0
}
}

View file

@ -16,15 +16,18 @@
<string name="label_settings">Settings</string>
<string name="label_download_queue">Download queue</string>
<string name="label_library">Library</string>
<string name="label_mangalibrary">Manga</string>
<string name="label_animelib">Anime</string>
<string name="label_manga">Manga</string>
<string name="label_recent_updates">Updates</string>
<string name="label_recent_manga">History</string>
<string name="label_sources">Sources</string>
<string name="label_mangasources">Manga Sources</string>
<string name="label_animesources">Anime Sources</string>
<string name="label_backup">Backup and restore</string>
<string name="label_migration">Migrate</string>
<string name="label_extensions">Extensions</string>
<string name="label_mangaextensions">Manga Extensions</string>
<string name="label_animeextensions">Anime Extensions</string>
<string name="label_extension_info">Extension info</string>
<string name="label_help">Help</string>