Use a Enum for MigrationStatus

This commit is contained in:
Jobobby04 2021-04-06 13:38:06 -04:00
parent 3bf070d88a
commit 6b08889c15
4 changed files with 15 additions and 16 deletions

View File

@ -24,7 +24,7 @@ class MigratingManga(
val migrationJob = parentContext + SupervisorJob() + Dispatchers.Default
var migrationStatus: Int = MigrationStatus.RUNNING
var migrationStatus = MigrationStatus.RUNNING
@Volatile
private var manga: Manga? = null
@ -42,11 +42,3 @@ class MigratingManga(
return MigrationProcessItem(this)
}
}
class MigrationStatus {
companion object {
const val RUNNING = 0
const val MANGA_FOUND = 1
const val MANGA_NOT_FOUND = 2
}
}

View File

@ -55,14 +55,12 @@ class MigrationProcessHolder(
binding.migrationMenu.setVectorCompat(
R.drawable.ic_more_vert_24dp,
view.context
.getResourceColor(R.attr.colorOnPrimary)
view.context.getResourceColor(R.attr.colorOnPrimary)
)
binding.skipManga.setVectorCompat(
R.drawable.ic_close_24dp,
view.context.getResourceColor(
R
.attr.colorOnPrimary
R.attr.colorOnPrimary
)
)
binding.migrationMenu.isInvisible = true
@ -79,7 +77,8 @@ class MigrationProcessHolder(
true
).withFadeTransaction()
)
}.launchIn(adapter.controller.viewScope)
}
.launchIn(adapter.controller.viewScope)
}
/*launchUI {
@ -115,7 +114,8 @@ class MigrationProcessHolder(
true
).withFadeTransaction()
)
}.launchIn(adapter.controller.viewScope)
}
.launchIn(adapter.controller.viewScope)
} else {
binding.migrationMangaCardTo.loadingGroup.isVisible = false
binding.migrationMangaCardTo.title.text = view.context.applicationContext

View File

@ -0,0 +1,7 @@
package eu.kanade.tachiyomi.ui.browse.migration.advanced.process
enum class MigrationStatus {
RUNNING,
MANGA_FOUND,
MANGA_NOT_FOUND
}

View File

@ -44,7 +44,7 @@ class MangaHandler(val client: OkHttpClient, val headers: Headers, val lang: Str
}
}
suspend fun getCovers(manga: MangaInfo, forceLatestCovers: Boolean): List<String> {
private suspend fun getCovers(manga: MangaInfo, forceLatestCovers: Boolean): List<String> {
return if (forceLatestCovers) {
val covers = client.newCall(coverRequest(manga)).await().parseAs<ApiCovers>(MdUtil.jsonParser)
covers.data.map { it.url }