From 15ab79a97ea3c3acc23c604a8450ac7829189146 Mon Sep 17 00:00:00 2001 From: HapeLee <1321903405@qq.com> Date: Sun, 2 Nov 2025 23:56:41 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B5=E8=84=9A=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/help/config/ReadTipConfig.kt | 4 +++- .../io/legado/app/ui/book/read/page/PageView.kt | 7 +++++++ .../java/io/legado/app/ui/widget/BatteryView.kt | 16 +++++++--------- .../io/legado/app/ui/widget/BatteryViewOrgin.kt | 2 +- app/src/main/res/layout/view_battery.xml | 2 +- app/src/main/res/layout/view_read_menu.xml | 5 ++++- app/src/main/res/values-zh-rHK/arrays.xml | 1 + app/src/main/res/values-zh-rTW/arrays.xml | 1 + app/src/main/res/values-zh/arrays.xml | 1 + app/src/main/res/values/arrays.xml | 1 + 10 files changed, 27 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/config/ReadTipConfig.kt b/app/src/main/java/io/legado/app/help/config/ReadTipConfig.kt index 2d57d0aba..7ce3b63ec 100644 --- a/app/src/main/java/io/legado/app/help/config/ReadTipConfig.kt +++ b/app/src/main/java/io/legado/app/help/config/ReadTipConfig.kt @@ -24,9 +24,11 @@ object ReadTipConfig { const val batteryIcon = 14 const val batteryClassic = 15 const val timeBatteryClassic = 16 + const val chapterTitleArrowClassic = 17 + val tipValues = arrayOf( - none, bookName, chapterTitle, chapterTitleArrow, time, battery, batteryClassic, batteryInside, batteryIcon, batteryPercentage, page, + none, bookName, chapterTitle, chapterTitleArrow, chapterTitleArrowClassic, time, battery, batteryClassic, batteryInside, batteryIcon, batteryPercentage, page, totalProgress, totalProgress1, pageAndTotal, timeBattery, timeBatteryClassic, timeBatteryPercentage ) val tipNames get() = appCtx.resources.getStringArray(R.array.read_tip).toList() diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt b/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt index 87ab7ae7c..57644ad4f 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt @@ -59,6 +59,7 @@ class PageView(context: Context) : FrameLayout(context) { private var tvBatteryIcon: BatteryView? = null private var tvBatteryClassic: BatteryView? = null private var tvTimeBatteryClassic: BatteryView? = null + private var tvTitleArrowClassic: BatteryView? = null private var isMainView = false var isScroll = false @@ -190,6 +191,11 @@ class PageView(context: Context) : FrameLayout(context) { } tvTitleArrow = getTipView(ReadTipConfig.chapterTitleArrow)?.apply { tag = ReadTipConfig.chapterTitleArrow + textSize = 12f + batteryMode = BatteryView.BatteryMode.ARROW + } + tvTitleArrowClassic = getTipView(ReadTipConfig.chapterTitleArrowClassic)?.apply { + tag = ReadTipConfig.chapterTitleArrowClassic typeface = ChapterProvider.typeface textSize = 12f batteryMode = BatteryView.BatteryMode.ARROW @@ -390,6 +396,7 @@ class PageView(context: Context) : FrameLayout(context) { tvBookName?.setTextIfNotEqual(ReadBook.book?.name) tvTitle?.setTextIfNotEqual(textPage.title) tvTitleArrow?.setTextIfNotEqual(textPage.title) + tvTitleArrowClassic?.setTextIfNotEqual(textPage.title) val readProgress = readProgress tvTotalProgress?.setTextIfNotEqual(readProgress) tvTotalProgress1?.setTextIfNotEqual("${chapterIndex.plus(1)}/${chapterSize}") 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 d87eb23a4..705e8e6b9 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 @@ -21,17 +21,12 @@ class BatteryView @JvmOverloads constructor( enum class BatteryMode { OUTER, INNER, ICON, ARROW, TIME, CLASSIC, NO_BATTERY } -// private val batteryTypeface by lazy { -// Typeface.createFromAsset(context.assets, "font/number.ttf") -// } + private val batteryTypeface by lazy { + Typeface.createFromAsset(context.assets, "font/number.ttf") + } private var battery: Int = 0 - init { - //binding.batteryText.typeface = batteryTypeface - //binding.batteryTextInner.typeface = batteryTypeface - } - var text: CharSequence? get() = binding.batteryText.text set(value) { @@ -75,7 +70,10 @@ class BatteryView @JvmOverloads constructor( } BatteryMode.CLASSIC -> { + binding.batteryText.typeface = batteryTypeface + binding.batteryTextInner.typeface = batteryTypeface binding.batteryClassic.isBattery = true + binding.batteryClassic.textSize = 11f binding.batteryClassic.setBattery(battery, text) } @@ -169,7 +167,7 @@ class BatteryView @JvmOverloads constructor( private fun updateFill() { post { - val maxWidth = 14.dpToPx() + val maxWidth = 17.dpToPx() val params = binding.batteryFill.layoutParams params.width = (maxWidth * battery / 100f).toInt() binding.batteryFill.layoutParams = params diff --git a/app/src/main/java/io/legado/app/ui/widget/BatteryViewOrgin.kt b/app/src/main/java/io/legado/app/ui/widget/BatteryViewOrgin.kt index 86a839733..3aa74c3f9 100644 --- a/app/src/main/java/io/legado/app/ui/widget/BatteryViewOrgin.kt +++ b/app/src/main/java/io/legado/app/ui/widget/BatteryViewOrgin.kt @@ -27,7 +27,7 @@ class BatteryViewOrgin @JvmOverloads constructor( private val outFrame = Rect() private val polar = Rect() private val canvasRecorder = CanvasRecorderFactory.create() - var isBattery = false + var isBattery = true set(value) { field = value if (value && !isInEditMode) { diff --git a/app/src/main/res/layout/view_battery.xml b/app/src/main/res/layout/view_battery.xml index 08dcd99d4..debb0cd7b 100644 --- a/app/src/main/res/layout/view_battery.xml +++ b/app/src/main/res/layout/view_battery.xml @@ -57,7 +57,7 @@ diff --git a/app/src/main/res/values-zh-rHK/arrays.xml b/app/src/main/res/values-zh-rHK/arrays.xml index 9980ec118..b5215116f 100644 --- a/app/src/main/res/values-zh-rHK/arrays.xml +++ b/app/src/main/res/values-zh-rHK/arrays.xml @@ -51,6 +51,7 @@ 書名 標題 + 標題+箭頭(使用系統字體) 標題+箭頭 時間 電量 diff --git a/app/src/main/res/values-zh-rTW/arrays.xml b/app/src/main/res/values-zh-rTW/arrays.xml index 6007cc4f0..339b5dcea 100644 --- a/app/src/main/res/values-zh-rTW/arrays.xml +++ b/app/src/main/res/values-zh-rTW/arrays.xml @@ -88,6 +88,7 @@ 書名 標題 + 標題+箭頭(使用系統字體) 標題+箭頭 時間 電量 diff --git a/app/src/main/res/values-zh/arrays.xml b/app/src/main/res/values-zh/arrays.xml index 2ffddb1b3..5bc1afd4b 100644 --- a/app/src/main/res/values-zh/arrays.xml +++ b/app/src/main/res/values-zh/arrays.xml @@ -75,6 +75,7 @@ 书名 标题 + 带箭头的标题(使用系统字体) 带箭头的标题 时间 电量 diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index 839f29fa4..902a7e5d2 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -142,6 +142,7 @@ Blank Book name Title + Title With Arrow using System Fonts Title With Arrow Time Battery