diff --git a/app/src/main/java/io/legado/app/ui/widget/BatteryView.kt b/app/src/main/java/io/legado/app/ui/widget/BatteryView.kt index 3cee7981b..1c4aa8a6c 100644 --- a/app/src/main/java/io/legado/app/ui/widget/BatteryView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/BatteryView.kt @@ -25,7 +25,7 @@ class BatteryView @JvmOverloads constructor( set(value) { field = value if (value) { - typeface = batteryTypeface + super.setTypeface(batteryTypeface) postInvalidate() } } @@ -37,6 +37,12 @@ class BatteryView @JvmOverloads constructor( batteryPaint.color = paint.color } + override fun setTypeface(tf: Typeface?) { + if (!isBattery) { + super.setTypeface(tf) + } + } + fun setColor(@ColorInt color: Int) { setTextColor(color) batteryPaint.color = color