diff --git a/app/src/main/java/io/legado/app/help/ReadTipConfig.kt b/app/src/main/java/io/legado/app/help/ReadTipConfig.kt index 8515fa07e..9d6452b38 100644 --- a/app/src/main/java/io/legado/app/help/ReadTipConfig.kt +++ b/app/src/main/java/io/legado/app/help/ReadTipConfig.kt @@ -14,6 +14,8 @@ object ReadTipConfig { const val time = 2 const val battery = 3 const val page = 4 + const val totalProgress = 5 + const val pageAndTotal = 6 val tipHeaderLeftStr: String get() = tipArray.getOrElse(tipHeaderLeft) { tipArray[none] } val tipHeaderMiddleStr: String get() = tipArray.getOrElse(tipHeaderMiddle) { tipArray[none] } @@ -53,7 +55,7 @@ object ReadTipConfig { } var tipFooterRight: Int - get() = App.INSTANCE.getPrefInt("tipFooterRight", page) + get() = App.INSTANCE.getPrefInt("tipFooterRight", pageAndTotal) set(value) { App.INSTANCE.putPrefInt("tipFooterRight", value) } diff --git a/app/src/main/java/io/legado/app/ui/about/AboutFragment.kt b/app/src/main/java/io/legado/app/ui/about/AboutFragment.kt index 365381fbd..3b56737cf 100644 --- a/app/src/main/java/io/legado/app/ui/about/AboutFragment.kt +++ b/app/src/main/java/io/legado/app/ui/about/AboutFragment.kt @@ -22,6 +22,7 @@ class AboutFragment : PreferenceFragmentCompat() { private val qqGroups = linkedMapOf( Pair("(QQ群VIP1)701903217", "-iolizL4cbJSutKRpeImHlXlpLDZnzeF"), Pair("(QQ群VIP2)263949160", "xwfh7_csb2Gf3Aw2qexEcEtviLfLfd4L"), + Pair("(QQ群VIP3)680280282", "_N0i7yZObjKSeZQvzoe2ej7j02kLnOOK"), Pair("(QQ群1)805192012", "6GlFKjLeIk5RhQnR3PNVDaKB6j10royo"), Pair("(QQ群2)773736122", "5Bm5w6OgLupXnICbYvbgzpPUgf0UlsJF"), Pair("(QQ群3)981838750", "g_Sgmp2nQPKqcZQ5qPcKLHziwX_mpps9"), diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt b/app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt index ad8b706ac..67e40bf0e 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt @@ -14,6 +14,7 @@ import io.legado.app.help.AppConfig import io.legado.app.help.ReadBookConfig import io.legado.app.help.ReadTipConfig import io.legado.app.ui.book.read.page.entities.TextPage +import io.legado.app.ui.widget.BatteryView import io.legado.app.utils.dp import io.legado.app.utils.getCompatColor import io.legado.app.utils.statusBarHeight @@ -25,6 +26,12 @@ import java.util.* class ContentView(context: Context) : FrameLayout(context) { private var battery = 100 + private var tvTitle: BatteryView? = null + private var tvTime: BatteryView? = null + private var tvBattery: BatteryView? = null + private var tvPage: BatteryView? = null + private var tvTotalProgress: BatteryView? = null + private var tvPageAndTotal: BatteryView? = null val headerHeight: Int get() = if (ReadBookConfig.hideStatusBar) ll_header.height else context.statusBarHeight @@ -94,14 +101,7 @@ class ContentView(context: Context) : FrameLayout(context) { ll_header.isGone = hideHeader ll_footer.isGone = hideFooter } - } - - fun setBg(bg: Drawable?) { - page_panel.background = bg - } - - fun upTime() { - val tvTime = when (ReadTipConfig.time) { + tvTitle = when (ReadTipConfig.chapterTitle) { ReadTipConfig.tipHeaderLeft -> tv_header_left ReadTipConfig.tipHeaderMiddle -> tv_header_middle ReadTipConfig.tipHeaderRight -> tv_header_right @@ -110,13 +110,63 @@ class ContentView(context: Context) : FrameLayout(context) { ReadTipConfig.tipFooterRight -> tv_footer_right else -> null } - tvTime?.isBattery = false - tvTime?.text = timeFormat.format(Date(System.currentTimeMillis())) - } - - fun upBattery(battery: Int) { - this.battery = battery - val tvBattery = when (ReadTipConfig.battery) { + tvTitle?.apply { + isBattery = false + textSize = 12f + } + tvTime = when (ReadTipConfig.time) { + ReadTipConfig.tipHeaderLeft -> tv_header_left + ReadTipConfig.tipHeaderMiddle -> tv_header_middle + ReadTipConfig.tipHeaderRight -> tv_header_right + ReadTipConfig.tipFooterLeft -> tv_footer_left + ReadTipConfig.tipFooterMiddle -> tv_footer_middle + ReadTipConfig.tipFooterRight -> tv_footer_right + else -> null + } + tvTime?.apply { + isBattery = false + textSize = 12f + } + tvBattery = when (ReadTipConfig.battery) { + ReadTipConfig.tipHeaderLeft -> tv_header_left + ReadTipConfig.tipHeaderMiddle -> tv_header_middle + ReadTipConfig.tipHeaderRight -> tv_header_right + ReadTipConfig.tipFooterLeft -> tv_footer_left + ReadTipConfig.tipFooterMiddle -> tv_footer_middle + ReadTipConfig.tipFooterRight -> tv_footer_right + else -> null + } + tvBattery?.apply { + isBattery = true + textSize = 10f + } + tvPage = when (ReadTipConfig.page) { + ReadTipConfig.tipHeaderLeft -> tv_header_left + ReadTipConfig.tipHeaderMiddle -> tv_header_middle + ReadTipConfig.tipHeaderRight -> tv_header_right + ReadTipConfig.tipFooterLeft -> tv_footer_left + ReadTipConfig.tipFooterMiddle -> tv_footer_middle + ReadTipConfig.tipFooterRight -> tv_footer_right + else -> null + } + tvPage?.apply { + isBattery = false + textSize = 12f + } + tvTotalProgress = when (ReadTipConfig.totalProgress) { + ReadTipConfig.tipHeaderLeft -> tv_header_left + ReadTipConfig.tipHeaderMiddle -> tv_header_middle + ReadTipConfig.tipHeaderRight -> tv_header_right + ReadTipConfig.tipFooterLeft -> tv_footer_left + ReadTipConfig.tipFooterMiddle -> tv_footer_middle + ReadTipConfig.tipFooterRight -> tv_footer_right + else -> null + } + tvTotalProgress?.apply { + isBattery = false + textSize = 12f + } + tvPageAndTotal = when (ReadTipConfig.pageAndTotal) { ReadTipConfig.tipHeaderLeft -> tv_header_left ReadTipConfig.tipHeaderMiddle -> tv_header_middle ReadTipConfig.tipHeaderRight -> tv_header_right @@ -125,7 +175,22 @@ class ContentView(context: Context) : FrameLayout(context) { ReadTipConfig.tipFooterRight -> tv_footer_right else -> null } - tvBattery?.isBattery = true + tvPageAndTotal?.apply { + isBattery = false + textSize = 12f + } + } + + fun setBg(bg: Drawable?) { + page_panel.background = bg + } + + fun upTime() { + tvTime?.text = timeFormat.format(Date(System.currentTimeMillis())) + } + + fun upBattery(battery: Int) { + this.battery = battery tvBattery?.setBattery(battery) } @@ -147,28 +212,10 @@ class ContentView(context: Context) : FrameLayout(context) { 2 -> HanLP.convertToTraditionalChinese(textPage.title) else -> textPage.title } - val tvTitle = when (ReadTipConfig.chapterTitle) { - ReadTipConfig.tipHeaderLeft -> tv_header_left - ReadTipConfig.tipHeaderMiddle -> tv_header_middle - ReadTipConfig.tipHeaderRight -> tv_header_right - ReadTipConfig.tipFooterLeft -> tv_footer_left - ReadTipConfig.tipFooterMiddle -> tv_footer_middle - ReadTipConfig.tipFooterRight -> tv_footer_right - else -> null - } - tvTitle?.isBattery = false tvTitle?.text = title - val tvPage = when (ReadTipConfig.page) { - ReadTipConfig.tipHeaderLeft -> tv_header_left - ReadTipConfig.tipHeaderMiddle -> tv_header_middle - ReadTipConfig.tipHeaderRight -> tv_header_right - ReadTipConfig.tipFooterLeft -> tv_footer_left - ReadTipConfig.tipFooterMiddle -> tv_footer_middle - ReadTipConfig.tipFooterRight -> tv_footer_right - else -> null - } - tvPage?.isBattery = false - tvPage?.text = "${index.plus(1)}/$pageSize $readProgress" + tvPage?.text = "${index.plus(1)}/$pageSize" + tvTotalProgress?.text = readProgress + tvPageAndTotal?.text = "${index.plus(1)}/$pageSize $readProgress" } fun onScroll(offset: Float) { diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index d01d5b889..b1046096f 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -102,7 +102,8 @@ 时间 电量 页数 - 总进度 + 进度 + 页数及进度 \ No newline at end of file