diff options
-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"; |