adding an extra check to avoid some rounding or overflowing issues
This commit is contained in:
parent
e0fd08ff1e
commit
95b6943603
1 changed files with 2 additions and 1 deletions
|
@ -46,7 +46,7 @@ class PlaybackSpeedFragment : BottomSheetDialogFragment() {
|
|||
playback_speed_seekbar.progress = config.playbackSpeedProgress
|
||||
|
||||
playback_speed_seekbar.onSeekBarChangeListener { progress ->
|
||||
val playbackSpeed = when {
|
||||
var playbackSpeed = when {
|
||||
progress < halfProgress -> {
|
||||
val lowerProgressPercent = progress / halfProgress.toFloat()
|
||||
val lowerProgress = (1 - MIN_PLAYBACK_SPEED) * lowerProgressPercent + MIN_PLAYBACK_SPEED
|
||||
|
@ -61,6 +61,7 @@ class PlaybackSpeedFragment : BottomSheetDialogFragment() {
|
|||
}
|
||||
|
||||
val stepMultiplier = 1 / STEP
|
||||
playbackSpeed = Math.min(Math.max(playbackSpeed, MIN_PLAYBACK_SPEED), MAX_PLAYBACK_SPEED)
|
||||
val rounded = Math.round(playbackSpeed * stepMultiplier) / stepMultiplier
|
||||
config.playbackSpeed = rounded
|
||||
config.playbackSpeedProgress = progress
|
||||
|
|
Loading…
Reference in a new issue