页脚等
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user