style: rework dynamic colors
Allow the material library to handle dynamic colors. Turns out I was mis-understanding how DynamicColor themes were meant to be used by the material library. Turns out you can just inherit from it and it will work perfectly fine. Refactor the V31 styles to remove our insane shims and finally fix the slapdash dynamic color usage across the main theme and widgets.
This commit is contained in:
@@ -41,14 +41,16 @@ class PlaybackButton @JvmOverloads constructor(
|
||||
scaleType = ScaleType.MATRIX
|
||||
setBackgroundResource(R.drawable.ui_large_unbounded_ripple)
|
||||
|
||||
context.obtainStyledAttributes(attrs, R.styleable.PlaybackButton).use { arr ->
|
||||
val hasIndicator = arr.getBoolean(R.styleable.PlaybackButton_hasIndicator, false)
|
||||
indicatorDrawable = if (hasIndicator) {
|
||||
context.getDrawableSafe(R.drawable.ui_indicator)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
val styledAttrs = context.obtainStyledAttributes(attrs, R.styleable.PlaybackButton)
|
||||
|
||||
val hasIndicator = styledAttrs.getBoolean(R.styleable.PlaybackButton_hasIndicator, false)
|
||||
indicatorDrawable = if (hasIndicator) {
|
||||
context.getDrawableSafe(R.drawable.ui_indicator)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
styledAttrs.recycle()
|
||||
}
|
||||
|
||||
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
||||
|
||||
Reference in New Issue
Block a user