|
|
@ -19,6 +19,7 @@ import io.legado.app.help.MediaHelp |
|
|
|
import io.legado.app.receiver.MediaButtonReceiver |
|
|
|
import io.legado.app.receiver.MediaButtonReceiver |
|
|
|
import io.legado.app.service.notification.ReadAloudNotification |
|
|
|
import io.legado.app.service.notification.ReadAloudNotification |
|
|
|
import io.legado.app.ui.widget.page.TextChapter |
|
|
|
import io.legado.app.ui.widget.page.TextChapter |
|
|
|
|
|
|
|
import io.legado.app.utils.getPrefBoolean |
|
|
|
import io.legado.app.utils.getPrefInt |
|
|
|
import io.legado.app.utils.getPrefInt |
|
|
|
import io.legado.app.utils.postEvent |
|
|
|
import io.legado.app.utils.postEvent |
|
|
|
import io.legado.app.utils.toast |
|
|
|
import io.legado.app.utils.toast |
|
|
@ -142,7 +143,7 @@ class ReadAloudService : BaseService(), TextToSpeech.OnInitListener, AudioManage |
|
|
|
} |
|
|
|
} |
|
|
|
"pause" -> pauseReadAloud(true) |
|
|
|
"pause" -> pauseReadAloud(true) |
|
|
|
"resume" -> resumeReadAloud() |
|
|
|
"resume" -> resumeReadAloud() |
|
|
|
"upTtsSpeechRate" -> upSpeechRate() |
|
|
|
"upTtsSpeechRate" -> upSpeechRate(true) |
|
|
|
else -> stopSelf() |
|
|
|
else -> stopSelf() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -199,9 +200,16 @@ class ReadAloudService : BaseService(), TextToSpeech.OnInitListener, AudioManage |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun upSpeechRate() { |
|
|
|
private fun upSpeechRate(reset: Boolean = false) { |
|
|
|
|
|
|
|
if (this.getPrefBoolean("ttsFollowSys", true)) { |
|
|
|
|
|
|
|
if (reset) { |
|
|
|
|
|
|
|
clearTTS() |
|
|
|
|
|
|
|
textToSpeech = TextToSpeech(this, this) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
textToSpeech?.setSpeechRate((this.getPrefInt("ttsSpeechRate", 5) + 5) / 10f) |
|
|
|
textToSpeech?.setSpeechRate((this.getPrefInt("ttsSpeechRate", 5) + 5) / 10f) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 初始化MediaSession |
|
|
|
* 初始化MediaSession |
|
|
|