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] =?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" />