pull/1395/head
gedoor 3 years ago
parent 069c535eb2
commit da7b458644
  1. 4
      app/src/main/java/io/legado/app/service/TTSReadAloudService.kt

@ -15,6 +15,7 @@ import java.util.*
class TTSReadAloudService : BaseReadAloudService(), TextToSpeech.OnInitListener { class TTSReadAloudService : BaseReadAloudService(), TextToSpeech.OnInitListener {
private val bdRegex = "^(\\s|\\p{P})+$".toRegex()
private var textToSpeech: TextToSpeech? = null private var textToSpeech: TextToSpeech? = null
private var ttsInitFinish = false private var ttsInitFinish = false
private val ttsUtteranceListener = TTSUtteranceListener() private val ttsUtteranceListener = TTSUtteranceListener()
@ -72,7 +73,8 @@ class TTSReadAloudService : BaseReadAloudService(), TextToSpeech.OnInitListener
textToSpeech?.let { textToSpeech?.let {
it.speak("", TextToSpeech.QUEUE_FLUSH, null, null) it.speak("", TextToSpeech.QUEUE_FLUSH, null, null)
for (i in nowSpeak until contentList.size) { 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…
Cancel
Save