Fix initial downloaded badge color

which applies in recents and manga details when theming is off
some refactoring to in DownloadButton as well, like renaming colorSecondary to accentColor
This commit is contained in:
Jays2Kings 2023-03-13 01:41:38 -04:00
parent bccb7c0e03
commit 31ec0ec945
2 changed files with 8 additions and 15 deletions

View file

@ -19,29 +19,22 @@ import eu.kanade.tachiyomi.util.system.getResourceColor
class DownloadButton @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
FrameLayout(context, attrs) {
var colorSecondary = context.getResourceColor(R.attr.colorSecondary)
var accentColor = context.getResourceColor(R.attr.colorSecondary)
set(value) {
field = value
activeColor = colorSecondary
downloadedColor = colorSecondary
activeColor = ColorUtils.blendARGB(value, bgColor, 0.05f)
downloadedColor = ColorUtils.blendARGB(value, cOnBgColor, 0.3f)
}
private val bgColor = context.getResourceColor(R.attr.background)
private var activeColor = ColorUtils.blendARGB(colorSecondary, bgColor, 0.05f)
set(value) { field = ColorUtils.blendARGB(value, bgColor, 0.05f) }
private val cOnBgColor = context.getResourceColor(R.attr.colorOnBackground)
private var downloadedColor = ColorUtils.blendARGB(colorSecondary, cOnBgColor, 0.05f)
set(value) { field = ColorUtils.blendARGB(value, cOnBgColor, 0.3f) }
private val progressBGColor by lazy {
ContextCompat.getColor(context, R.color.divider)
}
private var activeColor = ColorUtils.blendARGB(accentColor, bgColor, 0.05f)
private var downloadedColor = ColorUtils.blendARGB(accentColor, cOnBgColor, 0.3f)
private val progressBGColor by lazy { ContextCompat.getColor(context, R.color.divider) }
private val disabledColor by lazy {
ContextCompat.getColor(context, R.color.material_on_surface_disabled)
}
private val downloadedTextColor = context.getResourceColor(R.attr.background)
private val errorColor by lazy {
ContextCompat.getColor(context, R.color.material_red_500)
}
private val errorColor by lazy { ContextCompat.getColor(context, R.color.material_red_500) }
private val filledCircle by lazy {
ContextCompat.getDrawable(context, R.drawable.filled_circle)?.mutate()
}

View file

@ -160,7 +160,7 @@ class ChapterHolder(
binding.chapterTitle,
ColorStateList.valueOf(it),
)
colorSecondary = it
accentColor = it
}
if (locked) {
isVisible = false