From f8f2f7b87ebdf2c5c791c5bdf187816992046eb6 Mon Sep 17 00:00:00 2001 From: gedoor Date: Mon, 14 Dec 2020 13:42:21 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=B5=E6=B1=A0=E5=9B=BE=E6=A0=87=E7=A6=81?= =?UTF-8?q?=E6=AD=A2=E6=9B=BF=E6=8D=A2=E5=AD=97=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/ui/widget/BatteryView.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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