summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorByteHamster <info@bytehamster.com>2020-01-25 13:00:05 +0100
committerByteHamster <info@bytehamster.com>2020-01-25 13:00:13 +0100
commit2f7cbefddb0724a99b0cb54c429c636d279498ca (patch)
treec71ade4d15ae661379aa50b27cd49c11aadd8e7b
parent2f0c627b15af26aace320e1984d6f398a7ee0abe (diff)
downloadAntennaPod-2f7cbefddb0724a99b0cb54c429c636d279498ca.zip
Do not link playback speed settings
Users are confused that the slider does not have all speed options anymore This basically reverts 6a56260
-rw-r--r--app/src/main/java/de/danoeh/antennapod/dialog/PlaybackControlsDialog.java28
1 files changed, 8 insertions, 20 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 3e4e40a5b..9db257503 100644
--- a/app/src/main/java/de/danoeh/antennapod/dialog/PlaybackControlsDialog.java
+++ b/app/src/main/java/de/danoeh/antennapod/dialog/PlaybackControlsDialog.java
@@ -19,9 +19,6 @@ import de.danoeh.antennapod.core.util.playback.Playable;
import de.danoeh.antennapod.core.util.playback.PlaybackController;
public class PlaybackControlsDialog extends DialogFragment {
- private static final float PLAYBACK_SPEED_STEP = 0.05f;
- private static final float DEFAULT_MIN_PLAYBACK_SPEED = 0.5f;
- private static final float DEFAULT_MAX_PLAYBACK_SPEED = 2.5f;
private static final String ARGUMENT_IS_PLAYING_VIDEO = "isPlayingVideo";
private PlaybackController controller;
@@ -77,11 +74,11 @@ public class PlaybackControlsDialog extends DialogFragment {
}
private void setupUi() {
- final SeekBar barPlaybackSpeed = (SeekBar) dialog.findViewById(R.id.playback_speed);
- final Button butDecSpeed = (Button) dialog.findViewById(R.id.butDecSpeed);
+ final SeekBar barPlaybackSpeed = dialog.findViewById(R.id.playback_speed);
+ final Button butDecSpeed = dialog.findViewById(R.id.butDecSpeed);
butDecSpeed.setOnClickListener(v -> {
if (controller != null && controller.canSetPlaybackSpeed()) {
- barPlaybackSpeed.setProgress(barPlaybackSpeed.getProgress() - 1);
+ barPlaybackSpeed.setProgress(barPlaybackSpeed.getProgress() - 2);
} else {
VariableSpeedDialog.showGetPluginDialog(getContext());
}
@@ -89,29 +86,21 @@ public class PlaybackControlsDialog extends DialogFragment {
final Button butIncSpeed = (Button) dialog.findViewById(R.id.butIncSpeed);
butIncSpeed.setOnClickListener(v -> {
if (controller != null && controller.canSetPlaybackSpeed()) {
- barPlaybackSpeed.setProgress(barPlaybackSpeed.getProgress() + 1);
+ barPlaybackSpeed.setProgress(barPlaybackSpeed.getProgress() + 2);
} else {
VariableSpeedDialog.showGetPluginDialog(getContext());
}
});
- final TextView txtvPlaybackSpeed = (TextView) dialog.findViewById(R.id.txtvPlaybackSpeed);
+ final TextView txtvPlaybackSpeed = dialog.findViewById(R.id.txtvPlaybackSpeed);
float currentSpeed = getCurrentSpeed();
- String[] availableSpeeds = UserPreferences.getPlaybackSpeedArray();
- final float minPlaybackSpeed = availableSpeeds.length > 1 ?
- Float.valueOf(availableSpeeds[0]) : DEFAULT_MIN_PLAYBACK_SPEED;
- float maxPlaybackSpeed = availableSpeeds.length > 1 ?
- Float.valueOf(availableSpeeds[availableSpeeds.length - 1]) : DEFAULT_MAX_PLAYBACK_SPEED;
- int progressMax = (int) ((maxPlaybackSpeed - minPlaybackSpeed) / PLAYBACK_SPEED_STEP);
- barPlaybackSpeed.setMax(progressMax);
-
txtvPlaybackSpeed.setText(String.format("%.2fx", currentSpeed));
barPlaybackSpeed.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (controller != null && controller.canSetPlaybackSpeed()) {
- float playbackSpeed = progress * PLAYBACK_SPEED_STEP + minPlaybackSpeed;
+ float playbackSpeed = (progress + 10) / 20.0f;
controller.setPlaybackSpeed(playbackSpeed);
String speedPref = String.format(Locale.US, "%.2f", playbackSpeed);
@@ -126,8 +115,7 @@ public class PlaybackControlsDialog extends DialogFragment {
txtvPlaybackSpeed.setText(speedStr);
} else if (fromUser) {
float speed = getCurrentSpeed();
- barPlaybackSpeed.post(() -> barPlaybackSpeed.setProgress(
- (int) ((speed - minPlaybackSpeed) / PLAYBACK_SPEED_STEP)));
+ barPlaybackSpeed.post(() -> barPlaybackSpeed.setProgress(Math.round((20 * speed) - 10)));
}
}
@@ -142,7 +130,7 @@ public class PlaybackControlsDialog extends DialogFragment {
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
- barPlaybackSpeed.setProgress(Math.round((currentSpeed - minPlaybackSpeed) / PLAYBACK_SPEED_STEP));
+ barPlaybackSpeed.setProgress(Math.round((20 * currentSpeed) - 10));
final SeekBar barLeftVolume = (SeekBar) dialog.findViewById(R.id.volume_left);
barLeftVolume.setProgress(UserPreferences.getLeftVolumePercentage());