|
|
|
@ -71,14 +71,16 @@ class ReadStyleDialog : DialogFragment() { |
|
|
|
|
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.toInt() |
|
|
|
|
tv_line_size.text = it.lineSpacingExtra.toString() |
|
|
|
|
} |
|
|
|
|
setBg() |
|
|
|
|
upBg() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun initOnClick() = with(ReadBookConfig.getConfig()) { |
|
|
|
|
tv_text_bold.onClick { |
|
|
|
|
textBold = !textBold |
|
|
|
@ -87,11 +89,11 @@ class ReadStyleDialog : DialogFragment() { |
|
|
|
|
} |
|
|
|
|
seek_text_size.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener { |
|
|
|
|
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) { |
|
|
|
|
|
|
|
|
|
textSize = progress + 5 |
|
|
|
|
tv_text_size.text = textSize.toString() |
|
|
|
|
} |
|
|
|
|
override fun onStartTrackingTouch(seekBar: SeekBar?) {} |
|
|
|
|
override fun onStopTrackingTouch(seekBar: SeekBar?) { |
|
|
|
|
textSize = seek_text_size.progress + 5 |
|
|
|
|
postEvent(Bus.UP_CONFIG, true) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
@ -99,54 +101,60 @@ class ReadStyleDialog : DialogFragment() { |
|
|
|
|
textSize++ |
|
|
|
|
if (textSize > 50) textSize = 50 |
|
|
|
|
seek_text_size.progress = textSize - 5 |
|
|
|
|
tv_text_size.text = textSize.toString() |
|
|
|
|
postEvent(Bus.UP_CONFIG, true) |
|
|
|
|
} |
|
|
|
|
iv_line_size_remove.onClick { |
|
|
|
|
textSize-- |
|
|
|
|
if (textSize < 5) textSize = 5 |
|
|
|
|
seek_text_size.progress = textSize - 5 |
|
|
|
|
tv_text_size.text = textSize.toString() |
|
|
|
|
postEvent(Bus.UP_CONFIG, true) |
|
|
|
|
} |
|
|
|
|
seek_text_letter_spacing.setOnSeekBarChangeListener(object : |
|
|
|
|
SeekBar.OnSeekBarChangeListener { |
|
|
|
|
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) { |
|
|
|
|
|
|
|
|
|
letterSpacing = (seek_text_letter_spacing.progress - 5) / 10f |
|
|
|
|
tv_text_letter_spacing.text = letterSpacing.toString() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun onStartTrackingTouch(seekBar: SeekBar?) {} |
|
|
|
|
override fun onStopTrackingTouch(seekBar: SeekBar?) { |
|
|
|
|
letterSpacing = (seek_text_letter_spacing.progress - 5) / 10f |
|
|
|
|
postEvent(Bus.UP_CONFIG, true) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
iv_text_letter_spacing_add.onClick { |
|
|
|
|
letterSpacing += 0.1f |
|
|
|
|
seek_text_letter_spacing.progress = (letterSpacing * 10).toInt() + 5 |
|
|
|
|
tv_text_letter_spacing.text = letterSpacing.toString() |
|
|
|
|
postEvent(Bus.UP_CONFIG, true) |
|
|
|
|
} |
|
|
|
|
iv_text_letter_spacing_remove.onClick { |
|
|
|
|
letterSpacing -= 0.1f |
|
|
|
|
seek_text_letter_spacing.progress = (letterSpacing * 10).toInt() + 5 |
|
|
|
|
tv_text_letter_spacing.text = letterSpacing.toString() |
|
|
|
|
postEvent(Bus.UP_CONFIG, true) |
|
|
|
|
} |
|
|
|
|
seek_line_size.setOnSeekBarChangeListener(object : |
|
|
|
|
SeekBar.OnSeekBarChangeListener { |
|
|
|
|
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) { |
|
|
|
|
|
|
|
|
|
lineSpacingExtra = seek_line_size.progress.toFloat() |
|
|
|
|
tv_line_size.text = lineSpacingExtra.toString() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun onStartTrackingTouch(seekBar: SeekBar?) {} |
|
|
|
|
override fun onStopTrackingTouch(seekBar: SeekBar?) { |
|
|
|
|
lineSpacingExtra = seek_line_size.progress.toFloat() |
|
|
|
|
postEvent(Bus.UP_CONFIG, true) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
iv_line_size_add.onClick { |
|
|
|
|
lineSpacingExtra++ |
|
|
|
|
tv_line_size.text = lineSpacingExtra.toString() |
|
|
|
|
postEvent(Bus.UP_CONFIG, true) |
|
|
|
|
} |
|
|
|
|
iv_line_size_remove.onClick { |
|
|
|
|
lineSpacingExtra-- |
|
|
|
|
tv_line_size.text = lineSpacingExtra.toString() |
|
|
|
|
postEvent(Bus.UP_CONFIG, true) |
|
|
|
|
} |
|
|
|
|
rg_page_anim.onCheckedChange { _, checkedId -> |
|
|
|
|