自动翻页速度下限调整为1秒 (#4588)
Some checks are pending
Test Build / prepare (push) Waiting to run
Test Build / build (app, release) (push) Blocked by required conditions
Test Build / build (app, releaseA) (push) Blocked by required conditions
Test Build / prerelease (push) Blocked by required conditions
Test Build / lanzou (push) Blocked by required conditions
Test Build / test_Branch (push) Blocked by required conditions
Test Build / telegram (push) Blocked by required conditions

This commit is contained in:
niuhb
2025-01-30 20:10:35 +08:00
committed by GitHub
parent 9d9a754682
commit b0bf63eaf4
2 changed files with 7 additions and 6 deletions

View File

@@ -22,6 +22,7 @@ import io.legado.app.ui.book.read.ReadBookActivity
import io.legado.app.ui.widget.seekbar.SeekBarChangeListener
import io.legado.app.utils.ColorUtils
import io.legado.app.utils.viewbindingdelegate.viewBinding
import java.util.Locale
class AutoReadDialog : BaseDialogFragment(R.layout.dialog_auto_read) {
@@ -74,21 +75,21 @@ class AutoReadDialog : BaseDialogFragment(R.layout.dialog_auto_read) {
}
private fun initData() {
val speed = if (ReadBookConfig.autoReadSpeed < 2) 2 else ReadBookConfig.autoReadSpeed
binding.tvReadSpeed.text = String.format("%ds", speed)
val speed = if (ReadBookConfig.autoReadSpeed < 1) 1 else ReadBookConfig.autoReadSpeed
binding.tvReadSpeed.text = String.format(Locale.ROOT, "%ds", speed)
binding.seekAutoRead.progress = speed
}
private fun initOnChange() {
binding.seekAutoRead.setOnSeekBarChangeListener(object : SeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
val speed = if (progress < 2) 2 else progress
binding.tvReadSpeed.text = String.format("%ds", speed)
val speed = if (progress < 1) 1 else progress
binding.tvReadSpeed.text = String.format(Locale.ROOT,"%ds", speed)
}
override fun onStopTrackingTouch(seekBar: SeekBar) {
ReadBookConfig.autoReadSpeed =
if (binding.seekAutoRead.progress < 2) 2 else binding.seekAutoRead.progress
if (binding.seekAutoRead.progress < 1) 1 else binding.seekAutoRead.progress
upTtsSpeechRate()
}
})

View File

@@ -47,7 +47,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:min="2"
android:min="1"
android:max="60"
tools:ignore="UnusedAttribute" />