Pre-select playback speeds 1.00, 1.25, 1.50, 1.75 and 2.00 only

This commit is contained in:
Martin Fietz 2016-03-17 18:25:19 +01:00
parent 4bfb0022c3
commit 4954db7738
1 changed files with 1 additions and 9 deletions

View File

@ -546,15 +546,7 @@ public class UserPreferences {
String[] selectedSpeeds = null; String[] selectedSpeeds = null;
// If this preference hasn't been set yet, return the default options // If this preference hasn't been set yet, return the default options
if (valueFromPrefs == null) { if (valueFromPrefs == null) {
String[] allSpeeds = context.getResources().getStringArray(R.array.playback_speed_values); selectedSpeeds = new String[] { "1.00", "1.25", "1.50", "1.75", "2.00" };
List<String> speedList = new ArrayList<>();
for (String speedStr : allSpeeds) {
float speed = Float.parseFloat(speedStr);
if (speed < 2.0001 && speed * 10 % 1 == 0) {
speedList.add(speedStr);
}
}
selectedSpeeds = speedList.toArray(new String[speedList.size()]);
} else { } else {
try { try {
JSONArray jsonArray = new JSONArray(valueFromPrefs); JSONArray jsonArray = new JSONArray(valueFromPrefs);