Fix read button coloring
This commit is contained in:
@@ -35,8 +35,9 @@ class ProgressButton @JvmOverloads constructor(
|
||||
private val paint = Paint(Paint.ANTI_ALIAS_FLAG)
|
||||
|
||||
private var progress = 0f
|
||||
private var colorBase = context.getThemeColor(materialR.attr.colorSecondaryContainer)
|
||||
private var colorBase = context.getThemeColor(materialR.attr.colorPrimaryContainer)
|
||||
private var colorProgress = context.getThemeColor(materialR.attr.colorPrimary)
|
||||
private var colorText = context.getThemeColor(materialR.attr.colorOnPrimaryContainer)
|
||||
private var progressAnimator: ValueAnimator? = null
|
||||
|
||||
var title: CharSequence?
|
||||
@@ -70,6 +71,9 @@ class ProgressButton @JvmOverloads constructor(
|
||||
textViewSubtitle.text = getText(R.styleable.ProgressButton_subtitle)
|
||||
colorBase = getColor(R.styleable.ProgressButton_baseColor, colorBase)
|
||||
colorProgress = getColor(R.styleable.ProgressButton_progressColor, colorProgress)
|
||||
colorText = getColor(R.styleable.ProgressButton_textColor, colorText)
|
||||
textViewTitle.setTextColor(colorText)
|
||||
textViewSubtitle.setTextColor(colorText)
|
||||
progress = getInt(R.styleable.ProgressButton_android_progress, 0).toFloat() /
|
||||
getInt(R.styleable.ProgressButton_android_max, 100).toFloat()
|
||||
}
|
||||
@@ -84,6 +88,7 @@ class ProgressButton @JvmOverloads constructor(
|
||||
|
||||
paint.style = Paint.Style.FILL
|
||||
paint.color = colorProgress
|
||||
paint.alpha = 84 // 255 * 0.33F
|
||||
applyGravity()
|
||||
setWillNotDraw(false)
|
||||
}
|
||||
|
||||
@@ -183,8 +183,9 @@
|
||||
app:layout_constraintEnd_toStartOf="@id/button_chapters"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/info_layout"
|
||||
app:progressColor="?colorSecondaryFixedDim"
|
||||
app:progressColor="?colorPrimary"
|
||||
app:subtitleTextAppearance="?textAppearanceBodySmall"
|
||||
app:textColor="?colorOnPrimaryContainer"
|
||||
app:titleTextAppearance="?textAppearanceButton"
|
||||
tools:max="100"
|
||||
tools:progress="40"
|
||||
|
||||
@@ -153,6 +153,7 @@
|
||||
<attr name="subtitleTextAppearance" />
|
||||
<attr name="title" />
|
||||
<attr name="subtitle" />
|
||||
<attr name="textColor" format="color" />
|
||||
<attr name="android:max" />
|
||||
<attr name="android:progress" />
|
||||
<attr name="baseColor" format="color" />
|
||||
|
||||
Reference in New Issue
Block a user