pull/1259/head
gedoor 3 years ago
parent 6b560fabba
commit 39771cf474
  1. 13
      app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt

@ -91,7 +91,7 @@ class ReadAloudDialog : BaseDialogFragment() {
seekTimer.progress = BaseReadAloudService.timeMinute seekTimer.progress = BaseReadAloudService.timeMinute
cbTtsFollowSys.isChecked = requireContext().getPrefBoolean("ttsFollowSys", true) cbTtsFollowSys.isChecked = requireContext().getPrefBoolean("ttsFollowSys", true)
seekTtsSpeechRate.isEnabled = !cbTtsFollowSys.isChecked seekTtsSpeechRate.isEnabled = !cbTtsFollowSys.isChecked
seekTtsSpeechRate.progress = AppConfig.ttsSpeechRate upSeekTimer()
} }
private fun initEvent() = binding.run { private fun initEvent() = binding.run {
@ -119,7 +119,6 @@ class ReadAloudDialog : BaseDialogFragment() {
upTtsSpeechRate() upTtsSpeechRate()
} }
seekTtsSpeechRate.setOnSeekBarChangeListener(object : SeekBarChangeListener { seekTtsSpeechRate.setOnSeekBarChangeListener(object : SeekBarChangeListener {
override fun onStopTrackingTouch(seekBar: SeekBar) { override fun onStopTrackingTouch(seekBar: SeekBar) {
AppConfig.ttsSpeechRate = seekBar.progress AppConfig.ttsSpeechRate = seekBar.progress
upTtsSpeechRate() upTtsSpeechRate()
@ -148,6 +147,16 @@ class ReadAloudDialog : BaseDialogFragment() {
binding.ivPlayPause.setColorFilter(textColor) binding.ivPlayPause.setColorFilter(textColor)
} }
private fun upSeekTimer() {
binding.seekTimer.post {
if (BaseReadAloudService.timeMinute > 0) {
binding.seekTimer.progress = BaseReadAloudService.timeMinute
} else {
binding.seekTimer.progress = 0
}
}
}
private fun upTimerText(timeMinute: Int) { private fun upTimerText(timeMinute: Int) {
binding.tvTimer.text = requireContext().getString(R.string.timer_m, timeMinute) binding.tvTimer.text = requireContext().getString(R.string.timer_m, timeMinute)
} }

Loading…
Cancel
Save