|
|
@ -36,30 +36,33 @@ class TipConfigDialog : BaseDialogFragment(R.layout.dialog_tip_config) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun initView() = binding.run { |
|
|
|
private fun initView() { |
|
|
|
rgTitleMode.checkByIndex(ReadBookConfig.titleMode) |
|
|
|
binding.rgTitleMode.checkByIndex(ReadBookConfig.titleMode) |
|
|
|
dsbTitleSize.progress = ReadBookConfig.titleSize |
|
|
|
binding.dsbTitleSize.progress = ReadBookConfig.titleSize |
|
|
|
dsbTitleTop.progress = ReadBookConfig.titleTopSpacing |
|
|
|
binding.dsbTitleTop.progress = ReadBookConfig.titleTopSpacing |
|
|
|
dsbTitleBottom.progress = ReadBookConfig.titleBottomSpacing |
|
|
|
binding.dsbTitleBottom.progress = ReadBookConfig.titleBottomSpacing |
|
|
|
|
|
|
|
|
|
|
|
tvHeaderShow.text = ReadTipConfig.getHeaderModes(requireContext())[ReadTipConfig.headerMode] |
|
|
|
binding.tvHeaderShow.text = |
|
|
|
tvFooterShow.text = ReadTipConfig.getFooterModes(requireContext())[ReadTipConfig.footerMode] |
|
|
|
ReadTipConfig.getHeaderModes(requireContext())[ReadTipConfig.headerMode] |
|
|
|
|
|
|
|
binding.tvFooterShow.text = |
|
|
|
|
|
|
|
ReadTipConfig.getFooterModes(requireContext())[ReadTipConfig.footerMode] |
|
|
|
|
|
|
|
|
|
|
|
ReadTipConfig.tips.let { tips -> |
|
|
|
ReadTipConfig.run { |
|
|
|
tvHeaderLeft.text = |
|
|
|
tipNames.let { tipNames -> |
|
|
|
tips.getOrElse(ReadTipConfig.tipHeaderLeft) { tips[ReadTipConfig.none] } |
|
|
|
binding.tvHeaderLeft.text = |
|
|
|
tvHeaderMiddle.text = |
|
|
|
tipNames.getOrElse(tipValues.indexOf(tipHeaderLeft)) { tipNames[none] } |
|
|
|
tips.getOrElse(ReadTipConfig.tipHeaderMiddle) { tips[ReadTipConfig.none] } |
|
|
|
binding.tvHeaderMiddle.text = |
|
|
|
tvHeaderRight.text = |
|
|
|
tipNames.getOrElse(tipValues.indexOf(tipHeaderMiddle)) { tipNames[none] } |
|
|
|
tips.getOrElse(ReadTipConfig.tipHeaderRight) { tips[ReadTipConfig.none] } |
|
|
|
binding.tvHeaderRight.text = |
|
|
|
tvFooterLeft.text = |
|
|
|
tipNames.getOrElse(tipValues.indexOf(tipHeaderRight)) { tipNames[none] } |
|
|
|
tips.getOrElse(ReadTipConfig.tipFooterLeft) { tips[ReadTipConfig.none] } |
|
|
|
binding.tvFooterLeft.text = |
|
|
|
tvFooterMiddle.text = |
|
|
|
tipNames.getOrElse(tipValues.indexOf(tipFooterLeft)) { tipNames[none] } |
|
|
|
tips.getOrElse(ReadTipConfig.tipFooterMiddle) { tips[ReadTipConfig.none] } |
|
|
|
binding.tvFooterMiddle.text = |
|
|
|
tvFooterRight.text = |
|
|
|
tipNames.getOrElse(tipValues.indexOf(tipFooterMiddle)) { tipNames[none] } |
|
|
|
tips.getOrElse(ReadTipConfig.tipFooterRight) { tips[ReadTipConfig.none] } |
|
|
|
binding.tvFooterRight.text = |
|
|
|
|
|
|
|
tipNames.getOrElse(tipValues.indexOf(tipFooterRight)) { tipNames[none] } |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
upTvTipColor() |
|
|
|
upTvTipColor() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -106,50 +109,50 @@ class TipConfigDialog : BaseDialogFragment(R.layout.dialog_tip_config) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
llHeaderLeft.setOnClickListener { |
|
|
|
llHeaderLeft.setOnClickListener { |
|
|
|
context?.selector(items = ReadTipConfig.tips) { _, i -> |
|
|
|
context?.selector(items = ReadTipConfig.tipNames) { _, i -> |
|
|
|
clearRepeat(i) |
|
|
|
clearRepeat(i) |
|
|
|
ReadTipConfig.tipHeaderLeft = i |
|
|
|
ReadTipConfig.tipHeaderLeft = ReadTipConfig.tipValues[i] |
|
|
|
tvHeaderLeft.text = ReadTipConfig.tips[i] |
|
|
|
tvHeaderLeft.text = ReadTipConfig.tipNames[i] |
|
|
|
postEvent(EventBus.UP_CONFIG, true) |
|
|
|
postEvent(EventBus.UP_CONFIG, true) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
llHeaderMiddle.setOnClickListener { |
|
|
|
llHeaderMiddle.setOnClickListener { |
|
|
|
context?.selector(items = ReadTipConfig.tips) { _, i -> |
|
|
|
context?.selector(items = ReadTipConfig.tipNames) { _, i -> |
|
|
|
clearRepeat(i) |
|
|
|
clearRepeat(i) |
|
|
|
ReadTipConfig.tipHeaderMiddle = i |
|
|
|
ReadTipConfig.tipHeaderMiddle = ReadTipConfig.tipValues[i] |
|
|
|
tvHeaderMiddle.text = ReadTipConfig.tips[i] |
|
|
|
tvHeaderMiddle.text = ReadTipConfig.tipNames[i] |
|
|
|
postEvent(EventBus.UP_CONFIG, true) |
|
|
|
postEvent(EventBus.UP_CONFIG, true) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
llHeaderRight.setOnClickListener { |
|
|
|
llHeaderRight.setOnClickListener { |
|
|
|
context?.selector(items = ReadTipConfig.tips) { _, i -> |
|
|
|
context?.selector(items = ReadTipConfig.tipNames) { _, i -> |
|
|
|
clearRepeat(i) |
|
|
|
clearRepeat(i) |
|
|
|
ReadTipConfig.tipHeaderRight = i |
|
|
|
ReadTipConfig.tipHeaderRight = ReadTipConfig.tipValues[i] |
|
|
|
tvHeaderRight.text = ReadTipConfig.tips[i] |
|
|
|
tvHeaderRight.text = ReadTipConfig.tipNames[i] |
|
|
|
postEvent(EventBus.UP_CONFIG, true) |
|
|
|
postEvent(EventBus.UP_CONFIG, true) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
llFooterLeft.setOnClickListener { |
|
|
|
llFooterLeft.setOnClickListener { |
|
|
|
context?.selector(items = ReadTipConfig.tips) { _, i -> |
|
|
|
context?.selector(items = ReadTipConfig.tipNames) { _, i -> |
|
|
|
clearRepeat(i) |
|
|
|
clearRepeat(i) |
|
|
|
ReadTipConfig.tipFooterLeft = i |
|
|
|
ReadTipConfig.tipFooterLeft = ReadTipConfig.tipValues[i] |
|
|
|
tvFooterLeft.text = ReadTipConfig.tips[i] |
|
|
|
tvFooterLeft.text = ReadTipConfig.tipNames[i] |
|
|
|
postEvent(EventBus.UP_CONFIG, true) |
|
|
|
postEvent(EventBus.UP_CONFIG, true) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
llFooterMiddle.setOnClickListener { |
|
|
|
llFooterMiddle.setOnClickListener { |
|
|
|
context?.selector(items = ReadTipConfig.tips) { _, i -> |
|
|
|
context?.selector(items = ReadTipConfig.tipNames) { _, i -> |
|
|
|
clearRepeat(i) |
|
|
|
clearRepeat(i) |
|
|
|
ReadTipConfig.tipFooterMiddle = i |
|
|
|
ReadTipConfig.tipFooterMiddle = ReadTipConfig.tipValues[i] |
|
|
|
tvFooterMiddle.text = ReadTipConfig.tips[i] |
|
|
|
tvFooterMiddle.text = ReadTipConfig.tipNames[i] |
|
|
|
postEvent(EventBus.UP_CONFIG, true) |
|
|
|
postEvent(EventBus.UP_CONFIG, true) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
llFooterRight.setOnClickListener { |
|
|
|
llFooterRight.setOnClickListener { |
|
|
|
context?.selector(items = ReadTipConfig.tips) { _, i -> |
|
|
|
context?.selector(items = ReadTipConfig.tipNames) { _, i -> |
|
|
|
clearRepeat(i) |
|
|
|
clearRepeat(i) |
|
|
|
ReadTipConfig.tipFooterRight = i |
|
|
|
ReadTipConfig.tipFooterRight = ReadTipConfig.tipValues[i] |
|
|
|
tvFooterRight.text = ReadTipConfig.tips[i] |
|
|
|
tvFooterRight.text = ReadTipConfig.tipNames[i] |
|
|
|
postEvent(EventBus.UP_CONFIG, true) |
|
|
|
postEvent(EventBus.UP_CONFIG, true) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -175,27 +178,27 @@ class TipConfigDialog : BaseDialogFragment(R.layout.dialog_tip_config) { |
|
|
|
if (repeat != none) { |
|
|
|
if (repeat != none) { |
|
|
|
if (tipHeaderLeft == repeat) { |
|
|
|
if (tipHeaderLeft == repeat) { |
|
|
|
tipHeaderLeft = none |
|
|
|
tipHeaderLeft = none |
|
|
|
binding.tvHeaderLeft.text = tips[none] |
|
|
|
binding.tvHeaderLeft.text = tipNames[none] |
|
|
|
} |
|
|
|
} |
|
|
|
if (tipHeaderMiddle == repeat) { |
|
|
|
if (tipHeaderMiddle == repeat) { |
|
|
|
tipHeaderMiddle = none |
|
|
|
tipHeaderMiddle = none |
|
|
|
binding.tvHeaderMiddle.text = tips[none] |
|
|
|
binding.tvHeaderMiddle.text = tipNames[none] |
|
|
|
} |
|
|
|
} |
|
|
|
if (tipHeaderRight == repeat) { |
|
|
|
if (tipHeaderRight == repeat) { |
|
|
|
tipHeaderRight = none |
|
|
|
tipHeaderRight = none |
|
|
|
binding.tvHeaderRight.text = tips[none] |
|
|
|
binding.tvHeaderRight.text = tipNames[none] |
|
|
|
} |
|
|
|
} |
|
|
|
if (tipFooterLeft == repeat) { |
|
|
|
if (tipFooterLeft == repeat) { |
|
|
|
tipFooterLeft = none |
|
|
|
tipFooterLeft = none |
|
|
|
binding.tvFooterLeft.text = tips[none] |
|
|
|
binding.tvFooterLeft.text = tipNames[none] |
|
|
|
} |
|
|
|
} |
|
|
|
if (tipFooterMiddle == repeat) { |
|
|
|
if (tipFooterMiddle == repeat) { |
|
|
|
tipFooterMiddle = none |
|
|
|
tipFooterMiddle = none |
|
|
|
binding.tvFooterMiddle.text = tips[none] |
|
|
|
binding.tvFooterMiddle.text = tipNames[none] |
|
|
|
} |
|
|
|
} |
|
|
|
if (tipFooterRight == repeat) { |
|
|
|
if (tipFooterRight == repeat) { |
|
|
|
tipFooterRight = none |
|
|
|
tipFooterRight = none |
|
|
|
binding.tvFooterRight.text = tips[none] |
|
|
|
binding.tvFooterRight.text = tipNames[none] |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|