pull/34/head
kunfei 5 years ago
parent da8a354ccc
commit cb2aa7ce75
  1. 18
      app/src/main/java/io/legado/app/service/ReadAloudService.kt

@ -279,6 +279,9 @@ class ReadAloudService : BaseService(), TextToSpeech.OnInitListener,
ReadAloudNotification.upNotification(this) ReadAloudNotification.upNotification(this)
} }
/**
* 定时
*/
private fun doDs() { private fun doDs() {
if (!pause) { if (!pause) {
timeMinute-- timeMinute--
@ -292,6 +295,9 @@ class ReadAloudService : BaseService(), TextToSpeech.OnInitListener,
ReadAloudNotification.upNotification(this) ReadAloudNotification.upNotification(this)
} }
/**
* 更新朗读速度
*/
private fun upSpeechRate(reset: Boolean = false) { private fun upSpeechRate(reset: Boolean = false) {
if (this.getPrefBoolean("ttsFollowSys", true)) { if (this.getPrefBoolean("ttsFollowSys", true)) {
if (reset) { if (reset) {
@ -303,6 +309,9 @@ class ReadAloudService : BaseService(), TextToSpeech.OnInitListener,
} }
} }
/**
* 上一段
*/
private fun prevP() { private fun prevP() {
if (nowSpeak > 0) { if (nowSpeak > 0) {
textToSpeech?.stop() textToSpeech?.stop()
@ -312,6 +321,9 @@ class ReadAloudService : BaseService(), TextToSpeech.OnInitListener,
} }
} }
/**
* 下一段
*/
private fun nextP() { private fun nextP() {
if (nowSpeak < contentList.size - 1) { if (nowSpeak < contentList.size - 1) {
textToSpeech?.stop() textToSpeech?.stop()
@ -360,6 +372,9 @@ class ReadAloudService : BaseService(), TextToSpeech.OnInitListener,
registerReceiver(broadcastReceiver, intentFilter) registerReceiver(broadcastReceiver, intentFilter)
} }
/**
* 暂停朗读
*/
private fun pauseReadAloud(pause: Boolean) { private fun pauseReadAloud(pause: Boolean) {
postEvent(Bus.ALOUD_STATE, Status.PAUSE) postEvent(Bus.ALOUD_STATE, Status.PAUSE)
this.pause = pause this.pause = pause
@ -368,6 +383,9 @@ class ReadAloudService : BaseService(), TextToSpeech.OnInitListener,
ReadAloudNotification.upNotification(this) ReadAloudNotification.upNotification(this)
} }
/**
* 恢复朗读
*/
private fun resumeReadAloud() { private fun resumeReadAloud() {
pause = false pause = false
playTTS() playTTS()

Loading…
Cancel
Save