feat: 优化代码

pull/132/head
kunfei 5 years ago
parent 08150c8445
commit 0ab1cb8958
  1. 7
      app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt

@ -62,6 +62,7 @@ class ReadAloudDialog : BaseDialogFragment() {
private fun initData() { private fun initData() {
upPlayState() upPlayState()
upTimerText(BaseReadAloudService.timeMinute)
seek_timer.progress = BaseReadAloudService.timeMinute seek_timer.progress = BaseReadAloudService.timeMinute
cb_tts_follow_sys.isChecked = requireContext().getPrefBoolean("ttsFollowSys", true) cb_tts_follow_sys.isChecked = requireContext().getPrefBoolean("ttsFollowSys", true)
seek_tts_SpeechRate.isEnabled = !cb_tts_follow_sys.isChecked seek_tts_SpeechRate.isEnabled = !cb_tts_follow_sys.isChecked
@ -89,7 +90,7 @@ class ReadAloudDialog : BaseDialogFragment() {
}) })
seek_timer.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener { seek_timer.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) { override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
tv_timer.text = requireContext().getString(R.string.timer_m, progress) upTimerText(progress)
} }
override fun onStartTrackingTouch(seekBar: SeekBar?) = Unit override fun onStartTrackingTouch(seekBar: SeekBar?) = Unit
@ -126,6 +127,10 @@ class ReadAloudDialog : BaseDialogFragment() {
} }
} }
private fun upTimerText(timeMinute: Int) {
tv_timer.text = requireContext().getString(R.string.timer_m, timeMinute)
}
private fun upTtsSpeechRate() { private fun upTtsSpeechRate() {
ReadAloud.upTtsSpeechRate(requireContext()) ReadAloud.upTtsSpeechRate(requireContext())
if (!BaseReadAloudService.pause) { if (!BaseReadAloudService.pause) {

Loading…
Cancel
Save