From 8bc59eede9eb37c514115e6246f84c81b2e649c9 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 25 Aug 2019 16:02:31 +0800 Subject: [PATCH] up --- app/src/main/java/io/legado/app/service/ReadAloudService.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/service/ReadAloudService.kt b/app/src/main/java/io/legado/app/service/ReadAloudService.kt index 5c757d3f0..6bc20b35c 100644 --- a/app/src/main/java/io/legado/app/service/ReadAloudService.kt +++ b/app/src/main/java/io/legado/app/service/ReadAloudService.kt @@ -103,9 +103,10 @@ class ReadAloudService : BaseService(), TextToSpeech.OnInitListener, AudioManage } override fun onDestroy() { - super.onDestroy() + textToSpeech?.stop() isRun = false unregisterReceiver(broadcastReceiver) + super.onDestroy() } override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { @@ -120,6 +121,7 @@ class ReadAloudService : BaseService(), TextToSpeech.OnInitListener, AudioManage "pause" -> pauseReadAloud(true) "resume" -> resumeReadAloud() "stop" -> stopSelf() + else -> stopSelf() } } return super.onStartCommand(intent, flags, startId) @@ -132,6 +134,7 @@ class ReadAloudService : BaseService(), TextToSpeech.OnInitListener, AudioManage if (result == TextToSpeech.LANG_MISSING_DATA || result == TextToSpeech.LANG_NOT_SUPPORTED) { toast(R.string.tts_fix) IntentHelp.toTTSSetting(this@ReadAloudService) + stopSelf() } else { textToSpeech?.setOnUtteranceProgressListener(TTSUtteranceListener()) ttsIsSuccess = true