页脚等

This commit is contained in:
HapeLee
2025-11-02 23:56:41 +08:00
parent 3aca94c332
commit 15ab79a97e
10 changed files with 27 additions and 13 deletions
@@ -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()
@@ -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}")
@@ -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
@@ -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) {
+1 -1
View File
@@ -57,7 +57,7 @@
<com.google.android.material.card.MaterialCardView
android:id="@+id/battery_fill"
android:layout_width="14dp"
android:layout_width="17dp"
android:layout_height="8dp"
android:visibility="gone"
android:layout_marginStart="4.2dp"
+4 -1
View File
@@ -58,8 +58,11 @@
<TextView
android:id="@+id/tv_source_action"
android:layout_width="wrap_content"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:maxLines="1"
android:ellipsize="end"
android:gravity="end"
android:paddingVertical="8dp"
android:text="@string/book_source" />
@@ -51,6 +51,7 @@
<item></item>
<item>書名</item>
<item>標題</item>
<item>標題+箭頭(使用系統字體)</item>
<item>標題+箭頭</item>
<item>時間</item>
<item>電量</item>
@@ -88,6 +88,7 @@
<item></item>
<item>書名</item>
<item>標題</item>
<item>標題+箭頭(使用系統字體)</item>
<item>標題+箭頭</item>
<item>時間</item>
<item>電量</item>
+1
View File
@@ -75,6 +75,7 @@
<item></item>
<item>书名</item>
<item>标题</item>
<item>带箭头的标题(使用系统字体)</item>
<item>带箭头的标题</item>
<item>时间</item>
<item>电量</item>
+1
View File
@@ -142,6 +142,7 @@
<item>Blank</item>
<item>Book name</item>
<item>Title</item>
<item>Title With Arrow using System Fonts</item>
<item>Title With Arrow</item>
<item>Time</item>
<item>Battery</item>