pull/84/head
kunfei 5 years ago
parent 325228aab6
commit 2639db7b6c
  1. 2
      app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt
  2. 14
      app/src/main/java/io/legado/app/ui/rss/read/ReadRssViewModel.kt

@ -79,7 +79,7 @@ class ReadRssActivity : VMBaseActivity<ReadRssViewModel>(R.layout.activity_rss_r
"text/html",
"utf-8",
url
)//不想用baseUrl进下一个吧
)//不想用baseUrl进else
} else {
webView.loadData(html, "text/html;charset=utf-8", "utf-8")//经测试可以解决中文乱码
}

@ -85,12 +85,18 @@ class ReadRssViewModel(application: Application) : BaseViewModel(application),
}
fun clHtml(content: String): String {
return """<style>
img{max-width:100%; width:auto; height:auto;}
video{object-fit:fill; max-width:100%; width:auto; height:auto;}
return if (content.contains("<style>|style=".toRegex())) {
content
} else {
"""
<style>
img{max-width:100% !important; width:auto; height:auto;}
video{object-fit:fill; max-width:100% !important; width:auto; height:auto;}
body{word-wrap:break-word; height:auto;max-width: 100%; width:auto;}
</style>
$content"""
$content
""".trimIndent()
}
}
override fun onInit(status: Int) {

Loading…
Cancel
Save