feat(book/cache): add export picture option

pull/1921/head
Xwite 3 years ago
parent d04ab661b0
commit a744af576f
  1. 1
      app/src/main/java/io/legado/app/constant/PreferKey.kt
  2. 5
      app/src/main/java/io/legado/app/help/config/AppConfig.kt
  3. 2
      app/src/main/java/io/legado/app/ui/book/cache/CacheActivity.kt
  4. 5
      app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt
  5. 7
      app/src/main/res/menu/book_cache.xml
  6. 1
      app/src/main/res/values-es-rES/strings.xml
  7. 2
      app/src/main/res/values-ja-rJP/strings.xml
  8. 3
      app/src/main/res/values-pt-rBR/strings.xml
  9. 3
      app/src/main/res/values-zh-rHK/strings.xml
  10. 3
      app/src/main/res/values-zh-rTW/strings.xml
  11. 3
      app/src/main/res/values-zh/strings.xml
  12. 2
      app/src/main/res/values/strings.xml

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

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

@ -93,6 +93,7 @@ class CacheActivity : VMBaseActivity<ActivityCacheBookBinding, CacheViewModel>()
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<ActivityCacheBookBinding, CacheViewModel>()
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)
}

@ -168,6 +168,8 @@ class CacheViewModel(application: Application) : BaseViewModel(application) {
chineseConvert = false,
reSegment = false
).joinToString("\n")
if (AppConfig.exportPictureFile) {
//txt导出图片文件
val srcList = arrayListOf<Triple<String, Int, String>>()
content?.split("\n")?.forEachIndexed { index, text ->
val matcher = AppPattern.imgPattern.matcher(text)
@ -179,6 +181,9 @@ class CacheViewModel(application: Application) : BaseViewModel(application) {
}
}
append.invoke("\n\n$content1", srcList)
} else {
append.invoke("\n\n$content1", null)
}
}
}
}

@ -36,12 +36,19 @@
android:title="@string/export_to_web_dav"
android:checkable="true"
app:showAsAction="never" />
<item
android:id="@+id/menu_export_no_chapter_name"
android:title="@string/export_no_chapter_name"
android:checkable="true"
app:showAsAction="never" />
<item
android:id="@+id/menu_export_pics_file"
android:title="@string/export_pics_file"
android:checkable="true"
app:showAsAction="never" />
<item
android:id="@+id/menu_export_folder"
android:title="@string/export_folder"

@ -991,6 +991,7 @@
<string name="bitmap_cache_size_summary">Current cache max size %1$s MB</string>
<string name="bitmap_cache_size">bitmap cache size</string>
<string name="restart_to_apply_changes">Restart to apply changes</string>
<string name="export_pics_file">Export Picture Files</string>
<!-- string end -->
</resources>

@ -994,6 +994,8 @@
<string name="bitmap_cache_size_summary">Current cache max size %1$s MB</string>
<string name="bitmap_cache_size">bitmap cache size</string>
<string name="restart_to_apply_changes">Restart to apply changes</string>
<string name="export_pics_file">Export Picture Files</string>
<!-- string end -->
</resources>

@ -994,6 +994,7 @@
<string name="bitmap_cache_size_summary">Current cache max size %1$s MB</string>
<string name="bitmap_cache_size">bitmap cache size</string>
<string name="restart_to_apply_changes">Restart to apply changes</string>
<string name="export_pics_file">Export Picture Files</string>
<!-- string end -->
</resources>

@ -991,6 +991,7 @@
<string name="bitmap_cache_size_summary">当前最大缓存 %1$s MB</string>
<string name="bitmap_cache_size">图片绘制缓存</string>
<string name="restart_to_apply_changes">重启应用更改</string>
<string name="export_pics_file">TXT导出图片</string>
<!-- string end -->
</resources>

@ -993,6 +993,7 @@
<string name="bitmap_cache_size_summary">当前最大缓存 %1$s MB</string>
<string name="bitmap_cache_size">图片绘制缓存</string>
<string name="restart_to_apply_changes">重启应用更改</string>
<string name="export_pics_file">TXT导出图片</string>
<!-- string end -->
</resources>

@ -993,6 +993,7 @@
<string name="bitmap_cache_size_summary">当前最大缓存 %1$s MB</string>
<string name="bitmap_cache_size">图片绘制缓存</string>
<string name="restart_to_apply_changes">重启应用更改</string>
<string name="export_pics_file">TXT导出图片</string>
<!-- string end -->
</resources>

@ -994,6 +994,8 @@
<string name="bitmap_cache_size_summary">Current cache max size %1$s MB</string>
<string name="bitmap_cache_size">bitmap cache size</string>
<string name="restart_to_apply_changes">Restart to apply changes</string>
<string name="export_pics_file">Export Picture Files</string>
<!-- string end -->
</resources>

Loading…
Cancel
Save