From 39ce729ac283e0edb12f6538116aa7e4f47d0a91 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 11 Jan 2020 10:08:56 +0800 Subject: [PATCH] up --- .../java/io/legado/app/ui/rss/read/ReadRssActivity.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 24b49a5c6..9296537e4 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 @@ -14,8 +14,11 @@ import io.legado.app.lib.theme.DrawableUtils import io.legado.app.lib.theme.primaryTextColor import io.legado.app.utils.NetworkUtils import io.legado.app.utils.getViewModel +import io.legado.app.utils.htmlFormat import io.legado.app.utils.shareText import kotlinx.android.synthetic.main.activity_rss_read.* +import org.apache.commons.text.StringEscapeUtils +import org.jsoup.Jsoup class ReadRssActivity : VMBaseActivity(R.layout.activity_rss_read), ReadRssViewModel.CallBack { @@ -134,9 +137,12 @@ class ReadRssActivity : VMBaseActivity(R.layout.activity_rss_r return super.onKeyUp(keyCode, event) } + @SuppressLint("SetJavaScriptEnabled") private fun readAloud() { + webView.settings.javaScriptEnabled = true webView.evaluateJavascript("document.documentElement.outerHTML") { - viewModel.readAloud(it) + val html = StringEscapeUtils.unescapeJson(it) + viewModel.readAloud(Jsoup.parse(html).body().html().htmlFormat()) } }