Adjustments to download button colors

This commit is contained in:
Jays2Kings 2021-04-29 00:08:29 -04:00
parent 44c2337e3d
commit b0948cf0a7

View File

@ -21,11 +21,8 @@ class DownloadButton @JvmOverloads constructor(context: Context, attrs: Attribut
private val activeColor = ColorUtils.blendARGB( private val activeColor = ColorUtils.blendARGB(
context.getResourceColor(R.attr.colorAccent), context.getResourceColor(R.attr.colorAccent),
ContextCompat.getColor( context.getResourceColor(android.R.attr.textColorPrimaryInverse),
context, 0.05f
R.color.download
),
0.3f
) )
private val progressBGColor = ContextCompat.getColor( private val progressBGColor = ContextCompat.getColor(
context, context,
@ -35,8 +32,12 @@ class DownloadButton @JvmOverloads constructor(context: Context, attrs: Attribut
context, context,
R.color.material_on_surface_disabled R.color.material_on_surface_disabled
) )
private val downloadedColor = context.getResourceColor(R.attr.colorAccent) private val downloadedColor = ColorUtils.blendARGB(
private val downloadedTextColor = context.getResourceColor(R.attr.colorOnAccent) context.getResourceColor(R.attr.colorAccent),
context.getResourceColor(android.R.attr.textColorPrimary),
0.3f
)
private val downloadedTextColor = context.getResourceColor(android.R.attr.textColorPrimaryInverse)
private val errorColor = ContextCompat.getColor( private val errorColor = ContextCompat.getColor(
context, context,
R.color.material_red_500 R.color.material_red_500
@ -154,6 +155,7 @@ class DownloadButton @JvmOverloads constructor(context: Context, attrs: Attribut
binding.downloadBorder.drawable.setTint(downloadedColor) binding.downloadBorder.drawable.setTint(downloadedColor)
} else { } else {
binding.downloadBorder.setImageDrawable(filledCircle) binding.downloadBorder.setImageDrawable(filledCircle)
binding.downloadBorder.drawable.setTint(downloadedColor)
binding.downloadIcon.drawable.setTint(downloadedTextColor) binding.downloadIcon.drawable.setTint(downloadedTextColor)
} }
} }