diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-05-22 21:27:04 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-05-22 21:27:04 -0700 |
commit | 2212922e1d10e6d1097064199ae733cdb4a55c52 (patch) | |
tree | 829c2e8c8309eb3b2e9fd632d968be64d1a45b90 | |
parent | 83f8d809ec47c70417d6ffdfd4844d6e4b2a84ea (diff) | |
download | dsub-2212922e1d10e6d1097064199ae733cdb4a55c52.tar.gz dsub-2212922e1d10e6d1097064199ae733cdb4a55c52.tar.bz2 dsub-2212922e1d10e6d1097064199ae733cdb4a55c52.zip |
#128 Make Shuffle Play persistent
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java | 13 | ||||
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/util/Constants.java | 1 |
2 files changed, 13 insertions, 1 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java b/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java index d157b46a..fbb15b73 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java @@ -264,7 +264,7 @@ public class DownloadServiceImpl extends Service implements DownloadService { @Override public synchronized void download(List<MusicDirectory.Entry> songs, boolean save, boolean autoplay, boolean playNext, boolean shuffle) { - shufflePlay = false; + setShufflePlayEnabled(false); int offset = 1; if (songs.isEmpty()) { @@ -320,7 +320,15 @@ public class DownloadServiceImpl extends Service implements DownloadService { } public void restore(List<MusicDirectory.Entry> songs, int currentPlayingIndex, int currentPlayingPosition) { + SharedPreferences prefs = Util.getPreferences(this); + boolean startShufflePlay = prefs.getBoolean(Constants.PREFERENCES_KEY_SHUFFLE_MODE, false); download(songs, false, false, false, false); + if(startShufflePlay) { + shufflePlay = true; + SharedPreferences.Editor editor = prefs.edit(); + editor.putBoolean(Constants.PREFERENCES_KEY_SHUFFLE_MODE, true); + editor.commit(); + } if (currentPlayingIndex != -1) { while(mediaPlayer == null) { Util.sleepQuietly(50L); @@ -341,6 +349,9 @@ public class DownloadServiceImpl extends Service implements DownloadService { clear(); checkDownloads(); } + SharedPreferences.Editor editor = Util.getPreferences(this).edit(); + editor.putBoolean(Constants.PREFERENCES_KEY_SHUFFLE_MODE, enabled); + editor.commit(); } @Override diff --git a/subsonic-android/src/github/daneren2005/dsub/util/Constants.java b/subsonic-android/src/github/daneren2005/dsub/util/Constants.java index 12ee9e90..b6cb3d89 100644 --- a/subsonic-android/src/github/daneren2005/dsub/util/Constants.java +++ b/subsonic-android/src/github/daneren2005/dsub/util/Constants.java @@ -100,6 +100,7 @@ public final class Constants { public static final String PREFERENCES_EQUALIZER_SETTINGS = "equalizerSettings"; public static final String PREFERENCES_KEY_PERSISTENT_NOTIFICATION = "persistentNotification"; public static final String PREFERENCES_KEY_GAPLESS_PLAYBACK = "gaplessPlayback"; + public static final String PREFERENCES_KEY_SHUFFLE_MODE = "shuffleMode"; public static final String MAIN_BACK_STACK = "backStackIds"; public static final String MAIN_BACK_STACK_SIZE = "backStackIdsSize"; |