From 0619fd0680ef43925ae3377290d287f968e0980d Mon Sep 17 00:00:00 2001 From: Horis <821938089@qq.com> Date: Wed, 26 Oct 2022 21:23:37 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/assets/updateLog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index 63349655f..6bab5f744 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -14,7 +14,7 @@ **2022/10/25** * 更新cronet: 107.0.5304.54 -* 朗读菜单的闹钟点击后可以保存设定时间,下次启动朗读自动设定时间,调不了时间的把进度条拉到0然后点一下闹钟就可以了 by Horis +* 朗读菜单的闹钟点击后可以保存设定时间,下次启动朗读自动设定时间,调不了时间、朗读固定的时间后停止的把进度条拉到0然后点一下闹钟就可以了 by Horis * 多页目录和正文添加并发访问限制 * 阅读界面点击区域支持更多选项,中间区域也可设置 From 3df4a2dcc4c268e7c8eff9c2fd70a0a9757f9366 Mon Sep 17 00:00:00 2001 From: Horis <821938089@qq.com> Date: Wed, 26 Oct 2022 21:57:06 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/book/read/config/ReadAloudDialog.kt | 8 ++++++++ app/src/main/res/layout/dialog_read_aloud.xml | 1 + 2 files changed, 9 insertions(+) diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt index 41554df80..4e298cb5c 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt @@ -12,6 +12,7 @@ import io.legado.app.base.BaseDialogFragment import io.legado.app.constant.EventBus import io.legado.app.databinding.DialogReadAloudBinding import io.legado.app.help.config.AppConfig +import io.legado.app.lib.dialogs.selector import io.legado.app.lib.theme.bottomBackground import io.legado.app.lib.theme.getPrimaryTextColor import io.legado.app.model.ReadAloud @@ -127,6 +128,13 @@ class ReadAloudDialog : BaseDialogFragment(R.layout.dialog_read_aloud) { AppConfig.ttsTimer = seekTimer.progress toastOnUi("保存设定时间成功!") } + tvTimer.setOnClickListener { + val times = arrayOf(0, 5, 10, 15, 30, 60, 90, 180) + val timeKeys = times.map { "$it 分钟" } + context?.selector("设定时间", timeKeys) { _, index -> + ReadAloud.setTimer(requireContext(), times[index]) + } + } //设置保存的默认值 seekTtsSpeechRate.progress = AppConfig.ttsSpeechRate seekTtsSpeechRate.setOnSeekBarChangeListener(object : SeekBarChangeListener { diff --git a/app/src/main/res/layout/dialog_read_aloud.xml b/app/src/main/res/layout/dialog_read_aloud.xml index 2a9467d36..5ac2f1962 100644 --- a/app/src/main/res/layout/dialog_read_aloud.xml +++ b/app/src/main/res/layout/dialog_read_aloud.xml @@ -144,6 +144,7 @@ android:id="@+id/tv_timer" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:background="?android:attr/selectableItemBackgroundBorderless" android:textColor="@color/primaryText" android:text="@string/timer_m" /> From 3c2121b156c85d8f5ba13dd187fec5e94c3b9a97 Mon Sep 17 00:00:00 2001 From: Horis <821938089@qq.com> Date: Wed, 26 Oct 2022 22:36:09 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt index 4e298cb5c..1afdc469b 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt @@ -129,7 +129,7 @@ class ReadAloudDialog : BaseDialogFragment(R.layout.dialog_read_aloud) { toastOnUi("保存设定时间成功!") } tvTimer.setOnClickListener { - val times = arrayOf(0, 5, 10, 15, 30, 60, 90, 180) + val times = intArrayOf(0, 5, 10, 15, 30, 60, 90, 180) val timeKeys = times.map { "$it 分钟" } context?.selector("设定时间", timeKeys) { _, index -> ReadAloud.setTimer(requireContext(), times[index]) From 7a8776450ecf4ef0755966dd688f15d00b2b2e1f Mon Sep 17 00:00:00 2001 From: Horis <821938089@qq.com> Date: Thu, 27 Oct 2022 13:16:56 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../legado/app/model/analyzeRule/AnalyzeUrl.kt | 6 ++++-- .../source/debug/BookSourceDebugActivity.kt | 17 +++++++++++++++-- .../io/legado/app/utils/StringExtensions.kt | 5 +++-- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt index c9bd620e1..523120290 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt @@ -14,6 +14,7 @@ import io.legado.app.data.entities.BaseSource import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookChapter import io.legado.app.exception.ConcurrentException +import io.legado.app.exception.NoStackTraceException import io.legado.app.help.CacheManager import io.legado.app.help.JsExtensions import io.legado.app.help.config.AppConfig @@ -222,8 +223,9 @@ class AnalyzeUrl( queryStr = fieldsTxt val queryS = fieldsTxt.splitNotBlank("&") for (query in queryS) { - val value = query.substringAfter("=") - val key = query.substringBefore("=") + val queryPair = query.splitNotBlank("=", limit = 2) + val key = queryPair[0] + val value = queryPair.getOrNull(1) ?: "" if (charset.isNullOrEmpty()) { if (NetworkUtils.hasUrlEncoded(value)) { fieldMap[key] = value diff --git a/app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugActivity.kt index 1b16f272a..4f893e56a 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugActivity.kt @@ -11,6 +11,7 @@ import io.legado.app.R import io.legado.app.base.VMBaseActivity import io.legado.app.databinding.ActivitySourceDebugBinding import io.legado.app.help.source.exploreKinds +import io.legado.app.lib.dialogs.selector import io.legado.app.lib.theme.accentColor import io.legado.app.lib.theme.primaryColor import io.legado.app.ui.qrcode.QrCodeResult @@ -22,6 +23,7 @@ import io.legado.app.utils.toastOnUi import io.legado.app.utils.viewbindingdelegate.viewBinding import kotlinx.coroutines.launch import splitties.views.onClick +import splitties.views.onLongClick class BookSourceDebugActivity : VMBaseActivity() { @@ -130,14 +132,25 @@ class BookSourceDebugActivity : VMBaseActivity + binding.textFx.onLongClick { + selector("选择发现", exploreKindTitles) { _, index -> + val explore = exploreKinds[index] + binding.textFx.text = "${explore.title}::${explore.url}" + searchView.setQuery(binding.textFx.text, true) + } } } } diff --git a/app/src/main/java/io/legado/app/utils/StringExtensions.kt b/app/src/main/java/io/legado/app/utils/StringExtensions.kt index f273cc45a..a02596bdb 100644 --- a/app/src/main/java/io/legado/app/utils/StringExtensions.kt +++ b/app/src/main/java/io/legado/app/utils/StringExtensions.kt @@ -73,8 +73,9 @@ fun String?.isTrue(nullIsTrue: Boolean = false): Boolean { return !this.matches("\\s*(?i)(false|no|not|0)\\s*".toRegex()) } -fun String.splitNotBlank(vararg delimiter: String): Array = run { - this.split(*delimiter).map { it.trim() }.filterNot { it.isBlank() }.toTypedArray() +fun String.splitNotBlank(vararg delimiter: String, limit: Int = 0): Array = run { + this.split(*delimiter, limit = limit).map { it.trim() }.filterNot { it.isBlank() } + .toTypedArray() } fun String.splitNotBlank(regex: Regex, limit: Int = 0): Array = run { From 768c76fc2ef8e72c7282e2af9ea9bfa464b0b8eb Mon Sep 17 00:00:00 2001 From: Horis <821938089@qq.com> Date: Thu, 27 Oct 2022 13:17:53 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt index 523120290..f0f9ce1c1 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt @@ -14,7 +14,6 @@ import io.legado.app.data.entities.BaseSource import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookChapter import io.legado.app.exception.ConcurrentException -import io.legado.app.exception.NoStackTraceException import io.legado.app.help.CacheManager import io.legado.app.help.JsExtensions import io.legado.app.help.config.AppConfig