From 6219116b1b707510ee66b810ea280a0f4c8b59f8 Mon Sep 17 00:00:00 2001 From: daneren2005 Date: Mon, 20 May 2013 12:02:33 -0600 Subject: Cap the min/max level for the EQ --- .../github/daneren2005/dsub/activity/EqualizerActivity.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'subsonic-android/src') diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/EqualizerActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/EqualizerActivity.java index e5de3858..d9605fc5 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/EqualizerActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/EqualizerActivity.java @@ -142,18 +142,26 @@ public class EqualizerActivity extends Activity { private void updateBars(boolean changedEnabled) { boolean isEnabled = equalizer.getEnabled(); short minEQLevel = equalizer.getBandLevelRange()[0]; + short maxEQLevel = equalizer.getBandLevelRange()[1]; for (Map.Entry entry : bars.entrySet()) { short band = entry.getKey(); SeekBar bar = entry.getValue(); bar.setEnabled(isEnabled); if(band >= (short)0) { + short setLevel; if(changedEnabled) { - equalizer.setBandLevel(band, (short)(equalizer.getBandLevel(band) - masterLevel)); + setLevel = (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)); + setLevel = (short)(equalizer.getBandLevel(band) + masterLevel); } + if(setLevel < minEQLevel) { + setLevel = minEQLevel; + } else if(setLevel > maxEQLevel) { + setLevel = maxEQLevel; + } + equalizer.setBandLevel(band, setLevel); } else if(!isEnabled) { bar.setProgress(-minEQLevel); } -- cgit v1.2.3 From 03c7142708b26f91a65cbd4b6fd6619cf68f2cf8 Mon Sep 17 00:00:00 2001 From: daneren2005 Date: Mon, 20 May 2013 12:15:57 -0600 Subject: Don't finish restore until mediaPlayer is setup --- .../src/github/daneren2005/dsub/service/DownloadServiceImpl.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'subsonic-android/src') diff --git a/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java b/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java index fabeba6f..d157b46a 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java @@ -322,6 +322,10 @@ public class DownloadServiceImpl extends Service implements DownloadService { public void restore(List songs, int currentPlayingIndex, int currentPlayingPosition) { download(songs, false, false, false, false); if (currentPlayingIndex != -1) { + while(mediaPlayer == null) { + Util.sleepQuietly(50L); + } + play(currentPlayingIndex, autoPlayStart); if (currentPlaying != null && currentPlaying.isCompleteFileAvailable()) { doPlay(currentPlaying, currentPlayingPosition, autoPlayStart); -- cgit v1.2.3