diff options
author | Scott Jackson <daneren2005@gmail.com> | 2015-05-12 08:35:10 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2015-05-12 08:35:10 -0700 |
commit | ec0fbf498e1506368a057a594d89a8fcbc6503ce (patch) | |
tree | 5aaeb0599a81442799751f21ea59ade722723374 /app/src/main | |
parent | 1bab06f14458468b3d0e7e12ec87c0af7bcea678 (diff) | |
download | dsub-ec0fbf498e1506368a057a594d89a8fcbc6503ce.tar.gz dsub-ec0fbf498e1506368a057a594d89a8fcbc6503ce.tar.bz2 dsub-ec0fbf498e1506368a057a594d89a8fcbc6503ce.zip |
Fix a couple of EQ related crashes
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/fragments/EqualizerFragment.java | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/EqualizerFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/EqualizerFragment.java index b7080a8e..ea61f2c7 100644 --- a/app/src/main/java/github/daneren2005/dsub/fragments/EqualizerFragment.java +++ b/app/src/main/java/github/daneren2005/dsub/fragments/EqualizerFragment.java @@ -274,11 +274,15 @@ public class EqualizerFragment extends SubsonicFragment { bar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { - short level = (short) (progress + minEQLevel); - if (fromUser) { - equalizer.setBandLevel(band, (short)(level + masterLevel)); + try { + short level = (short) (progress + minEQLevel); + if (fromUser) { + equalizer.setBandLevel(band, (short) (level + masterLevel)); + } + updateLevelText(levelTextView, level); + } catch(Exception e) { + Log.e(TAG, "Failed to change equalizer", e); } - updateLevelText(levelTextView, level); } @Override @@ -410,18 +414,22 @@ public class EqualizerFragment extends SubsonicFragment { bar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { - masterLevel = (short) (progress + minEQLevel); - if (fromUser) { - SharedPreferences prefs = Util.getPreferences(context); - SharedPreferences.Editor editor = prefs.edit(); - editor.putInt(Constants.PREFERENCES_EQUALIZER_SETTINGS, masterLevel); - editor.commit(); - for (short i = 0; i < equalizer.getNumberOfBands(); i++) { - short level = (short) ((bars.get(i).getProgress() + minEQLevel) + masterLevel); - equalizer.setBandLevel(i, level); + try { + masterLevel = (short) (progress + minEQLevel); + if (fromUser) { + SharedPreferences prefs = Util.getPreferences(context); + SharedPreferences.Editor editor = prefs.edit(); + editor.putInt(Constants.PREFERENCES_EQUALIZER_SETTINGS, masterLevel); + editor.commit(); + for (short i = 0; i < equalizer.getNumberOfBands(); i++) { + short level = (short) ((bars.get(i).getProgress() + minEQLevel) + masterLevel); + equalizer.setBandLevel(i, level); + } } + updateLevelText(levelTextView, masterLevel); + } catch(Exception e) { + Log.e(TAG, "Failed to change equalizer", e); } - updateLevelText(levelTextView, masterLevel); } @Override |