pull/71/head^2^2
kunfei 5 years ago
parent 1eef27eba9
commit f3564f86d0
  1. 13
      app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt

@ -142,10 +142,15 @@ class ReadRssActivity : VMBaseActivity<ReadRssViewModel>(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())
}
}
}

Loading…
Cancel
Save