From 1e767686442358b6e448a44c086fd407d66eda62 Mon Sep 17 00:00:00 2001 From: Xwite <1797350009@qq.com> Date: Thu, 27 Jan 2022 15:45:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0summary?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/assets/updateLog.md | 1 + .../java/io/legado/app/model/CheckSource.kt | 17 +++++++++++++++++ .../legado/app/ui/config/CheckSourceConfig.kt | 3 +++ .../legado/app/ui/config/OtherConfigFragment.kt | 5 +++++ app/src/main/res/values/strings.xml | 1 + 5 files changed, 27 insertions(+) diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index 75f838848..4adf7ab85 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -15,6 +15,7 @@ * 修复web写源订阅源保存失败bug * http朗读下载错误连续5次后自动暂停 +* 添加其他设置-校验设置 * 其它一些优化 **2022/01/20** diff --git a/app/src/main/java/io/legado/app/model/CheckSource.kt b/app/src/main/java/io/legado/app/model/CheckSource.kt index 887235701..f7056b6c9 100644 --- a/app/src/main/java/io/legado/app/model/CheckSource.kt +++ b/app/src/main/java/io/legado/app/model/CheckSource.kt @@ -8,6 +8,7 @@ import io.legado.app.service.CheckSourceService import io.legado.app.utils.startService import io.legado.app.utils.toastOnUi import io.legado.app.help.CacheManager +import splitties.init.appCtx object CheckSource { var keyword = "我的" @@ -18,6 +19,11 @@ object CheckSource { var checkInfo = CacheManager.get("checkInfo")?.toBoolean() ?: true var checkCategory = CacheManager.get("checkCategory")?.toBoolean() ?: true var checkContent = CacheManager.get("checkContent")?.toBoolean() ?: true + var summary = "" + + init { + upSummary() + } fun start(context: Context, sources: List) { if (sources.isEmpty()) { @@ -47,5 +53,16 @@ object CheckSource { CacheManager.put("checkInfo", checkInfo) CacheManager.put("checkCategory", checkCategory) CacheManager.put("checkContent", checkContent) + upSummary() + } + + fun upSummary() { + summary = "" + if (checkSearch) summary = "${summary} ${appCtx.getString(R.string.search)}" + if (checkDiscovery) summary = "${summary} ${appCtx.getString(R.string.discovery)}" + if (checkInfo) summary = "${summary} ${appCtx.getString(R.string.source_tab_info)}" + if (checkCategory) summary = "${summary} ${appCtx.getString(R.string.chapter_list)}" + if (checkContent) summary = "${summary} ${appCtx.getString(R.string.main_body)}" + summary = appCtx.getString(R.string.check_source_config_summary, (timeout / 1000).toString(), summary) } } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/config/CheckSourceConfig.kt b/app/src/main/java/io/legado/app/ui/config/CheckSourceConfig.kt index 0be6dee25..68d259838 100644 --- a/app/src/main/java/io/legado/app/ui/config/CheckSourceConfig.kt +++ b/app/src/main/java/io/legado/app/ui/config/CheckSourceConfig.kt @@ -12,6 +12,8 @@ import io.legado.app.utils.setLayout import io.legado.app.utils.viewbindingdelegate.viewBinding import io.legado.app.utils.toastOnUi import splitties.views.onClick +import io.legado.app.constant.PreferKey +import io.legado.app.utils.putPrefString class CheckSourceConfig : BaseDialogFragment(R.layout.dialog_check_source_config) { @@ -64,6 +66,7 @@ class CheckSourceConfig : BaseDialogFragment(R.layout.dialog_check_source_config checkCategory = binding.checkCategory?.isChecked checkContent = binding.checkContent?.isChecked putConfig() + putPrefString(PreferKey.checkSource, summary) dismiss() } } diff --git a/app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt b/app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt index 31ea56012..ec30dc950 100644 --- a/app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt +++ b/app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt @@ -12,6 +12,7 @@ import io.legado.app.R import io.legado.app.base.BasePreferenceFragment import io.legado.app.constant.EventBus import io.legado.app.constant.PreferKey +import io.legado.app.model.CheckSource import io.legado.app.databinding.DialogEditTextBinding import io.legado.app.help.AppConfig import io.legado.app.help.BookHelp @@ -52,6 +53,7 @@ class OtherConfigFragment : BasePreferenceFragment(), AppConfig.defaultBookTreeUri?.let { upPreferenceSummary(PreferKey.defaultBookTreeUri, it) } + upPreferenceSummary(PreferKey.checkSource, CheckSource.summary) } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { @@ -134,6 +136,9 @@ class OtherConfigFragment : BasePreferenceFragment(), PreferKey.userAgent -> listView.post { upPreferenceSummary(PreferKey.userAgent, AppConfig.userAgent) } + PreferKey.checkSource -> listView.post { + upPreferenceSummary(PreferKey.checkSource, CheckSource.summary) + } } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 743a0c778..66145195e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -929,5 +929,6 @@ 小于 搜索发现至少校验一个 + 校验超时: %1$s秒\n校验项目:%2$s