From 3f5b8d30bd70e6e28a70c3ec12dc8ad83984ef70 Mon Sep 17 00:00:00 2001 From: NineWorlds <1365887550@qq.com> Date: Mon, 2 Aug 2021 18:01:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=87=AA=E5=8A=A8=E7=BF=BB?= =?UTF-8?q?=E9=A1=B5=E9=80=9F=E5=BA=A6=E8=8C=83=E5=9B=B4=E4=BB=A5=E5=8B=89?= =?UTF-8?q?=E5=BC=BA=E5=8F=AF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/help/ReadBookConfig.kt | 2 +- .../java/io/legado/app/ui/book/read/ReadBookActivity.kt | 4 +++- .../io/legado/app/ui/book/read/config/AutoReadDialog.kt | 6 +++--- app/src/main/res/layout/dialog_auto_read.xml | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt index d76027909..2598e9c94 100644 --- a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt +++ b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt @@ -135,7 +135,7 @@ object ReadBookConfig { //配置写入读取 var readBodyToLh = appCtx.getPrefBoolean(PreferKey.readBodyToLh, true) - var autoReadSpeed = appCtx.getPrefInt(PreferKey.autoReadSpeed, 46) + var autoReadSpeed = appCtx.getPrefInt(PreferKey.autoReadSpeed, 10) set(value) { field = value appCtx.putPrefInt(PreferKey.autoReadSpeed, value) diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index 448d0795e..65bbfc910 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt @@ -700,7 +700,9 @@ class ReadBookActivity : ReadBookBaseActivity(), var delayMillis = ReadBookConfig.autoReadSpeed * 1000L / binding.readView.height var scrollOffset = 1 if (delayMillis < 20) { - scrollOffset = 20 / delayMillis.toInt() + var delayInt=delayMillis.toInt() + if(delayInt==0)delayInt =1 + scrollOffset = 20 / delayInt delayMillis = 20 } mHandler.removeCallbacks(autoPageRunnable) diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/AutoReadDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/AutoReadDialog.kt index 9c9f774ff..bd7b835b8 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/AutoReadDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/AutoReadDialog.kt @@ -73,7 +73,7 @@ class AutoReadDialog : BaseDialogFragment() { } private fun initData() { - val speed = if (ReadBookConfig.autoReadSpeed < 10) 10 else ReadBookConfig.autoReadSpeed + val speed = if (ReadBookConfig.autoReadSpeed < 2) 2 else ReadBookConfig.autoReadSpeed binding.tvReadSpeed.text = String.format("%ds", speed) binding.seekAutoRead.progress = speed } @@ -81,13 +81,13 @@ class AutoReadDialog : BaseDialogFragment() { private fun initOnChange() { binding.seekAutoRead.setOnSeekBarChangeListener(object : SeekBarChangeListener { override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) { - val speed = if (progress < 10) 10 else progress + val speed = if (progress < 2) 2 else progress binding.tvReadSpeed.text = String.format("%ds", speed) } override fun onStopTrackingTouch(seekBar: SeekBar) { ReadBookConfig.autoReadSpeed = - if (binding.seekAutoRead.progress < 10) 10 else binding.seekAutoRead.progress + if (binding.seekAutoRead.progress < 2) 2 else binding.seekAutoRead.progress upTtsSpeechRate() } }) diff --git a/app/src/main/res/layout/dialog_auto_read.xml b/app/src/main/res/layout/dialog_auto_read.xml index fb662cc73..9a2e1e196 100644 --- a/app/src/main/res/layout/dialog_auto_read.xml +++ b/app/src/main/res/layout/dialog_auto_read.xml @@ -47,8 +47,8 @@ android:layout_height="wrap_content" android:layout_marginStart="15dp" android:layout_marginEnd="15dp" - android:min="10" - android:max="100" + android:min="2" + android:max="60" tools:ignore="UnusedAttribute" />