修复RSS的loadData无法显示完整页面的问题,删掉style=的判断,使标准RSS更好兼容

pull/106/head
Celeter 5 years ago
parent 84c358b45b
commit 299cd4e937
  1. 11
      app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt
  2. 2
      app/src/main/java/io/legado/app/ui/rss/read/ReadRssViewModel.kt

@ -77,15 +77,10 @@ class ReadRssActivity : VMBaseActivity<ReadRssViewModel>(R.layout.activity_rss_r
val url = NetworkUtils.getAbsoluteURL(it.origin, it.link) val url = NetworkUtils.getAbsoluteURL(it.origin, it.link)
val html = viewModel.clHtml(content) val html = viewModel.clHtml(content)
if (viewModel.rssSource?.loadWithBaseUrl == true) { if (viewModel.rssSource?.loadWithBaseUrl == true) {
webView.loadDataWithBaseURL( webView.loadDataWithBaseURL(url, html, "text/html", "utf-8", url)//不想用baseUrl进else
url,
html,
"text/html",
"utf-8",
url
)//不想用baseUrl进else
} else { } else {
webView.loadData(html, "text/html;charset=utf-8", "utf-8")//经测试可以解决中文乱码 //webView.loadData(html, "text/html;charset=utf-8", "utf-8")//经测试可以解决中文乱码
webView.loadDataWithBaseURL(null, html, "text/html;charset=utf-8", "utf-8", url)
} }
} }
}) })

@ -86,7 +86,7 @@ class ReadRssViewModel(application: Application) : BaseViewModel(application),
} }
fun clHtml(content: String): String { fun clHtml(content: String): String {
return if (content.contains("<style>|style=".toRegex())) { return if (content.contains("<style>".toRegex())) {
content content
} else { } else {
""" """

Loading…
Cancel
Save