feat: 优化

pull/209/head
kunfei 5 years ago
parent 0e818f62a4
commit a3918564e8
  1. 15
      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,9 +138,19 @@ class ReadRssViewModel(application: Application) : BaseViewModel(application),
} }
fun clHtml(content: String): String { fun clHtml(content: String): String {
return if (content.contains("<style>".toRegex())) { return when {
!rssSource?.style.isNullOrEmpty() -> {
"""
<style>
${rssSource?.style}
</style>
$content
""".trimIndent()
}
content.contains("<style>".toRegex()) -> {
content content
} else { }
else -> {
""" """
<style> <style>
img{max-width:100% !important; width:auto; height:auto;} img{max-width:100% !important; width:auto; height:auto;}
@ -151,6 +161,7 @@ class ReadRssViewModel(application: Application) : BaseViewModel(application),
""".trimIndent() """.trimIndent()
} }
} }
}
@Synchronized @Synchronized
override fun onInit(status: Int) { override fun onInit(status: Int) {

@ -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