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
object ReadTipConfig {
val tips by lazy {
appCtx.resources.getStringArray(R.array.read_tip).toList()
}
val tips get() = appCtx.resources.getStringArray(R.array.read_tip).toList()
const val none = 0
const val chapterTitle = 1
const val time = 2
@ -18,13 +16,6 @@ object ReadTipConfig {
const val bookName = 7
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
get() = ReadBookConfig.config.tipHeaderLeft
set(value) {

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

Loading…
Cancel
Save