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 3baa9f98f..2b3cddf70 100644 --- a/app/src/main/java/io/legado/app/constant/PreferKey.kt +++ b/app/src/main/java/io/legado/app/constant/PreferKey.kt @@ -47,6 +47,7 @@ object PreferKey { const val webDavPassword = "web_dav_password" const val webDavCreateDir = "webDavCreateDir" const val exportToWebDav = "webDavCacheBackup" + const val exportNoChapterName = "exportNoChapterName" const val exportType = "exportType" const val changeSourceCheckAuthor = "changeSourceCheckAuthor" const val changeSourceLoadToc = "changeSourceLoadToc" diff --git a/app/src/main/java/io/legado/app/help/AppConfig.kt b/app/src/main/java/io/legado/app/help/AppConfig.kt index 01b02eac5..9401861d2 100644 --- a/app/src/main/java/io/legado/app/help/AppConfig.kt +++ b/app/src/main/java/io/legado/app/help/AppConfig.kt @@ -205,7 +205,11 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener { set(value) { appCtx.putPrefBoolean(PreferKey.exportToWebDav, value) } - + var exportNoChapterName: Boolean + get() = appCtx.getPrefBoolean(PreferKey.exportNoChapterName) + set(value) { + appCtx.putPrefBoolean(PreferKey.exportNoChapterName, value) + } var exportType: Int get() = appCtx.getPrefInt(PreferKey.exportType) set(value) { 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 55b482f72..202bcb14b 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 @@ -90,6 +90,7 @@ class CacheActivity : VMBaseActivity() override fun onMenuOpened(featureId: Int, menu: Menu): Boolean { 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 return super.onMenuOpened(featureId, menu) } @@ -121,6 +122,7 @@ class CacheActivity : VMBaseActivity() } R.id.menu_export_all -> exportAll() 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_folder -> { exportPosition = -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 8e6019c1c..388180f9b 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 @@ -138,7 +138,7 @@ class CacheViewModel(application: Application) : BaseViewModel(application) { ) appDb.bookChapterDao.getChapterList(book.bookUrl).forEach { chapter -> BookHelp.getContent(book, chapter).let { content -> - val content1 = contentProcessor + var content1 = contentProcessor .getContent( book, chapter.title.replace("\\r?\\n".toRegex(), " "), @@ -147,6 +147,9 @@ class CacheViewModel(application: Application) : BaseViewModel(application) { useReplace ) .joinToString("\n") + if(AppConfig.exportNoChapterName){ + content1 = content.toString() + } append.invoke("\n\n$content1") } } diff --git a/app/src/main/res/menu/book_cache.xml b/app/src/main/res/menu/book_cache.xml index 0f58daf7a..f76ab76f8 100644 --- a/app/src/main/res/menu/book_cache.xml +++ b/app/src/main/res/menu/book_cache.xml @@ -36,6 +36,11 @@ android:title="@string/export_to_web_dav" android:checkable="true" app:showAsAction="never" /> + url为空 字典 未知错误 + No export chapter names diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index b7c405f4f..c8ac7fb56 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -845,5 +845,6 @@ url为空 字典 未知错误 + TXT不導出章節名 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index e55d5cd04..23efed761 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -846,5 +846,6 @@ url为空 字典 未知错误 + TXT不匯出章節名 diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 502e9f89d..8fb94c976 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -809,6 +809,7 @@ 背景图片 导出文件夹 导出编码 + TXT不导出章节名 导出到WebDav 反转内容 调试 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 89624f0ec..2dbe3b684 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -848,5 +848,6 @@ Null url 字典 未知错误 + No export chapter names