mirror of
https://github.com/gedoor/legado.git
synced 2024-09-01 09:34:25 +08:00
优化
This commit is contained in:
parent
069c535eb2
commit
da7b458644
@ -15,6 +15,7 @@ import java.util.*
|
||||
|
||||
class TTSReadAloudService : BaseReadAloudService(), TextToSpeech.OnInitListener {
|
||||
|
||||
private val bdRegex = "^(\\s|\\p{P})+$".toRegex()
|
||||
private var textToSpeech: TextToSpeech? = null
|
||||
private var ttsInitFinish = false
|
||||
private val ttsUtteranceListener = TTSUtteranceListener()
|
||||
@ -72,7 +73,8 @@ class TTSReadAloudService : BaseReadAloudService(), TextToSpeech.OnInitListener
|
||||
textToSpeech?.let {
|
||||
it.speak("", TextToSpeech.QUEUE_FLUSH, null, null)
|
||||
for (i in nowSpeak until contentList.size) {
|
||||
it.speak(contentList[i], TextToSpeech.QUEUE_ADD, null, AppConst.APP_TAG + i)
|
||||
val text = contentList[i].replace(bdRegex, "")
|
||||
it.speak(text, TextToSpeech.QUEUE_ADD, null, AppConst.APP_TAG + i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user