From da0ca1b93fb7da85f882e7a4c5d90411112d661b Mon Sep 17 00:00:00 2001 From: Horis <821938089@qq.com> Date: Sat, 14 Oct 2023 17:27:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/constant/PreferKey.kt | 1 + .../main/java/io/legado/app/help/config/AppConfig.kt | 5 +++++ .../app/ui/association/ImportBookSourceDialog.kt | 7 +++++++ .../app/ui/association/ImportBookSourceViewModel.kt | 5 +++++ .../ui/book/source/edit/BookSourceEditActivity.kt | 12 ++++++------ app/src/main/res/menu/import_source.xml | 8 +++++++- app/src/main/res/values-es-rES/strings.xml | 1 + app/src/main/res/values-ja-rJP/strings.xml | 1 + app/src/main/res/values-pt-rBR/strings.xml | 1 + app/src/main/res/values-vi/strings.xml | 1 + app/src/main/res/values-zh-rHK/strings.xml | 1 + app/src/main/res/values-zh-rTW/strings.xml | 1 + app/src/main/res/values-zh/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 14 files changed, 39 insertions(+), 7 deletions(-) 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 9a215a0f3..03353c557 100644 --- a/app/src/main/java/io/legado/app/constant/PreferKey.kt +++ b/app/src/main/java/io/legado/app/constant/PreferKey.kt @@ -137,6 +137,7 @@ object PreferKey { const val openBookInfoByClickTitle = "openBookInfoByClickTitle" const val defaultHomePage = "defaultHomePage" const val showBookshelfFastScroller = "showBookshelfFastScroller" + const val importKeepEnable = "importKeepEnable" const val cPrimary = "colorPrimary" const val cAccent = "colorAccent" 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 4b573c73e..8ec9f27ca 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 @@ -420,6 +420,11 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener { val importKeepName get() = appCtx.getPrefBoolean(PreferKey.importKeepName) val importKeepGroup get() = appCtx.getPrefBoolean(PreferKey.importKeepGroup) + var importKeepEnable: Boolean + get() = appCtx.getPrefBoolean(PreferKey.importKeepEnable, false) + set(value) { + appCtx.putPrefBoolean(PreferKey.importKeepEnable, value) + } var preDownloadNum get() = appCtx.getPrefInt(PreferKey.preDownloadNum, 10) diff --git a/app/src/main/java/io/legado/app/ui/association/ImportBookSourceDialog.kt b/app/src/main/java/io/legado/app/ui/association/ImportBookSourceDialog.kt index 1637f901e..a1ff32655 100644 --- a/app/src/main/java/io/legado/app/ui/association/ImportBookSourceDialog.kt +++ b/app/src/main/java/io/legado/app/ui/association/ImportBookSourceDialog.kt @@ -142,6 +142,8 @@ class ImportBookSourceDialog() : BaseDialogFragment(R.layout.dialog_recycler_vie ?.isChecked = AppConfig.importKeepName binding.toolBar.menu.findItem(R.id.menu_keep_group) ?.isChecked = AppConfig.importKeepGroup + binding.toolBar.menu.findItem(R.id.menu_keep_enable) + ?.isChecked = AppConfig.importKeepEnable } @SuppressLint("InflateParams", "NotifyDataSetChanged") @@ -179,6 +181,11 @@ class ImportBookSourceDialog() : BaseDialogFragment(R.layout.dialog_recycler_vie item.isChecked = !item.isChecked putPrefBoolean(PreferKey.importKeepGroup, item.isChecked) } + + R.id.menu_keep_enable -> { + item.isChecked = !item.isChecked + AppConfig.importKeepEnable = item.isChecked + } } return false } diff --git a/app/src/main/java/io/legado/app/ui/association/ImportBookSourceViewModel.kt b/app/src/main/java/io/legado/app/ui/association/ImportBookSourceViewModel.kt index ca62fc15b..e419826ee 100644 --- a/app/src/main/java/io/legado/app/ui/association/ImportBookSourceViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/association/ImportBookSourceViewModel.kt @@ -87,6 +87,7 @@ class ImportBookSourceViewModel(app: Application) : BaseViewModel(app) { val group = groupName?.trim() val keepName = AppConfig.importKeepName val keepGroup = AppConfig.importKeepGroup + val keepEnable = AppConfig.importKeepEnable val selectSource = arrayListOf() selectStatus.forEachIndexed { index, b -> if (b) { @@ -98,6 +99,10 @@ class ImportBookSourceViewModel(app: Application) : BaseViewModel(app) { if (keepGroup) { source.bookSourceGroup = it.bookSourceGroup } + if (keepEnable) { + source.enabled = it.enabled + source.enabledExplore = it.enabledExplore + } source.customOrder = it.customOrder } if (!group.isNullOrEmpty()) { diff --git a/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt index 149720d7c..35e69375d 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt @@ -410,8 +410,8 @@ class BookSourceEditActivity : "intro" -> searchRule.intro = viewModel.ruleComplete(it.value, searchRule.bookList) - "updateTime" -> searchRule.updateTime = - viewModel.ruleComplete(it.value, searchRule.bookList) +// "updateTime" -> searchRule.updateTime = +// viewModel.ruleComplete(it.value, searchRule.bookList) "wordCount" -> searchRule.wordCount = viewModel.ruleComplete(it.value, searchRule.bookList) @@ -442,8 +442,8 @@ class BookSourceEditActivity : "intro" -> exploreRule.intro = viewModel.ruleComplete(it.value, exploreRule.bookList) - "updateTime" -> exploreRule.updateTime = - viewModel.ruleComplete(it.value, exploreRule.bookList) +// "updateTime" -> exploreRule.updateTime = +// viewModel.ruleComplete(it.value, exploreRule.bookList) "wordCount" -> exploreRule.wordCount = viewModel.ruleComplete(it.value, exploreRule.bookList) @@ -471,8 +471,8 @@ class BookSourceEditActivity : "intro" -> bookInfoRule.intro = viewModel.ruleComplete(it.value, bookInfoRule.init) - "updateTime" -> bookInfoRule.updateTime = - viewModel.ruleComplete(it.value, bookInfoRule.init) +// "updateTime" -> bookInfoRule.updateTime = +// viewModel.ruleComplete(it.value, bookInfoRule.init) "wordCount" -> bookInfoRule.wordCount = viewModel.ruleComplete(it.value, bookInfoRule.init) diff --git a/app/src/main/res/menu/import_source.xml b/app/src/main/res/menu/import_source.xml index dae1d41a4..e0836ab9b 100644 --- a/app/src/main/res/menu/import_source.xml +++ b/app/src/main/res/menu/import_source.xml @@ -31,4 +31,10 @@ android:checkable="true" app:showAsAction="never" /> - \ No newline at end of file + + + diff --git a/app/src/main/res/values-es-rES/strings.xml b/app/src/main/res/values-es-rES/strings.xml index b3412bd1e..e66b7816b 100644 --- a/app/src/main/res/values-es-rES/strings.xml +++ b/app/src/main/res/values-es-rES/strings.xml @@ -1131,4 +1131,5 @@ 默认主页 显示快速滚动条 导出所有书的书源 + 保留启用状态 diff --git a/app/src/main/res/values-ja-rJP/strings.xml b/app/src/main/res/values-ja-rJP/strings.xml index b95316f2d..49df7b727 100644 --- a/app/src/main/res/values-ja-rJP/strings.xml +++ b/app/src/main/res/values-ja-rJP/strings.xml @@ -1134,4 +1134,5 @@ 默认主页 显示快速滚动条 导出所有书的书源 + 保留启用状态 diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 4a571f5d3..cf610bc15 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -1134,4 +1134,5 @@ 默认主页 显示快速滚动条 导出所有书的书源 + 保留启用状态 diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index 982048876..e119fe851 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -1129,4 +1129,5 @@ Còn 等待导出 显示快速滚动条 导出所有书的书源 + 保留启用状态 diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index bf9dc1e1a..d0c136f33 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -1130,4 +1130,5 @@ 等待导出 显示快速滚动条 导出所有书的书源 + 保留启用状态 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index df17cc071..71de0175c 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -1132,4 +1132,5 @@ 等待导出 显示快速滚动条 导出所有书的书源 + 保留启用状态 diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index fa28465db..c9c19e1d3 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -1132,4 +1132,5 @@ 等待导出 显示快速滚动条 导出所有书的书源 + 保留启用状态 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ac7bd5c1c..780d330b9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1134,4 +1134,5 @@ 默认主页 显示快速滚动条 导出所有书的书源 + 保留启用状态