diff --git a/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt b/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt index 607aeaf7e..066cf6219 100644 --- a/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt +++ b/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt @@ -37,7 +37,7 @@ class ReadRssActivity : VMBaseActivity override val binding by viewBinding(ActivityRssReadBinding::inflate) override val viewModel by viewModels() - private val imagePathKey = "" + private val imagePathKey = "imagePath" private var starMenuItem: MenuItem? = null private var ttsMenuItem: MenuItem? = null private var customWebViewCallback: WebChromeClient.CustomViewCallback? = null @@ -155,8 +155,16 @@ class ReadRssActivity : VMBaseActivity } private fun saveImage() { + val path = ACache.get(this@ReadRssActivity).getAsString(imagePathKey) + if (path.isNullOrEmpty()) { + selectExportFolder() + } else { + viewModel.saveImage(webPic, path) + } + } + private fun selectExportFolder() { val default = arrayListOf() - val path = ACache.get(this).getAsString(imagePathKey) + val path = ACache.get(this@ReadRssActivity).getAsString(imagePathKey) if (!path.isNullOrEmpty()) { default.add(path) } diff --git a/epublib/src/main/java/me/ag2s/epublib/util/StringUtil.java b/epublib/src/main/java/me/ag2s/epublib/util/StringUtil.java index 35f3fcd2b..b989afb24 100644 --- a/epublib/src/main/java/me/ag2s/epublib/util/StringUtil.java +++ b/epublib/src/main/java/me/ag2s/epublib/util/StringUtil.java @@ -279,10 +279,10 @@ public class StringUtil { for (String s : text.split("\\r?\\n")) { s = s.replaceAll("^\\s+|\\s+$", ""); if (s.length() > 0) { - if (s.toLowerCase().contains("]+)/?>", "
"); - } - if (!(s.startsWith(""))) { + //段落为一张图片才认定为图片章节/漫画并启用多看单图优化,否则认定为普通文字夹杂着的图片文字。 + if (s.matches("(?i)^]+)/?>$")) { + body.append(s.replaceAll("(?i)^]+)/?>$", "
")); } + else{ body.append("

").append(s).append("

"); } }