diff --git a/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt b/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt index 26ede2867..2caf40524 100644 --- a/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt +++ b/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt @@ -142,10 +142,15 @@ class ReadRssActivity : VMBaseActivity(R.layout.activity_rss_r @SuppressLint("SetJavaScriptEnabled") private fun readAloud() { - webView.settings.javaScriptEnabled = true - webView.evaluateJavascript("document.documentElement.outerHTML") { - val html = StringEscapeUtils.unescapeJson(it) - viewModel.readAloud(Jsoup.parse(html).body().html().htmlFormat()) + if (viewModel.textToSpeech.isSpeaking) { + viewModel.textToSpeech.stop() + upTtsMenu(false) + } else { + webView.settings.javaScriptEnabled = true + webView.evaluateJavascript("document.documentElement.outerHTML") { + val html = StringEscapeUtils.unescapeJson(it) + viewModel.readAloud(Jsoup.parse(html).body().html().htmlFormat()) + } } }