diff --git a/app/src/main/java/io/legado/app/ui/readbook/ReadBookViewModel.kt b/app/src/main/java/io/legado/app/ui/readbook/ReadBookViewModel.kt index 5fad1c557..ade57d777 100644 --- a/app/src/main/java/io/legado/app/ui/readbook/ReadBookViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/readbook/ReadBookViewModel.kt @@ -13,6 +13,7 @@ import io.legado.app.data.entities.BookChapter import io.legado.app.data.entities.BookSource import io.legado.app.help.BookHelp import io.legado.app.model.WebBook +import io.legado.app.service.ReadAloudService import io.legado.app.ui.widget.page.TextChapter import kotlinx.coroutines.Dispatchers.IO @@ -133,6 +134,11 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { } + override fun onCleared() { + super.onCleared() + ReadAloudService.stop(context) + } + interface CallBack { fun loadContentFinish(bookChapter: BookChapter, content: String) }