|
|
@ -71,23 +71,17 @@ class ReadStyleDialog : DialogFragment() { |
|
|
|
rg_page_anim.check(rg_page_anim[it].id) |
|
|
|
rg_page_anim.check(rg_page_anim[it].id) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
ReadBookConfig.getConfig().let { |
|
|
|
upStyle() |
|
|
|
tv_text_bold.isSelected = it.textBold |
|
|
|
|
|
|
|
seek_text_size.progress = it.textSize - 5 |
|
|
|
|
|
|
|
tv_text_size.text = it.textSize.toString() |
|
|
|
|
|
|
|
seek_text_letter_spacing.progress = (it.letterSpacing * 10).toInt() + 5 |
|
|
|
|
|
|
|
tv_text_letter_spacing.text = it.letterSpacing.toString() |
|
|
|
|
|
|
|
seek_line_size.progress = it.lineSpacingExtra |
|
|
|
|
|
|
|
tv_line_size.text = it.lineSpacingExtra.toString() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
setBg() |
|
|
|
setBg() |
|
|
|
upBg() |
|
|
|
upBg() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun initOnClick() = with(ReadBookConfig.getConfig()) { |
|
|
|
private fun initOnClick() { |
|
|
|
tv_text_bold.onClick { |
|
|
|
tv_text_bold.onClick { |
|
|
|
|
|
|
|
with(ReadBookConfig.getConfig()) { |
|
|
|
textBold = !textBold |
|
|
|
textBold = !textBold |
|
|
|
tv_text_bold.isSelected = textBold |
|
|
|
tv_text_bold.isSelected = textBold |
|
|
|
|
|
|
|
} |
|
|
|
postEvent(Bus.UP_CONFIG, false) |
|
|
|
postEvent(Bus.UP_CONFIG, false) |
|
|
|
} |
|
|
|
} |
|
|
|
tv_text_font.onClick { |
|
|
|
tv_text_font.onClick { |
|
|
@ -121,73 +115,89 @@ class ReadStyleDialog : DialogFragment() { |
|
|
|
} |
|
|
|
} |
|
|
|
seek_text_size.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener { |
|
|
|
seek_text_size.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener { |
|
|
|
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) { |
|
|
|
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) { |
|
|
|
textSize = progress + 5 |
|
|
|
ReadBookConfig.getConfig().textSize = progress + 5 |
|
|
|
tv_text_size.text = textSize.toString() |
|
|
|
tv_text_size.text = ReadBookConfig.getConfig().textSize.toString() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onStartTrackingTouch(seekBar: SeekBar?) {} |
|
|
|
override fun onStartTrackingTouch(seekBar: SeekBar?) = Unit |
|
|
|
override fun onStopTrackingTouch(seekBar: SeekBar?) { |
|
|
|
override fun onStopTrackingTouch(seekBar: SeekBar?) { |
|
|
|
postEvent(Bus.UP_CONFIG, true) |
|
|
|
postEvent(Bus.UP_CONFIG, true) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
iv_text_size_add.onClick { |
|
|
|
iv_text_size_add.onClick { |
|
|
|
|
|
|
|
with(ReadBookConfig.getConfig()) { |
|
|
|
textSize++ |
|
|
|
textSize++ |
|
|
|
if (textSize > 50) textSize = 50 |
|
|
|
if (textSize > 50) textSize = 50 |
|
|
|
seek_text_size.progress = textSize - 5 |
|
|
|
seek_text_size.progress = textSize - 5 |
|
|
|
tv_text_size.text = textSize.toString() |
|
|
|
tv_text_size.text = textSize.toString() |
|
|
|
|
|
|
|
} |
|
|
|
postEvent(Bus.UP_CONFIG, true) |
|
|
|
postEvent(Bus.UP_CONFIG, true) |
|
|
|
} |
|
|
|
} |
|
|
|
iv_text_size_remove.onClick { |
|
|
|
iv_text_size_remove.onClick { |
|
|
|
|
|
|
|
with(ReadBookConfig.getConfig()) { |
|
|
|
textSize-- |
|
|
|
textSize-- |
|
|
|
if (textSize < 5) textSize = 5 |
|
|
|
if (textSize < 5) textSize = 5 |
|
|
|
seek_text_size.progress = textSize - 5 |
|
|
|
seek_text_size.progress = textSize - 5 |
|
|
|
tv_text_size.text = textSize.toString() |
|
|
|
tv_text_size.text = textSize.toString() |
|
|
|
|
|
|
|
} |
|
|
|
postEvent(Bus.UP_CONFIG, true) |
|
|
|
postEvent(Bus.UP_CONFIG, true) |
|
|
|
} |
|
|
|
} |
|
|
|
seek_text_letter_spacing.setOnSeekBarChangeListener(object : |
|
|
|
seek_text_letter_spacing.setOnSeekBarChangeListener(object : |
|
|
|
SeekBar.OnSeekBarChangeListener { |
|
|
|
SeekBar.OnSeekBarChangeListener { |
|
|
|
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) { |
|
|
|
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) { |
|
|
|
|
|
|
|
with(ReadBookConfig.getConfig()) { |
|
|
|
letterSpacing = (seek_text_letter_spacing.progress - 5) / 10f |
|
|
|
letterSpacing = (seek_text_letter_spacing.progress - 5) / 10f |
|
|
|
tv_text_letter_spacing.text = letterSpacing.toString() |
|
|
|
tv_text_letter_spacing.text = letterSpacing.toString() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onStartTrackingTouch(seekBar: SeekBar?) {} |
|
|
|
override fun onStartTrackingTouch(seekBar: SeekBar?) = Unit |
|
|
|
override fun onStopTrackingTouch(seekBar: SeekBar?) { |
|
|
|
override fun onStopTrackingTouch(seekBar: SeekBar?) { |
|
|
|
postEvent(Bus.UP_CONFIG, true) |
|
|
|
postEvent(Bus.UP_CONFIG, true) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
iv_text_letter_spacing_add.onClick { |
|
|
|
iv_text_letter_spacing_add.onClick { |
|
|
|
|
|
|
|
with(ReadBookConfig.getConfig()) { |
|
|
|
letterSpacing += 0.1f |
|
|
|
letterSpacing += 0.1f |
|
|
|
seek_text_letter_spacing.progress = (letterSpacing * 10).toInt() + 5 |
|
|
|
seek_text_letter_spacing.progress = (letterSpacing * 10).toInt() + 5 |
|
|
|
tv_text_letter_spacing.text = letterSpacing.toString() |
|
|
|
tv_text_letter_spacing.text = letterSpacing.toString() |
|
|
|
|
|
|
|
} |
|
|
|
postEvent(Bus.UP_CONFIG, true) |
|
|
|
postEvent(Bus.UP_CONFIG, true) |
|
|
|
} |
|
|
|
} |
|
|
|
iv_text_letter_spacing_remove.onClick { |
|
|
|
iv_text_letter_spacing_remove.onClick { |
|
|
|
|
|
|
|
with(ReadBookConfig.getConfig()) { |
|
|
|
letterSpacing -= 0.1f |
|
|
|
letterSpacing -= 0.1f |
|
|
|
seek_text_letter_spacing.progress = (letterSpacing * 10).toInt() + 5 |
|
|
|
seek_text_letter_spacing.progress = (letterSpacing * 10).toInt() + 5 |
|
|
|
tv_text_letter_spacing.text = letterSpacing.toString() |
|
|
|
tv_text_letter_spacing.text = letterSpacing.toString() |
|
|
|
|
|
|
|
} |
|
|
|
postEvent(Bus.UP_CONFIG, true) |
|
|
|
postEvent(Bus.UP_CONFIG, true) |
|
|
|
} |
|
|
|
} |
|
|
|
seek_line_size.setOnSeekBarChangeListener(object : |
|
|
|
seek_line_size.setOnSeekBarChangeListener(object : |
|
|
|
SeekBar.OnSeekBarChangeListener { |
|
|
|
SeekBar.OnSeekBarChangeListener { |
|
|
|
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) { |
|
|
|
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) { |
|
|
|
|
|
|
|
with(ReadBookConfig.getConfig()) { |
|
|
|
lineSpacingExtra = seek_line_size.progress |
|
|
|
lineSpacingExtra = seek_line_size.progress |
|
|
|
tv_line_size.text = lineSpacingExtra.toString() |
|
|
|
tv_line_size.text = lineSpacingExtra.toString() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onStartTrackingTouch(seekBar: SeekBar?) {} |
|
|
|
override fun onStartTrackingTouch(seekBar: SeekBar?) = Unit |
|
|
|
override fun onStopTrackingTouch(seekBar: SeekBar?) { |
|
|
|
override fun onStopTrackingTouch(seekBar: SeekBar?) { |
|
|
|
postEvent(Bus.UP_CONFIG, true) |
|
|
|
postEvent(Bus.UP_CONFIG, true) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
iv_line_size_add.onClick { |
|
|
|
iv_line_size_add.onClick { |
|
|
|
|
|
|
|
with(ReadBookConfig.getConfig()) { |
|
|
|
lineSpacingExtra++ |
|
|
|
lineSpacingExtra++ |
|
|
|
tv_line_size.text = lineSpacingExtra.toString() |
|
|
|
tv_line_size.text = lineSpacingExtra.toString() |
|
|
|
|
|
|
|
} |
|
|
|
postEvent(Bus.UP_CONFIG, true) |
|
|
|
postEvent(Bus.UP_CONFIG, true) |
|
|
|
} |
|
|
|
} |
|
|
|
iv_line_size_remove.onClick { |
|
|
|
iv_line_size_remove.onClick { |
|
|
|
|
|
|
|
with(ReadBookConfig.getConfig()) { |
|
|
|
lineSpacingExtra-- |
|
|
|
lineSpacingExtra-- |
|
|
|
tv_line_size.text = lineSpacingExtra.toString() |
|
|
|
tv_line_size.text = lineSpacingExtra.toString() |
|
|
|
|
|
|
|
} |
|
|
|
postEvent(Bus.UP_CONFIG, true) |
|
|
|
postEvent(Bus.UP_CONFIG, true) |
|
|
|
} |
|
|
|
} |
|
|
|
rg_page_anim.onCheckedChange { _, checkedId -> |
|
|
|
rg_page_anim.onCheckedChange { _, checkedId -> |
|
|
@ -218,6 +228,7 @@ class ReadStyleDialog : DialogFragment() { |
|
|
|
if (ReadBookConfig.styleSelect != index) { |
|
|
|
if (ReadBookConfig.styleSelect != index) { |
|
|
|
ReadBookConfig.styleSelect = index |
|
|
|
ReadBookConfig.styleSelect = index |
|
|
|
ReadBookConfig.upBg() |
|
|
|
ReadBookConfig.upBg() |
|
|
|
|
|
|
|
upStyle() |
|
|
|
upBg() |
|
|
|
upBg() |
|
|
|
postEvent(Bus.UP_CONFIG, true) |
|
|
|
postEvent(Bus.UP_CONFIG, true) |
|
|
|
} |
|
|
|
} |
|
|
@ -233,6 +244,18 @@ class ReadStyleDialog : DialogFragment() { |
|
|
|
return true |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun upStyle() { |
|
|
|
|
|
|
|
ReadBookConfig.getConfig().let { |
|
|
|
|
|
|
|
tv_text_bold.isSelected = it.textBold |
|
|
|
|
|
|
|
seek_text_size.progress = it.textSize - 5 |
|
|
|
|
|
|
|
tv_text_size.text = it.textSize.toString() |
|
|
|
|
|
|
|
seek_text_letter_spacing.progress = (it.letterSpacing * 10).toInt() + 5 |
|
|
|
|
|
|
|
tv_text_letter_spacing.text = it.letterSpacing.toString() |
|
|
|
|
|
|
|
seek_line_size.progress = it.lineSpacingExtra |
|
|
|
|
|
|
|
tv_line_size.text = it.lineSpacingExtra.toString() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun setBg() { |
|
|
|
private fun setBg() { |
|
|
|
tv_bg0.setTextColor(ReadBookConfig.getConfig(0).textColor()) |
|
|
|
tv_bg0.setTextColor(ReadBookConfig.getConfig(0).textColor()) |
|
|
|
tv_bg1.setTextColor(ReadBookConfig.getConfig(1).textColor()) |
|
|
|
tv_bg1.setTextColor(ReadBookConfig.getConfig(1).textColor()) |
|
|
|