aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-02-13 21:42:47 -0800
committerScott Jackson <daneren2005@gmail.com>2013-02-13 21:42:47 -0800
commitcb0fd5e3d8417f0540a19e183e2de613efa5d9d5 (patch)
tree4db7a8b060f0c912080489fc3de14a58b3075ea1
parent9d5e7dd4f1a19fb712bd27d764909ae57d10ac6d (diff)
downloaddsub-cb0fd5e3d8417f0540a19e183e2de613efa5d9d5.tar.gz
dsub-cb0fd5e3d8417f0540a19e183e2de613efa5d9d5.tar.bz2
dsub-cb0fd5e3d8417f0540a19e183e2de613efa5d9d5.zip
Fix Master volume not working well with presets
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/activity/EqualizerActivity.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/EqualizerActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/EqualizerActivity.java
index 1dbe0f7c..e5de3858 100644
--- a/subsonic-android/src/github/daneren2005/dsub/activity/EqualizerActivity.java
+++ b/subsonic-android/src/github/daneren2005/dsub/activity/EqualizerActivity.java
@@ -126,7 +126,7 @@ public class EqualizerActivity extends Activity {
public boolean onContextItemSelected(MenuItem menuItem) {
short preset = (short) menuItem.getItemId();
equalizer.usePreset(preset);
- updateBars();
+ updateBars(false);
return true;
}
@@ -136,10 +136,10 @@ public class EqualizerActivity extends Activity {
editor.putBoolean(Constants.PREFERENCES_EQUALIZER_ON, enabled);
editor.commit();
equalizer.setEnabled(enabled);
- updateBars();
+ updateBars(true);
}
- private void updateBars() {
+ private void updateBars(boolean changedEnabled) {
boolean isEnabled = equalizer.getEnabled();
short minEQLevel = equalizer.getBandLevelRange()[0];
for (Map.Entry<Short, SeekBar> entry : bars.entrySet()) {
@@ -147,8 +147,13 @@ public class EqualizerActivity extends Activity {
SeekBar bar = entry.getValue();
bar.setEnabled(isEnabled);
if(band >= (short)0) {
- equalizer.setBandLevel(band, (short)(equalizer.getBandLevel(band) - masterLevel));
- bar.setProgress(equalizer.getBandLevel(band) - minEQLevel);
+ if(changedEnabled) {
+ equalizer.setBandLevel(band, (short)(equalizer.getBandLevel(band) - masterLevel));
+ bar.setProgress(equalizer.getBandLevel(band) - minEQLevel);
+ } else {
+ bar.setProgress(equalizer.getBandLevel(band) - minEQLevel);
+ equalizer.setBandLevel(band, (short)(equalizer.getBandLevel(band) + masterLevel));
+ }
} else if(!isEnabled) {
bar.setProgress(-minEQLevel);
}