This commit is contained in:
tarsin committed 2023-02-04 09:47:16 +08:00
1 parent 773993c6f2
commit 01d8dabef4
2 files changed
+17 -1

No files matched your search

@@ -80,6 +80,22 @@ object EhUtils {
return CATEGORY_VALUES.getOrDefault(type, CATEGORY_VALUES[UNKNOWN])!![0]
}
fun getCategoryColorNullable(category: Int): Int? {
return when (category) {
EhConfig.DOUJINSHI -> BG_COLOR_DOUJINSHI
EhConfig.MANGA -> BG_COLOR_MANGA
EhConfig.ARTIST_CG -> BG_COLOR_ARTIST_CG
EhConfig.GAME_CG -> BG_COLOR_GAME_CG
EhConfig.WESTERN -> BG_COLOR_WESTERN
EhConfig.NON_H -> BG_COLOR_NON_H
EhConfig.IMAGE_SET -> BG_COLOR_IMAGE_SET
EhConfig.COSPLAY -> BG_COLOR_COSPLAY
EhConfig.ASIAN_PORN -> BG_COLOR_ASIAN_PORN
EhConfig.MISC -> BG_COLOR_MISC
else -> null
}?.toInt()
}
fun getCategoryColor(category: Int): Int {
return when (category) {
EhConfig.DOUJINSHI -> BG_COLOR_DOUJINSHI
@@ -573,7 +573,7 @@ class GalleryDetailScene : CollapsingToolbarScene(), View.OnClickListener, Downl
uploader.text = gd.uploader
uploader.alpha = if (gd.disowned) .5f else 1f
category.text = EhUtils.getCategory(gd.category)
category.setTextColor(EhUtils.getCategoryColor(gd.category))
EhUtils.getCategoryColorNullable(gd.category)?.let { category.setTextColor(it) }
}
updateDownloadText()
binding.content.header.run {