From b02ee962980e3e22e71f926b01b3c3c4b4ae77f1 Mon Sep 17 00:00:00 2001 From: Xwite <1797350009@qq.com> Date: Thu, 27 Jan 2022 20:14:27 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=B9=A6=E6=BA=90=E6=A0=A1=E9=AA=8C:?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA=E8=B0=83=E8=AF=95=E7=AC=A6=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/constant/AppPattern.kt | 3 +++ app/src/main/java/io/legado/app/model/Debug.kt | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/constant/AppPattern.kt b/app/src/main/java/io/legado/app/constant/AppPattern.kt index 2c9d60130..20fd7f1c9 100644 --- a/app/src/main/java/io/legado/app/constant/AppPattern.kt +++ b/app/src/main/java/io/legado/app/constant/AppPattern.kt @@ -16,6 +16,9 @@ object AppPattern { val fileNameRegex = Regex("[\\\\/:*?\"<>|.]") val splitGroupRegex = Regex("[,;,;]") + //书源调试信息中的各种符号 + val debugMessageSymbolRegex = Regex("[⇒◇┌└≡]") + /** * 所有标点 */ diff --git a/app/src/main/java/io/legado/app/model/Debug.kt b/app/src/main/java/io/legado/app/model/Debug.kt index 445affb7f..690e25f96 100644 --- a/app/src/main/java/io/legado/app/model/Debug.kt +++ b/app/src/main/java/io/legado/app/model/Debug.kt @@ -1,6 +1,7 @@ package io.legado.app.model import android.annotation.SuppressLint +import io.legado.app.constant.AppPattern import io.legado.app.data.entities.* import io.legado.app.help.coroutine.CompositeCoroutine import io.legado.app.model.rss.Rss @@ -56,7 +57,7 @@ object Debug { if (showTime && debugTimeMap[sourceUrl] != null) { val time = debugTimeFormat.format(Date(System.currentTimeMillis() - debugTimeMap[sourceUrl]!!)) - printMsg = printMsg.substring(1) + printMsg = printMsg.replace(AppPattern.debugMessageSymbolRegex,"") debugMessageMap[sourceUrl] = "$time $printMsg" } } From 1703c5ed1c92bbbb0648e83a5177f7027b551775 Mon Sep 17 00:00:00 2001 From: Xwite <1797350009@qq.com> Date: Fri, 28 Jan 2022 09:55:12 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=A4=8D=E9=80=89=E6=A1=86=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/model/CheckSource.kt | 2 +- .../legado/app/ui/config/CheckSourceConfig.kt | 42 +++++++++++++++---- .../res/layout/dialog_check_source_config.xml | 10 +++-- app/src/main/res/values/strings.xml | 1 - 4 files changed, 41 insertions(+), 14 deletions(-) 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 f7056b6c9..dadc16f8f 100644 --- a/app/src/main/java/io/legado/app/model/CheckSource.kt +++ b/app/src/main/java/io/legado/app/model/CheckSource.kt @@ -47,7 +47,7 @@ object CheckSource { } fun putConfig() { - CacheManager.put("checkSourceTimeout", timeout * 1000) + CacheManager.put("checkSourceTimeout", timeout) CacheManager.put("checkSearch", checkSearch) CacheManager.put("checkDiscovery", checkDiscovery) CacheManager.put("checkInfo", checkInfo) 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 2eb62df2a..c0a884081 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 @@ -31,6 +31,36 @@ class CheckSourceConfig : BaseDialogFragment(R.layout.dialog_check_source_config override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { binding.toolBar.setBackgroundColor(primaryColor) + binding.run { + checkSearch.onClick { + if (!checkSearch.isChecked && !checkDiscovery.isChecked) { + checkDiscovery.isChecked = true + } + } + checkDiscovery.onClick { + if (!checkSearch.isChecked && !checkDiscovery.isChecked) { + checkSearch.isChecked = true + } + } + checkInfo.onClick { + if (!checkInfo.isChecked) { + checkCategory.isChecked = false + checkContent.isChecked = false + checkCategory.isEnabled = false + checkContent.isEnabled = false + } else { + checkCategory.isEnabled = true + } + } + checkCategory.onClick { + if (!checkCategory.isChecked) { + checkContent.isChecked = false + checkContent.isEnabled = false + } else { + checkContent.isEnabled = true + } + } + } CheckSource.run { binding.checkSourceTimeout.setText((timeout / 1000).toString()) binding.checkSearch.isChecked = checkSearch @@ -38,6 +68,8 @@ class CheckSourceConfig : BaseDialogFragment(R.layout.dialog_check_source_config binding.checkInfo.isChecked = checkInfo binding.checkCategory.isChecked = checkCategory binding.checkContent.isChecked = checkContent + binding.checkCategory.isEnabled = checkInfo + binding.checkContent.isEnabled = checkCategory binding.tvCancel.onClick { dismiss() } @@ -60,14 +92,8 @@ class CheckSourceConfig : BaseDialogFragment(R.layout.dialog_check_source_config } else -> timeout = text.toLong() * 1000 } - val mCheckSearch = binding.checkSearch.isChecked - val mCheckDiscovery = binding.checkDiscovery.isChecked - if (!mCheckSearch && !mCheckDiscovery) { - toastOnUi(getString(R.string.error_check_source_config)) - return@onClick - } - checkSearch = mCheckSearch - checkDiscovery = mCheckDiscovery + checkSearch = binding.checkSearch.isChecked + checkDiscovery = binding.checkDiscovery.isChecked checkInfo = binding.checkInfo.isChecked checkCategory = binding.checkCategory.isChecked checkContent = binding.checkContent.isChecked diff --git a/app/src/main/res/layout/dialog_check_source_config.xml b/app/src/main/res/layout/dialog_check_source_config.xml index a925b1162..5a6dd410d 100644 --- a/app/src/main/res/layout/dialog_check_source_config.xml +++ b/app/src/main/res/layout/dialog_check_source_config.xml @@ -18,6 +18,8 @@ @@ -74,8 +76,8 @@ 超时 小于 - 搜索发现至少校验一个 校验超时: %1$s秒\n校验项目:%2$s