diff --git a/app/src/main/java/com/github/libretube/ui/sheets/PlaybackSpeedSheet.kt b/app/src/main/java/com/github/libretube/ui/sheets/PlaybackSpeedSheet.kt index 33f8ac00f..6583fca95 100644 --- a/app/src/main/java/com/github/libretube/ui/sheets/PlaybackSpeedSheet.kt +++ b/app/src/main/java/com/github/libretube/ui/sheets/PlaybackSpeedSheet.kt @@ -31,18 +31,28 @@ class PlaybackSpeedSheet( binding.pitch.value = player.playbackParameters.pitch binding.speed.addOnChangeListener { _, value, _ -> - onChange(value, binding.pitch.value.round(2)) + onChange() } binding.pitch.addOnChangeListener { _, value, _ -> - onChange(binding.speed.value.round(2), value) + onChange() + } + + binding.resetSpeed.setOnClickListener { + binding.speed.value = 1f + onChange() + } + + binding.resetPitch.setOnClickListener { + binding.pitch.value = 1f + onChange() } } - private fun onChange(speed: Float, pitch: Float) { + private fun onChange() { player.playbackParameters = PlaybackParameters( - speed, - pitch + binding.speed.value.round(2), + binding.pitch.value.round(2) ) } diff --git a/app/src/main/res/layout/playback_bottom_sheet.xml b/app/src/main/res/layout/playback_bottom_sheet.xml index 913345c1f..ab34782c3 100644 --- a/app/src/main/res/layout/playback_bottom_sheet.xml +++ b/app/src/main/res/layout/playback_bottom_sheet.xml @@ -34,28 +34,61 @@ android:layout_height="wrap_content" android:text="@string/playback_speed" /> - + android:layout_height="wrap_content"> + + + + + + - + android:orientation="horizontal"> + + + + + +