A Kotlin-based Android application that allows the user to play music from their device while custom animations fall over the album artwork of the currently playing song.
0
stars
0
forks
source link
Source colours from the theme and apply opacity values programmatically #69
It would be preferable to have a single colour resource for the base colour (no opacity value), list the colour in the appropriate place(s) in the themes.xml file(s) (if necessary), then programmatically apply opacity as required. An example of how to do this can be seen in RecyclerViewScrollbar.kt
val defaultThumbOffColour = MaterialColors.getColor(context, R.attr.colorOnSurface, Color.LTGRAY)
// 84% Alpha
val defaultThumbOffColour84 = MaterialColors.compositeARGBWithAlpha(defaultThumbOffColour, 214)
Currently, the colors.xml file contains multiple entries for the same colour but with varying opacity values e.g.
It would be preferable to have a single colour resource for the base colour (no opacity value), list the colour in the appropriate place(s) in the themes.xml file(s) (if necessary), then programmatically apply opacity as required. An example of how to do this can be seen in RecyclerViewScrollbar.kt