pull/32/head
kunfei 5 years ago
parent 4d1134a964
commit da16dd528c
  1. 63
      app/src/main/java/io/legado/app/ui/readbook/config/ReadStyleDialog.kt

@ -200,64 +200,33 @@ class ReadStyleDialog : DialogFragment() {
} }
} }
} }
tv_bg0.onClick { tv_bg0.onClick { changeBg(0) }
ReadBookConfig.styleSelect = 0 tv_bg0.onLongClick { showBgTextConfig(0) }
ReadBookConfig.upBg() tv_bg1.onClick { changeBg(1) }
upBg() tv_bg1.onLongClick { showBgTextConfig(1) }
postEvent(Bus.UP_CONFIG, true) tv_bg2.onClick { changeBg(2) }
} tv_bg2.onLongClick { showBgTextConfig(2) }
tv_bg0.onLongClick { tv_bg3.onClick { changeBg(3) }
showBgTextConfig() tv_bg3.onLongClick { showBgTextConfig(3) }
false tv_bg4.onClick { changeBg(4) }
} tv_bg4.onLongClick { showBgTextConfig(4) }
tv_bg1.onClick {
ReadBookConfig.styleSelect = 1
ReadBookConfig.upBg()
upBg()
postEvent(Bus.UP_CONFIG, true)
}
tv_bg1.onLongClick {
showBgTextConfig()
false
}
tv_bg2.onClick {
ReadBookConfig.styleSelect = 2
ReadBookConfig.upBg()
upBg()
postEvent(Bus.UP_CONFIG, true)
}
tv_bg2.onLongClick {
showBgTextConfig()
false
} }
tv_bg3.onClick {
ReadBookConfig.styleSelect = 3 private fun changeBg(index: Int) {
ReadBookConfig.upBg() ReadBookConfig.styleSelect = index
upBg()
postEvent(Bus.UP_CONFIG, true)
}
tv_bg3.onLongClick {
showBgTextConfig()
false
}
tv_bg4.onClick {
ReadBookConfig.styleSelect = 4
ReadBookConfig.upBg() ReadBookConfig.upBg()
upBg() upBg()
postEvent(Bus.UP_CONFIG, true) postEvent(Bus.UP_CONFIG, true)
} }
tv_bg4.onLongClick {
showBgTextConfig()
false
}
}
private fun showBgTextConfig() { private fun showBgTextConfig(index: Int): Boolean {
dismiss() dismiss()
changeBg(index)
val activity = activity val activity = activity
if (activity is ReadBookActivity) { if (activity is ReadBookActivity) {
activity.showBgTextConfig() activity.showBgTextConfig()
} }
return true
} }
private fun setBg() { private fun setBg() {

Loading…
Cancel
Save