feat: 优化

pull/209/head
kunfei 5 years ago
parent 0e818f62a4
commit a3918564e8
  1. 33
      app/src/main/java/io/legado/app/ui/rss/read/ReadRssViewModel.kt
  2. 2
      app/src/main/res/values-zh-rHK/strings.xml
  3. 2
      app/src/main/res/values/strings.xml

@ -138,17 +138,28 @@ class ReadRssViewModel(application: Application) : BaseViewModel(application),
} }
fun clHtml(content: String): String { fun clHtml(content: String): String {
return if (content.contains("<style>".toRegex())) { return when {
content !rssSource?.style.isNullOrEmpty() -> {
} else { """
""" <style>
<style> ${rssSource?.style}
img{max-width:100% !important; width:auto; height:auto;} </style>
video{object-fit:fill; max-width:100% !important; width:auto; height:auto;} $content
body{word-wrap:break-word; height:auto;max-width: 100%; width:auto;} """.trimIndent()
</style> }
$content content.contains("<style>".toRegex()) -> {
""".trimIndent() 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
""".trimIndent()
}
} }
} }

@ -417,7 +417,7 @@
<string name="r_description">描述規則 (ruleDescription)</string> <string name="r_description">描述規則 (ruleDescription)</string>
<string name="r_image">圖片 url 規則 (ruleImage)</string> <string name="r_image">圖片 url 規則 (ruleImage)</string>
<string name="r_content">內容規則 (ruleContent)</string> <string name="r_content">內容規則 (ruleContent)</string>
<string name="r_style">樣式</string> <string name="r_style">樣式 (style)</string>
<string name="r_link">鏈接規則 (ruleLink)</string> <string name="r_link">鏈接規則 (ruleLink)</string>
<!-- source end--> <!-- source end-->

@ -417,7 +417,7 @@
<string name="r_description">描述规则(ruleDescription)</string> <string name="r_description">描述规则(ruleDescription)</string>
<string name="r_image">图片url规则(ruleImage)</string> <string name="r_image">图片url规则(ruleImage)</string>
<string name="r_content">内容规则(ruleContent)</string> <string name="r_content">内容规则(ruleContent)</string>
<string name="r_style">样式</string> <string name="r_style">样式(style)</string>
<string name="r_link">链接规则(ruleLink)</string> <string name="r_link">链接规则(ruleLink)</string>
<!-- source end--> <!-- source end-->

Loading…
Cancel
Save