From f63d8f980335f078a8757d724a6f7c510fe79dd2 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Tue, 12 Nov 2019 17:12:05 +0100 Subject: [PATCH] Fixed playback speed button Problem was that a float 5.99999 was casted to an int and therefore was 5. --- .../antennapod/dialog/PlaybackControlsDialog.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/PlaybackControlsDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/PlaybackControlsDialog.java index 8b8860b43..3e4e40a5b 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/PlaybackControlsDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/PlaybackControlsDialog.java @@ -9,6 +9,7 @@ import android.widget.Button; import android.widget.CheckBox; import android.widget.SeekBar; import android.widget.TextView; +import de.danoeh.antennapod.core.preferences.PlaybackPreferences; import java.util.Locale; import de.danoeh.antennapod.R; import de.danoeh.antennapod.core.feed.util.PlaybackSpeedUtils; @@ -42,7 +43,12 @@ public class PlaybackControlsDialog extends DialogFragment { @Override public void onStart() { super.onStart(); - controller = new PlaybackController(getActivity(), false); + controller = new PlaybackController(getActivity(), false) { + @Override + public void setupGUI() { + setupUi(); + } + }; controller.init(); setupUi(); } @@ -109,6 +115,7 @@ public class PlaybackControlsDialog extends DialogFragment { controller.setPlaybackSpeed(playbackSpeed); String speedPref = String.format(Locale.US, "%.2f", playbackSpeed); + PlaybackPreferences.setCurrentlyPlayingTemporaryPlaybackSpeed(playbackSpeed); if (isPlayingVideo) { UserPreferences.setVideoPlaybackSpeed(speedPref); } else { @@ -135,7 +142,7 @@ public class PlaybackControlsDialog extends DialogFragment { public void onStopTrackingTouch(SeekBar seekBar) { } }); - barPlaybackSpeed.setProgress((int) ((currentSpeed - minPlaybackSpeed) / PLAYBACK_SPEED_STEP)); + barPlaybackSpeed.setProgress(Math.round((currentSpeed - minPlaybackSpeed) / PLAYBACK_SPEED_STEP)); final SeekBar barLeftVolume = (SeekBar) dialog.findViewById(R.id.volume_left); barLeftVolume.setProgress(UserPreferences.getLeftVolumePercentage());