aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/github
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-09-19 15:40:38 -0700
committerScott Jackson <daneren2005@gmail.com>2015-09-19 15:40:38 -0700
commit109c253bd93bc7dffd985cbc2d5959cf471f3944 (patch)
tree850203ac3bfd9afc58c1f649bb9d5119019b1cce /app/src/main/java/github
parent07f5b37173d53cc8ba32af3485b10aee4e5a5f11 (diff)
downloaddsub-109c253bd93bc7dffd985cbc2d5959cf471f3944.tar.gz
dsub-109c253bd93bc7dffd985cbc2d5959cf471f3944.tar.bz2
dsub-109c253bd93bc7dffd985cbc2d5959cf471f3944.zip
#550 Add option to shuffle by albums or by songs
Diffstat (limited to 'app/src/main/java/github')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/fragments/SubsonicFragment.java7
-rw-r--r--app/src/main/java/github/daneren2005/dsub/util/Constants.java1
2 files changed, 7 insertions, 1 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/SubsonicFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/SubsonicFragment.java
index fc619001..0a822483 100644
--- a/app/src/main/java/github/daneren2005/dsub/fragments/SubsonicFragment.java
+++ b/app/src/main/java/github/daneren2005/dsub/fragments/SubsonicFragment.java
@@ -897,13 +897,18 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR
root = musicService.getPlaylist(true, id, name, context, this);
}
- if(shuffle) {
+ boolean shuffleByAlbum = Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_SHUFFLE_BY_ALBUM, true);
+ if(shuffle && shuffleByAlbum) {
Collections.shuffle(root.getChildren());
}
songs = new LinkedList<Entry>();
getSongsRecursively(root, songs);
+ if(shuffle && !shuffleByAlbum) {
+ Collections.shuffle(songs);
+ }
+
DownloadService downloadService = getDownloadService();
boolean transition = false;
if (!songs.isEmpty() && downloadService != null) {
diff --git a/app/src/main/java/github/daneren2005/dsub/util/Constants.java b/app/src/main/java/github/daneren2005/dsub/util/Constants.java
index e9e668f7..cc02b709 100644
--- a/app/src/main/java/github/daneren2005/dsub/util/Constants.java
+++ b/app/src/main/java/github/daneren2005/dsub/util/Constants.java
@@ -160,6 +160,7 @@ public final class Constants {
public static final String PREFERENCES_KEY_FIRST_LEVEL_ARTIST = "firstLevelArtist";
public static final String PREFERENCES_KEY_START_ON_HEADPHONES = "startOnHeadphones";
public static final String PREFERENCES_KEY_COLOR_ACTION_BAR = "colorActionBar";
+ public static final String PREFERENCES_KEY_SHUFFLE_BY_ALBUM = "shuffleByAlbum";
public static final String OFFLINE_SCROBBLE_COUNT = "scrobbleCount";
public static final String OFFLINE_SCROBBLE_ID = "scrobbleID";