pull/1654/merge
kunfei 3 years ago
parent 8dbb887bd5
commit 2dee9178fd
  1. 11
      app/src/main/java/io/legado/app/help/ReadTipConfig.kt
  2. 20
      app/src/main/java/io/legado/app/ui/book/read/config/TipConfigDialog.kt

@ -5,9 +5,7 @@ import io.legado.app.R
import splitties.init.appCtx import splitties.init.appCtx
object ReadTipConfig { object ReadTipConfig {
val tips by lazy { val tips get() = appCtx.resources.getStringArray(R.array.read_tip).toList()
appCtx.resources.getStringArray(R.array.read_tip).toList()
}
const val none = 0 const val none = 0
const val chapterTitle = 1 const val chapterTitle = 1
const val time = 2 const val time = 2
@ -18,13 +16,6 @@ object ReadTipConfig {
const val bookName = 7 const val bookName = 7
const val timeBattery = 8 const val timeBattery = 8
val tipHeaderLeftStr: String get() = tips.getOrElse(tipHeaderLeft) { tips[none] }
val tipHeaderMiddleStr: String get() = tips.getOrElse(tipHeaderMiddle) { tips[none] }
val tipHeaderRightStr: String get() = tips.getOrElse(tipHeaderRight) { tips[none] }
val tipFooterLeftStr: String get() = tips.getOrElse(tipFooterLeft) { tips[none] }
val tipFooterMiddleStr: String get() = tips.getOrElse(tipFooterMiddle) { tips[none] }
val tipFooterRightStr: String get() = tips.getOrElse(tipFooterRight) { tips[none] }
var tipHeaderLeft: Int var tipHeaderLeft: Int
get() = ReadBookConfig.config.tipHeaderLeft get() = ReadBookConfig.config.tipHeaderLeft
set(value) { set(value) {

@ -45,12 +45,20 @@ class TipConfigDialog : BaseDialogFragment(R.layout.dialog_tip_config) {
tvHeaderShow.text = ReadTipConfig.getHeaderModes(requireContext())[ReadTipConfig.headerMode] tvHeaderShow.text = ReadTipConfig.getHeaderModes(requireContext())[ReadTipConfig.headerMode]
tvFooterShow.text = ReadTipConfig.getFooterModes(requireContext())[ReadTipConfig.footerMode] tvFooterShow.text = ReadTipConfig.getFooterModes(requireContext())[ReadTipConfig.footerMode]
tvHeaderLeft.text = ReadTipConfig.tipHeaderLeftStr ReadTipConfig.tips.let { tips ->
tvHeaderMiddle.text = ReadTipConfig.tipHeaderMiddleStr tvHeaderLeft.text =
tvHeaderRight.text = ReadTipConfig.tipHeaderRightStr tips.getOrElse(ReadTipConfig.tipHeaderLeft) { tips[ReadTipConfig.none] }
tvFooterLeft.text = ReadTipConfig.tipFooterLeftStr tvHeaderMiddle.text =
tvFooterMiddle.text = ReadTipConfig.tipFooterMiddleStr tips.getOrElse(ReadTipConfig.tipHeaderMiddle) { tips[ReadTipConfig.none] }
tvFooterRight.text = ReadTipConfig.tipFooterRightStr tvHeaderRight.text =
tips.getOrElse(ReadTipConfig.tipHeaderRight) { tips[ReadTipConfig.none] }
tvFooterLeft.text =
tips.getOrElse(ReadTipConfig.tipFooterLeft) { tips[ReadTipConfig.none] }
tvFooterMiddle.text =
tips.getOrElse(ReadTipConfig.tipFooterMiddle) { tips[ReadTipConfig.none] }
tvFooterRight.text =
tips.getOrElse(ReadTipConfig.tipFooterRight) { tips[ReadTipConfig.none] }
}
upTvTipColor() upTvTipColor()
} }

Loading…
Cancel
Save