From 7c55a715a78ad3a2d81443981b64b26df9de86d3 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sun, 23 Aug 2020 15:15:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9D=80=E6=AD=BB=E5=BA=94=E7=94=A8=E6=97=B6?= =?UTF-8?q?=E5=81=9C=E6=AD=A2=E6=9C=97=E8=AF=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/service/TTSReadAloudService.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/src/main/java/io/legado/app/service/TTSReadAloudService.kt b/app/src/main/java/io/legado/app/service/TTSReadAloudService.kt index 2d4b8bbde..981d4bc68 100644 --- a/app/src/main/java/io/legado/app/service/TTSReadAloudService.kt +++ b/app/src/main/java/io/legado/app/service/TTSReadAloudService.kt @@ -1,6 +1,7 @@ package io.legado.app.service import android.app.PendingIntent +import android.content.Intent import android.speech.tts.TextToSpeech import android.speech.tts.UtteranceProgressListener import io.legado.app.R @@ -40,6 +41,12 @@ class TTSReadAloudService : BaseReadAloudService(), TextToSpeech.OnInitListener upSpeechRate() } + override fun onTaskRemoved(rootIntent: Intent?) { + super.onTaskRemoved(rootIntent) + clearTTS() + stopSelf() + } + private fun initTts() { ttsInitFinish = false textToSpeech = TextToSpeech(this, this)