Merge pull request #1203 from JiuZhouWorlds/master

修改自动翻页速度范围以勉强可用
pull/1217/head
kunfei 3 years ago committed by GitHub
commit 794895291b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/src/main/java/io/legado/app/help/ReadBookConfig.kt
  2. 4
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  3. 6
      app/src/main/java/io/legado/app/ui/book/read/config/AutoReadDialog.kt
  4. 4
      app/src/main/res/layout/dialog_auto_read.xml

@ -135,7 +135,7 @@ object ReadBookConfig {
//配置写入读取 //配置写入读取
var readBodyToLh = appCtx.getPrefBoolean(PreferKey.readBodyToLh, true) var readBodyToLh = appCtx.getPrefBoolean(PreferKey.readBodyToLh, true)
var autoReadSpeed = appCtx.getPrefInt(PreferKey.autoReadSpeed, 46) var autoReadSpeed = appCtx.getPrefInt(PreferKey.autoReadSpeed, 10)
set(value) { set(value) {
field = value field = value
appCtx.putPrefInt(PreferKey.autoReadSpeed, value) appCtx.putPrefInt(PreferKey.autoReadSpeed, value)

@ -700,7 +700,9 @@ class ReadBookActivity : ReadBookBaseActivity(),
var delayMillis = ReadBookConfig.autoReadSpeed * 1000L / binding.readView.height var delayMillis = ReadBookConfig.autoReadSpeed * 1000L / binding.readView.height
var scrollOffset = 1 var scrollOffset = 1
if (delayMillis < 20) { if (delayMillis < 20) {
scrollOffset = 20 / delayMillis.toInt() var delayInt=delayMillis.toInt()
if(delayInt==0)delayInt =1
scrollOffset = 20 / delayInt
delayMillis = 20 delayMillis = 20
} }
mHandler.removeCallbacks(autoPageRunnable) mHandler.removeCallbacks(autoPageRunnable)

@ -73,7 +73,7 @@ class AutoReadDialog : BaseDialogFragment() {
} }
private fun initData() { 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.tvReadSpeed.text = String.format("%ds", speed)
binding.seekAutoRead.progress = speed binding.seekAutoRead.progress = speed
} }
@ -81,13 +81,13 @@ class AutoReadDialog : BaseDialogFragment() {
private fun initOnChange() { private fun initOnChange() {
binding.seekAutoRead.setOnSeekBarChangeListener(object : SeekBarChangeListener { binding.seekAutoRead.setOnSeekBarChangeListener(object : SeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) { 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) binding.tvReadSpeed.text = String.format("%ds", speed)
} }
override fun onStopTrackingTouch(seekBar: SeekBar) { override fun onStopTrackingTouch(seekBar: SeekBar) {
ReadBookConfig.autoReadSpeed = ReadBookConfig.autoReadSpeed =
if (binding.seekAutoRead.progress < 10) 10 else binding.seekAutoRead.progress if (binding.seekAutoRead.progress < 2) 2 else binding.seekAutoRead.progress
upTtsSpeechRate() upTtsSpeechRate()
} }
}) })

@ -47,8 +47,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="15dp" android:layout_marginStart="15dp"
android:layout_marginEnd="15dp" android:layout_marginEnd="15dp"
android:min="10" android:min="2"
android:max="100" android:max="60"
tools:ignore="UnusedAttribute" /> tools:ignore="UnusedAttribute" />
</LinearLayout> </LinearLayout>

Loading…
Cancel
Save