优化页眉页脚
This commit is contained in:
@@ -2,6 +2,7 @@ package io.legado.app.ui.book.read.page
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.graphics.Typeface
|
||||
import android.graphics.drawable.LayerDrawable
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.FrameLayout
|
||||
@@ -191,6 +192,7 @@ class PageView(context: Context) : FrameLayout(context) {
|
||||
}
|
||||
tvTitleArrow = getTipView(ReadTipConfig.chapterTitleArrow)?.apply {
|
||||
tag = ReadTipConfig.chapterTitleArrow
|
||||
typeface = Typeface.DEFAULT
|
||||
textSize = 12f
|
||||
batteryMode = BatteryView.BatteryMode.ARROW
|
||||
}
|
||||
@@ -208,6 +210,7 @@ class PageView(context: Context) : FrameLayout(context) {
|
||||
}
|
||||
tvBattery = getTipView(ReadTipConfig.battery)?.apply {
|
||||
tag = ReadTipConfig.battery
|
||||
typeface = Typeface.DEFAULT
|
||||
textSize = 11f
|
||||
batteryMode = BatteryView.BatteryMode.OUTER
|
||||
}
|
||||
@@ -218,11 +221,13 @@ class PageView(context: Context) : FrameLayout(context) {
|
||||
}
|
||||
tvBatteryInside = getTipView(ReadTipConfig.batteryInside)?.apply {
|
||||
tag = ReadTipConfig.batteryInside
|
||||
typeface = Typeface.DEFAULT
|
||||
textSize = 11f
|
||||
batteryMode = BatteryView.BatteryMode.INNER
|
||||
}
|
||||
tvBatteryIcon = getTipView(ReadTipConfig.batteryIcon)?.apply {
|
||||
tag = ReadTipConfig.batteryIcon
|
||||
typeface = Typeface.DEFAULT
|
||||
textSize = 11f
|
||||
batteryMode = BatteryView.BatteryMode.ICON
|
||||
}
|
||||
@@ -258,6 +263,7 @@ class PageView(context: Context) : FrameLayout(context) {
|
||||
}
|
||||
tvTimeBattery = getTipView(ReadTipConfig.timeBattery)?.apply {
|
||||
tag = ReadTipConfig.timeBattery
|
||||
typeface = Typeface.DEFAULT
|
||||
textSize = 11f
|
||||
batteryMode = BatteryView.BatteryMode.TIME
|
||||
}
|
||||
|
||||
@@ -21,10 +21,6 @@ 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 var battery: Int = 0
|
||||
|
||||
var text: CharSequence?
|
||||
@@ -72,8 +68,6 @@ 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)
|
||||
@@ -140,7 +134,7 @@ class BatteryView @JvmOverloads constructor(
|
||||
}
|
||||
BatteryMode.ARROW -> {
|
||||
binding.batteryText.visibility = VISIBLE
|
||||
binding.batteryTextEnd.visibility = VISIBLE
|
||||
binding.batteryTextEnd.visibility = GONE
|
||||
binding.batteryTextInner.visibility = GONE
|
||||
binding.batteryFill.visibility = GONE
|
||||
binding.batteryIcon.visibility = GONE
|
||||
@@ -168,6 +162,9 @@ class BatteryView @JvmOverloads constructor(
|
||||
BatteryMode.NO_BATTERY -> {
|
||||
binding.batteryFill.visibility = GONE
|
||||
binding.batteryIcon.visibility = GONE
|
||||
binding.batteryText.visibility = VISIBLE
|
||||
binding.batteryTextEnd.visibility = GONE
|
||||
binding.batteryTextInner.visibility = GONE
|
||||
binding.arrowIcon.visibility = GONE
|
||||
binding.batteryClassic.visibility = GONE
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user