diff --git a/app/src/main/java/io/legado/app/constant/PreferKey.kt b/app/src/main/java/io/legado/app/constant/PreferKey.kt index ccb32a3af..de3e8c628 100644 --- a/app/src/main/java/io/legado/app/constant/PreferKey.kt +++ b/app/src/main/java/io/legado/app/constant/PreferKey.kt @@ -55,6 +55,7 @@ object PreferKey { const val exportToWebDav = "webDavCacheBackup" const val exportNoChapterName = "exportNoChapterName" const val exportType = "exportType" + const val exportPictureFile = "exportPictureFile" const val changeSourceCheckAuthor = "changeSourceCheckAuthor" const val changeSourceLoadToc = "changeSourceLoadToc" const val changeSourceLoadInfo = "changeSourceLoadInfo" diff --git a/app/src/main/java/io/legado/app/help/config/AppConfig.kt b/app/src/main/java/io/legado/app/help/config/AppConfig.kt index 05e2c80b6..8fa01999a 100644 --- a/app/src/main/java/io/legado/app/help/config/AppConfig.kt +++ b/app/src/main/java/io/legado/app/help/config/AppConfig.kt @@ -243,6 +243,11 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener { set(value) { appCtx.putPrefInt(PreferKey.exportType, value) } + var exportPictureFile: Boolean + get() = appCtx.getPrefBoolean(PreferKey.exportPictureFile, false) + set(value) { + appCtx.putPrefBoolean(PreferKey.exportPictureFile, value) + } var changeSourceCheckAuthor: Boolean get() = appCtx.getPrefBoolean(PreferKey.changeSourceCheckAuthor) diff --git a/app/src/main/java/io/legado/app/ui/book/cache/CacheActivity.kt b/app/src/main/java/io/legado/app/ui/book/cache/CacheActivity.kt index 9d9559b73..0e530989f 100644 --- a/app/src/main/java/io/legado/app/ui/book/cache/CacheActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/cache/CacheActivity.kt @@ -93,6 +93,7 @@ class CacheActivity : VMBaseActivity() menu.findItem(R.id.menu_enable_replace)?.isChecked = AppConfig.exportUseReplace menu.findItem(R.id.menu_export_no_chapter_name)?.isChecked = AppConfig.exportNoChapterName menu.findItem(R.id.menu_export_web_dav)?.isChecked = AppConfig.exportToWebDav + menu.findItem(R.id.menu_export_pics_file)?.isChecked = AppConfig.exportPictureFile menu.findItem(R.id.menu_export_type)?.title = "${getString(R.string.export_type)}(${getTypeName()})" menu.findItem(R.id.menu_export_charset)?.title = @@ -129,6 +130,7 @@ class CacheActivity : VMBaseActivity() R.id.menu_enable_replace -> AppConfig.exportUseReplace = !item.isChecked R.id.menu_export_no_chapter_name -> AppConfig.exportNoChapterName = !item.isChecked R.id.menu_export_web_dav -> AppConfig.exportToWebDav = !item.isChecked + R.id.menu_export_pics_file -> AppConfig.exportPictureFile = !item.isChecked R.id.menu_export_folder -> { selectExportFolder(-1) } diff --git a/app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt b/app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt index 55e963ab8..4655c07c1 100644 --- a/app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt @@ -168,17 +168,22 @@ class CacheViewModel(application: Application) : BaseViewModel(application) { chineseConvert = false, reSegment = false ).joinToString("\n") - val srcList = arrayListOf>() - content?.split("\n")?.forEachIndexed { index, text -> - val matcher = AppPattern.imgPattern.matcher(text) - while (matcher.find()) { - matcher.group(1)?.let { - val src = NetworkUtils.getAbsoluteURL(chapter.url, it) - srcList.add(Triple(chapter.title, index, src)) + if (AppConfig.exportPictureFile) { + //txt导出图片文件 + val srcList = arrayListOf>() + content?.split("\n")?.forEachIndexed { index, text -> + val matcher = AppPattern.imgPattern.matcher(text) + while (matcher.find()) { + matcher.group(1)?.let { + val src = NetworkUtils.getAbsoluteURL(chapter.url, it) + srcList.add(Triple(chapter.title, index, src)) + } } } + append.invoke("\n\n$content1", srcList) + } else { + append.invoke("\n\n$content1", null) } - append.invoke("\n\n$content1", srcList) } } } diff --git a/app/src/main/res/menu/book_cache.xml b/app/src/main/res/menu/book_cache.xml index f76ab76f8..a60ffc19e 100644 --- a/app/src/main/res/menu/book_cache.xml +++ b/app/src/main/res/menu/book_cache.xml @@ -36,12 +36,19 @@ android:title="@string/export_to_web_dav" android:checkable="true" app:showAsAction="never" /> + + + Current cache max size %1$s MB bitmap cache size Restart to apply changes + Export Picture Files diff --git a/app/src/main/res/values-ja-rJP/strings.xml b/app/src/main/res/values-ja-rJP/strings.xml index 0cb6d98b6..f63731729 100644 --- a/app/src/main/res/values-ja-rJP/strings.xml +++ b/app/src/main/res/values-ja-rJP/strings.xml @@ -994,6 +994,8 @@ Current cache max size %1$s MB bitmap cache size Restart to apply changes + Export Picture Files + diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index fa88aca97..725b69ba6 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -994,6 +994,7 @@ Current cache max size %1$s MB bitmap cache size Restart to apply changes - + Export Picture Files + diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index b09e0fa3e..b2291d6ee 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -991,6 +991,7 @@ 当前最大缓存 %1$s MB 图片绘制缓存 重启应用更改 - + TXT导出图片 + diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 12bb25266..cd4972500 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -993,6 +993,7 @@ 当前最大缓存 %1$s MB 图片绘制缓存 重启应用更改 - + TXT导出图片 + diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 2ca7d0784..3556c4f7f 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -993,6 +993,7 @@ 当前最大缓存 %1$s MB 图片绘制缓存 重启应用更改 - + TXT导出图片 + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a0cbbb3fb..c54556d81 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -994,6 +994,8 @@ Current cache max size %1$s MB bitmap cache size Restart to apply changes + Export Picture Files +