|
|
@ -45,16 +45,10 @@ class TTSReadAloudService : BaseReadAloudService(), TextToSpeech.OnInitListener |
|
|
|
override fun onInit(status: Int) { |
|
|
|
override fun onInit(status: Int) { |
|
|
|
launch { |
|
|
|
launch { |
|
|
|
if (status == TextToSpeech.SUCCESS) { |
|
|
|
if (status == TextToSpeech.SUCCESS) { |
|
|
|
val result = textToSpeech?.setLanguage(Locale.CHINA) |
|
|
|
textToSpeech?.language = Locale.CHINA |
|
|
|
if (result == TextToSpeech.LANG_MISSING_DATA || result == TextToSpeech.LANG_NOT_SUPPORTED) { |
|
|
|
|
|
|
|
toast(R.string.tts_fix) |
|
|
|
|
|
|
|
IntentHelp.toTTSSetting(this@TTSReadAloudService) |
|
|
|
|
|
|
|
stopSelf() |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
textToSpeech?.setOnUtteranceProgressListener(TTSUtteranceListener()) |
|
|
|
textToSpeech?.setOnUtteranceProgressListener(TTSUtteranceListener()) |
|
|
|
ttsIsSuccess = true |
|
|
|
ttsIsSuccess = true |
|
|
|
play() |
|
|
|
play() |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
toast(R.string.tts_init_failed) |
|
|
|
toast(R.string.tts_init_failed) |
|
|
|
} |
|
|
|
} |
|
|
|