[Android] VLCOptions: don't use any equalizer by default
Thomas Guillem
git at videolan.org
Mon Oct 23 15:10:55 CEST 2017
vlc-android | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Oct 23 15:09:30 2017 +0200| [ad648d578df04d7d96a90194a9b294568544e125] | committer: Thomas Guillem
VLCOptions: don't use any equalizer by default
> https://code.videolan.org/videolan/vlc-android/commit/ad648d578df04d7d96a90194a9b294568544e125
---
vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.java | 2 ++
vlc-android/src/org/videolan/vlc/util/VLCOptions.java | 8 +++++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.java
index 48ffd2b0d..896c07ce1 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.java
@@ -133,6 +133,8 @@ public class EqualizerFragment extends AppCompatDialogFragment implements Playba
allSets.add(newPresetName);
mEqualizer = VLCOptions.getEqualizerSetFromSettings(context);
+ if (mEqualizer == null)
+ mEqualizer = MediaPlayer.Equalizer.createFromPreset(0);
// on/off
binding.equalizerButton.setChecked(VLCOptions.getEqualizerEnabledState(context));
diff --git a/vlc-android/src/org/videolan/vlc/util/VLCOptions.java b/vlc-android/src/org/videolan/vlc/util/VLCOptions.java
index 47c857ec0..f7c68e802 100644
--- a/vlc-android/src/org/videolan/vlc/util/VLCOptions.java
+++ b/vlc-android/src/org/videolan/vlc/util/VLCOptions.java
@@ -205,8 +205,10 @@ public class VLCOptions {
@MainThread
public static MediaPlayer.Equalizer getEqualizerSetFromSettings(Context context) {
final SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context);
- final float[] bands = Preferences.getFloatArray(pref, "equalizer_values");
- if (bands != null && pref.contains("equalizer_enabled")) {
+ if (pref.getBoolean("equalizer_enabled", false)) {
+ final float[] bands = Preferences.getFloatArray(pref, "equalizer_values");
+ if (bands == null)
+ return null;
final int bandCount = MediaPlayer.Equalizer.getBandCount();
if (bands.length != bandCount + 1)
return null;
@@ -217,7 +219,7 @@ public class VLCOptions {
eq.setAmp(i, bands[i + 1]);
return eq;
} else
- return MediaPlayer.Equalizer.createFromPreset(0);
+ return null;
}
@MainThread
More information about the Android
mailing list