feat: 优化

pull/209/head
kunfei 5 years ago
parent a3ddf6a435
commit dd53f0a260
  1. 4
      app/src/main/java/io/legado/app/service/TTSReadAloudService.kt

@ -21,6 +21,7 @@ class TTSReadAloudService : BaseReadAloudService(), TextToSpeech.OnInitListener
companion object { companion object {
private var textToSpeech: TextToSpeech? = null private var textToSpeech: TextToSpeech? = null
private var ttsInitFinish = false
fun clearTTS() { fun clearTTS() {
textToSpeech?.let { textToSpeech?.let {
@ -28,11 +29,10 @@ class TTSReadAloudService : BaseReadAloudService(), TextToSpeech.OnInitListener
it.shutdown() it.shutdown()
} }
textToSpeech = null textToSpeech = null
ttsInitFinish = false
} }
} }
private var ttsInitFinish = false
override fun onCreate() { override fun onCreate() {
super.onCreate() super.onCreate()
textToSpeech = TextToSpeech(this, this) textToSpeech = TextToSpeech(this, this)

Loading…
Cancel
Save