From d32939fca192e7f173760440c6d511ff50f2d22e Mon Sep 17 00:00:00 2001 From: gedoor Date: Mon, 14 Dec 2020 13:12:31 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0lib?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 74a7b5b01..acf098c9e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -169,7 +169,7 @@ dependencies { implementation 'com.jayway.jsonpath:json-path:2.5.0' //JS rhino - implementation 'com.github.gedoor:rhino-android:1.4' + implementation 'com.github.gedoor:rhino-android:1.5' //网络 implementation 'com.squareup.okhttp3:okhttp:4.9.0' From 169457db9635a97f4be73bf54eb3463ba1a13125 Mon Sep 17 00:00:00 2001 From: gedoor Date: Mon, 14 Dec 2020 13:38:21 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E7=94=B5=E6=B1=A0=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E7=A6=81=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 | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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 49cdeb330..3cee7981b 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 @@ -10,14 +10,13 @@ import android.util.AttributeSet import androidx.annotation.ColorInt import androidx.appcompat.widget.AppCompatTextView import io.legado.app.utils.dp -import java.io.File class BatteryView @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null ) : AppCompatTextView(context, attrs) { private val batteryTypeface by lazy { - Typeface.createFromAsset(context.assets, "font${File.separator}number.ttf") + Typeface.createFromAsset(context.assets, "font/number.ttf") } private val batteryPaint = Paint() private val outFrame = Rect() @@ -32,7 +31,7 @@ class BatteryView @JvmOverloads constructor( } init { - setPadding(4.dp, 0, 6.dp, 0) + setPadding(4.dp, 2.dp, 6.dp, 2.dp) batteryPaint.strokeWidth = 1.dp.toFloat() batteryPaint.isAntiAlias = true batteryPaint.color = paint.color @@ -54,9 +53,9 @@ class BatteryView @JvmOverloads constructor( if (!isBattery) return outFrame.set( 1.dp, - layout.getLineBaseline(0) + layout.getLineAscent(0) + 2.dp, + 1.dp, width - 3.dp, - layout.getLineBaseline(0) + 2.dp + height - 1.dp ) val dj = (outFrame.bottom - outFrame.top) / 3 polar.set( From f8f2f7b87ebdf2c5c791c5bdf187816992046eb6 Mon Sep 17 00:00:00 2001 From: gedoor Date: Mon, 14 Dec 2020 13:42:21 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E7=94=B5=E6=B1=A0=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E7=A6=81=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