aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/github/daneren2005/dsub/fragments/MainFragment.java1
-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
-rw-r--r--app/src/main/res/values/strings.xml3
-rw-r--r--app/src/main/res/xml/settings.xml7
5 files changed, 18 insertions, 1 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/MainFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/MainFragment.java
index 605ab79e..ea894485 100644
--- a/app/src/main/java/github/daneren2005/dsub/fragments/MainFragment.java
+++ b/app/src/main/java/github/daneren2005/dsub/fragments/MainFragment.java
@@ -113,6 +113,7 @@ public class MainFragment extends SelectRecyclerFragment<Integer> {
albums.add(R.string.main_albums_genres);
albums.add(R.string.main_albums_year);
albums.add(R.string.main_albums_recent);
+ albums.add(R.string.main_albums_frequent);
sections.add(albums);
headers.add("albums");
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";
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 453cfdb1..d87dbf69 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -459,6 +459,9 @@
<string name="settings.start_on_headphones_summary">Start when headphones are plugged in. This requires the use of a service which starts on boot up to check for the headphone plug event even when DSub is not running.</string>
<string name="settings.color_action_bar">Color Action Bar</string>
<string name="settings.color_action_bar.summary">Color the action bar and status bar or leave them alone</string>
+ <string name="settings.shuffle_by_album">Shuffle By Album</string>
+ <string name="settings.shuffle_by_album.true">Shuffle order of albums</string>
+ <string name="settings.shuffle_by_album.false">Shuffle all songs together</string>
<string name="shuffle.title">Shuffle By</string>
<string name="shuffle.startYear">Start Year:</string>
diff --git a/app/src/main/res/xml/settings.xml b/app/src/main/res/xml/settings.xml
index b30d59fd..dec8d928 100644
--- a/app/src/main/res/xml/settings.xml
+++ b/app/src/main/res/xml/settings.xml
@@ -436,6 +436,13 @@
android:title="@string/settings.other_title">
<CheckBoxPreference
+ android:title="@string/settings.shuffle_by_album"
+ android:key="shuffleByAlbum"
+ android:defaultValue="true"
+ android:summaryOn="@string/settings.shuffle_by_album.true"
+ android:summaryOff="@string/settings.shuffle_by_album.false"/>
+
+ <CheckBoxPreference
android:title="@string/settings.scrobble_title"
android:summary="@string/settings.scrobble_summary"
android:key="scrobble"