From f3564f86d06c17b88f65760fff46a121f5a10f14 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 11 Jan 2020 10:26:29 +0800 Subject: [PATCH] up --- .../io/legado/app/ui/rss/read/ReadRssActivity.kt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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()) + } } }