aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-10-25 07:56:58 -0700
committerScott Jackson <daneren2005@gmail.com>2014-10-25 07:56:58 -0700
commit1fa2f0825f8371be4e2302380dcc285d92ed8e95 (patch)
tree4ba5c8cdf1b1d3e47e93a6a86d62a6a420c9ae6b
parent6b6b3bcbcf47de353ff7ad3f82d6c6228a04c9d8 (diff)
parent627eda88c2142c5d90b52fa4cbb0a85839007321 (diff)
downloaddsub-1fa2f0825f8371be4e2302380dcc285d92ed8e95.tar.gz
dsub-1fa2f0825f8371be4e2302380dcc285d92ed8e95.tar.bz2
dsub-1fa2f0825f8371be4e2302380dcc285d92ed8e95.zip
Merge branch 'master' into Bookmarks
-rw-r--r--res/drawable-hdpi/ic_menu_shuffle_selected.pngbin0 -> 1138 bytes
-rw-r--r--res/drawable-mdpi/ic_menu_shuffle_selected.pngbin0 -> 733 bytes
-rw-r--r--res/drawable-xhdpi/ic_menu_shuffle_selected.pngbin0 -> 1670 bytes
-rw-r--r--res/drawable-xxhdpi/ic_menu_shuffle_selected.pngbin0 -> 2573 bytes
-rw-r--r--res/layout/download_media_buttons.xml4
-rw-r--r--res/menu/nowplaying.xml12
-rw-r--r--res/menu/nowplaying_offline.xml12
-rw-r--r--res/menu/select_album_context.xml5
-rw-r--r--res/menu/select_album_context_offline.xml6
-rw-r--r--res/menu/select_playlist_context.xml5
-rw-r--r--res/menu/select_playlist_context_offline.xml5
-rw-r--r--res/menu/select_song.xml6
-rw-r--r--res/menu/select_song_offline.xml6
-rw-r--r--res/values/strings.xml2
-rw-r--r--src/github/daneren2005/dsub/fragments/NowPlayingFragment.java90
-rw-r--r--src/github/daneren2005/dsub/fragments/SearchFragment.java3
-rw-r--r--src/github/daneren2005/dsub/fragments/SelectBookmarkFragment.java10
-rw-r--r--src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java10
-rw-r--r--src/github/daneren2005/dsub/fragments/SelectPlaylistFragment.java11
-rw-r--r--src/github/daneren2005/dsub/fragments/SubsonicFragment.java12
-rw-r--r--src/github/daneren2005/dsub/service/DownloadService.java15
-rw-r--r--src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java2
-rw-r--r--test/github/daneren2005/dsub/service/DownloadServiceTest.java10
23 files changed, 91 insertions, 135 deletions
diff --git a/res/drawable-hdpi/ic_menu_shuffle_selected.png b/res/drawable-hdpi/ic_menu_shuffle_selected.png
new file mode 100644
index 00000000..e2ace634
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_shuffle_selected.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_shuffle_selected.png b/res/drawable-mdpi/ic_menu_shuffle_selected.png
new file mode 100644
index 00000000..c8c01fff
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_shuffle_selected.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_menu_shuffle_selected.png b/res/drawable-xhdpi/ic_menu_shuffle_selected.png
new file mode 100644
index 00000000..03719061
--- /dev/null
+++ b/res/drawable-xhdpi/ic_menu_shuffle_selected.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_menu_shuffle_selected.png b/res/drawable-xxhdpi/ic_menu_shuffle_selected.png
new file mode 100644
index 00000000..16cfea54
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_menu_shuffle_selected.png
Binary files differ
diff --git a/res/layout/download_media_buttons.xml b/res/layout/download_media_buttons.xml
index 1affb164..1e694662 100644
--- a/res/layout/download_media_buttons.xml
+++ b/res/layout/download_media_buttons.xml
@@ -55,8 +55,8 @@
<ImageButton
style="@style/PlaybackControl.Small"
- android:id="@+id/download_toggle_list"
- android:src="?attr/toggle_list"
+ android:id="@+id/download_shuffle"
+ android:src="?attr/shuffle"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
/>
diff --git a/res/menu/nowplaying.xml b/res/menu/nowplaying.xml
index 60255692..3f49ae19 100644
--- a/res/menu/nowplaying.xml
+++ b/res/menu/nowplaying.xml
@@ -3,18 +3,18 @@
xmlns:compat="http://schemas.android.com/apk/res-auto"
android:checkableBehavior="all">
- <item
- android:id="@+id/menu_shuffle"
- android:icon="?attr/shuffle"
- android:title="@string/download.menu_shuffle"
- compat:showAsAction="ifRoom|withText"/>
-
<item
android:id="@+id/menu_mediaroute"
compat:actionProviderClass="android.support.v7.app.MediaRouteActionProvider"
compat:actionViewClass="android.support.v7.app.MediaRouteButton"
compat:showAsAction="always"
android:title="@string/menu.cast"/>
+
+ <item
+ android:id="@+id/menu_toggle_list"
+ android:icon="?attr/toggle_list"
+ android:title="@string/download.menu_toggle"
+ compat:showAsAction="ifRoom|withText"/>
<item
android:id="@+id/menu_remove_all"
diff --git a/res/menu/nowplaying_offline.xml b/res/menu/nowplaying_offline.xml
index bba5ba00..105b375c 100644
--- a/res/menu/nowplaying_offline.xml
+++ b/res/menu/nowplaying_offline.xml
@@ -2,18 +2,18 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:compat="http://schemas.android.com/apk/res-auto">
- <item
- android:id="@+id/menu_shuffle"
- android:icon="?attr/shuffle"
- android:title="@string/download.menu_shuffle"
- compat:showAsAction="always|withText"/>
-
<item
android:id="@+id/menu_mediaroute"
compat:actionProviderClass="android.support.v7.app.MediaRouteActionProvider"
compat:actionViewClass="android.support.v7.app.MediaRouteButton"
compat:showAsAction="always"
android:title="@string/menu.cast"/>
+
+ <item
+ android:id="@+id/menu_toggle_list"
+ android:icon="?attr/toggle_list"
+ android:title="@string/download.menu_toggle"
+ compat:showAsAction="always|withText"/>
<item
android:id="@+id/menu_remove_all"
diff --git a/res/menu/select_album_context.xml b/res/menu/select_album_context.xml
index 5b2529e7..c08c6da7 100644
--- a/res/menu/select_album_context.xml
+++ b/res/menu/select_album_context.xml
@@ -11,11 +11,6 @@
android:id="@+id/album_menu_play_now"
android:title="@string/common.play_now"
/>
-
- <item
- android:id="@+id/album_menu_play_shuffled"
- android:title="@string/common.play_shuffled"
- />
<group android:id="@+id/hide_play_next">
<item
diff --git a/res/menu/select_album_context_offline.xml b/res/menu/select_album_context_offline.xml
index a1805f5b..14dbda3a 100644
--- a/res/menu/select_album_context_offline.xml
+++ b/res/menu/select_album_context_offline.xml
@@ -5,12 +5,6 @@
android:id="@+id/album_menu_play_now"
android:title="@string/common.play_now"
/>
-
- <item
- android:id="@+id/album_menu_play_shuffled"
- android:title="@string/common.play_shuffled"
- />
-
<group android:id="@+id/hide_play_next">
<item
android:id="@+id/album_menu_play_next"
diff --git a/res/menu/select_playlist_context.xml b/res/menu/select_playlist_context.xml
index 47033d9c..7e12c89f 100644
--- a/res/menu/select_playlist_context.xml
+++ b/res/menu/select_playlist_context.xml
@@ -13,11 +13,6 @@
/>
<item
- android:id="@+id/playlist_menu_play_shuffled"
- android:title="@string/common.play_shuffled"
- />
-
- <item
android:id="@+id/playlist_menu_download"
android:title="@string/common.download"
/>
diff --git a/res/menu/select_playlist_context_offline.xml b/res/menu/select_playlist_context_offline.xml
index d63aec17..830d6d0c 100644
--- a/res/menu/select_playlist_context_offline.xml
+++ b/res/menu/select_playlist_context_offline.xml
@@ -5,9 +5,4 @@
android:id="@+id/playlist_menu_play_now"
android:title="@string/common.play_now"
/>
-
- <item
- android:id="@+id/playlist_menu_play_shuffled"
- android:title="@string/common.play_shuffled"
- />
</menu> \ No newline at end of file
diff --git a/res/menu/select_song.xml b/res/menu/select_song.xml
index 07fd57a7..c1628d2e 100644
--- a/res/menu/select_song.xml
+++ b/res/menu/select_song.xml
@@ -8,12 +8,6 @@
compat:showAsAction="always|withText"/>
<item
- android:id="@+id/menu_shuffle"
- android:icon="?attr/shuffle"
- android:title="@string/menu.shuffle"
- compat:showAsAction="ifRoom|withText"/>
-
- <item
android:id="@+id/menu_download"
android:title="@string/common.download"/>
diff --git a/res/menu/select_song_offline.xml b/res/menu/select_song_offline.xml
index c45405fb..5ff42d12 100644
--- a/res/menu/select_song_offline.xml
+++ b/res/menu/select_song_offline.xml
@@ -8,12 +8,6 @@
compat:showAsAction="always|withText"/>
<item
- android:id="@+id/menu_shuffle"
- android:icon="?attr/shuffle"
- android:title="@string/menu.shuffle"
- compat:showAsAction="ifRoom|withText"/>
-
- <item
android:id="@+id/menu_delete"
android:title="@string/menu.delete_cache"/>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 33a40981..71b6e08e 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -212,6 +212,8 @@
<string name="download.downloading_summary_expanded">Current: %1$s
\nEstimated Size: %2$s</string>
<string name="download.failed_to_load">Failed to load</string>
+ <string name="download.shuffle_on">Shuffle on</string>
+ <string name="download.shuffle_off">Shuffle off</string>
<string name="sync.new_podcasts">New podcasts available</string>
<string name="sync.new_playlists">New songs in playlists</string>
diff --git a/src/github/daneren2005/dsub/fragments/NowPlayingFragment.java b/src/github/daneren2005/dsub/fragments/NowPlayingFragment.java
index b6daea98..8fef07a8 100644
--- a/src/github/daneren2005/dsub/fragments/NowPlayingFragment.java
+++ b/src/github/daneren2005/dsub/fragments/NowPlayingFragment.java
@@ -111,7 +111,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
private View stopButton;
private View startButton;
private ImageButton repeatButton;
- private View toggleListButton;
+ private ImageButton shuffleButton;
private ImageButton starButton;
private ImageButton bookmarkButton;
private ImageButton rateBadButton;
@@ -187,7 +187,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
bookmarkButton = (ImageButton) rootView.findViewById(R.id.download_bookmark);
rateBadButton = (ImageButton) rootView.findViewById(R.id.download_rating_bad);
rateGoodButton = (ImageButton) rootView.findViewById(R.id.download_rating_good);
- toggleListButton =rootView.findViewById(R.id.download_toggle_list);
+ shuffleButton = (ImageButton) rootView.findViewById(R.id.download_shuffle);
starButton = (ImageButton)rootView.findViewById(R.id.download_star);
if(Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_MENU_STAR, true)) {
@@ -350,7 +350,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
public void onClick(View view) {
RepeatMode repeatMode = getDownloadService().getRepeatMode().next();
getDownloadService().setRepeatMode(repeatMode);
- onDownloadListChanged();
+ updateButtons();
switch (repeatMode) {
case OFF:
Util.toast(context, R.string.download_repeat_off);
@@ -453,11 +453,18 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
}
});
- toggleListButton.setOnClickListener(new View.OnClickListener() {
+ shuffleButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- toggleFullscreenAlbumArt();
+ DownloadService downloadService = getDownloadService();
+ downloadService.setShuffleMode(!downloadService.isShuffleMode());
+ updateButtons();
setControlsVisible(true);
+ if(downloadService.isShuffleMode()) {
+ Util.toast(context, R.string.download_shuffle_on);
+ } else {
+ Util.toast(context, R.string.download_shuffle_off);
+ }
}
});
@@ -544,7 +551,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
if (downloadService != null && context.getIntent().getBooleanExtra(Constants.INTENT_EXTRA_NAME_SHUFFLE, false)) {
context.getIntent().removeExtra(Constants.INTENT_EXTRA_NAME_SHUFFLE);
warnIfNetworkOrStorageUnavailable();
- downloadService.setShufflePlayEnabled(true);
+ downloadService.setShuffleRemote(true);
}
if(Build.MODEL.equals("Nexus 4") || Build.MODEL.equals("GT-I9100")) {
@@ -734,7 +741,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
new SilentBackgroundTask<Void>(context) {
@Override
protected Void doInBackground() throws Throwable {
- getDownloadService().setShufflePlayEnabled(false);
+ getDownloadService().setShuffleRemote(false);
getDownloadService().clear();
return null;
}
@@ -765,19 +772,9 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
}
context.supportInvalidateOptionsMenu();
return true;
- case R.id.menu_shuffle:
- new SilentBackgroundTask<Void>(context) {
- @Override
- protected Void doInBackground() throws Throwable {
- getDownloadService().shuffle();
- return null;
- }
-
- @Override
- protected void done(Void result) {
- Util.toast(context, R.string.download_menu_shuffle_notification);
- }
- }.execute();
+ case R.id.menu_toggle_list:
+ toggleFullscreenAlbumArt();
+ setControlsVisible(true);
return true;
case R.id.menu_save_playlist:
List<Entry> entries = new LinkedList<Entry>();
@@ -949,6 +946,39 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
rateBadButton.setVisibility(View.VISIBLE);
rateGoodButton.setVisibility(View.VISIBLE);
}
+
+ DownloadService downloadService = getDownloadService();
+ if(downloadService == null) {
+ return;
+ }
+
+ switch (downloadService.getRepeatMode()) {
+ case OFF:
+ if("light".equals(SubsonicActivity.getThemeName()) | "light_fullscreen".equals(SubsonicActivity.getThemeName())) {
+ repeatButton.setImageResource(R.drawable.media_repeat_off_light);
+ } else {
+ repeatButton.setImageResource(R.drawable.media_repeat_off);
+ }
+ break;
+ case ALL:
+ repeatButton.setImageResource(R.drawable.media_repeat_all);
+ break;
+ case SINGLE:
+ repeatButton.setImageResource(R.drawable.media_repeat_single);
+ break;
+ default:
+ break;
+ }
+
+ if(downloadService.isShuffleMode()) {
+ shuffleButton.setImageResource(R.drawable.ic_menu_shuffle_selected);
+ } else {
+ if("light".equals(SubsonicActivity.getThemeName())) {
+ shuffleButton.setImageResource(R.drawable.ic_menu_shuffle_light);
+ } else {
+ shuffleButton.setImageResource(R.drawable.ic_menu_shuffle_dark);
+ }
+ }
}
// Scroll to current playing/downloading.
@@ -1113,7 +1143,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
List<DownloadFile> list;
list = downloadService.getSongs();
- if(downloadService.isShufflePlayEnabled()) {
+ if(downloadService.isShuffleRemote()) {
emptyTextView.setText(R.string.download_shuffle_loading);
}
else {
@@ -1132,24 +1162,6 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
emptyTextView.setVisibility(list.isEmpty() ? View.VISIBLE : View.GONE);
currentRevision = downloadService.getDownloadListUpdateRevision();
-
- switch (downloadService.getRepeatMode()) {
- case OFF:
- if("light".equals(SubsonicActivity.getThemeName()) | "light_fullscreen".equals(SubsonicActivity.getThemeName())) {
- repeatButton.setImageResource(R.drawable.media_repeat_off_light);
- } else {
- repeatButton.setImageResource(R.drawable.media_repeat_off);
- }
- break;
- case ALL:
- repeatButton.setImageResource(R.drawable.media_repeat_all);
- break;
- case SINGLE:
- repeatButton.setImageResource(R.drawable.media_repeat_single);
- break;
- default:
- break;
- }
if(scrollWhenLoaded) {
scrollToCurrent();
diff --git a/src/github/daneren2005/dsub/fragments/SearchFragment.java b/src/github/daneren2005/dsub/fragments/SearchFragment.java
index f73989fb..b7ef204f 100644
--- a/src/github/daneren2005/dsub/fragments/SearchFragment.java
+++ b/src/github/daneren2005/dsub/fragments/SearchFragment.java
@@ -13,7 +13,6 @@ import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.view.MenuItem;
-import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.ListAdapter;
import android.widget.ListView;
@@ -325,7 +324,7 @@ public class SearchFragment extends SubsonicFragment {
if (!append) {
downloadService.clear();
}
- downloadService.download(Arrays.asList(song), save, false, playNext, false);
+ downloadService.download(Arrays.asList(song), save, false, playNext);
if (autoplay) {
downloadService.play(downloadService.size() - 1);
}
diff --git a/src/github/daneren2005/dsub/fragments/SelectBookmarkFragment.java b/src/github/daneren2005/dsub/fragments/SelectBookmarkFragment.java
index c26429ce..46251073 100644
--- a/src/github/daneren2005/dsub/fragments/SelectBookmarkFragment.java
+++ b/src/github/daneren2005/dsub/fragments/SelectBookmarkFragment.java
@@ -18,8 +18,6 @@
*/
package github.daneren2005.dsub.fragments;
-import android.content.DialogInterface;
-import android.util.Log;
import android.view.ContextMenu;
import android.view.MenuInflater;
import android.view.MenuItem;
@@ -30,18 +28,12 @@ import github.daneren2005.dsub.R;
import github.daneren2005.dsub.activity.DownloadActivity;
import github.daneren2005.dsub.domain.Bookmark;
import github.daneren2005.dsub.domain.MusicDirectory;
-import github.daneren2005.dsub.service.DownloadFile;
import github.daneren2005.dsub.service.DownloadService;
import github.daneren2005.dsub.service.MusicService;
-import github.daneren2005.dsub.service.MusicServiceFactory;
-import github.daneren2005.dsub.service.OfflineException;
-import github.daneren2005.dsub.service.ServerTooOldException;
-import github.daneren2005.dsub.util.LoadingTask;
import github.daneren2005.dsub.util.ProgressListener;
import github.daneren2005.dsub.util.SilentBackgroundTask;
import github.daneren2005.dsub.util.Util;
import github.daneren2005.dsub.view.BookmarkAdapter;
-import github.daneren2005.dsub.view.SongView;
import java.text.Format;
import java.text.SimpleDateFormat;
@@ -114,7 +106,7 @@ public class SelectBookmarkFragment extends SelectListFragment<MusicDirectory.En
@Override
protected Void doInBackground() throws Throwable {
downloadService.clear();
- downloadService.download(Arrays.asList(bookmark), false, true, false, false, 0, bookmark.getBookmark().getPosition());
+ downloadService.download(Arrays.asList(bookmark), false, true, false, 0, bookmark.getBookmark().getPosition());
return null;
}
diff --git a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
index d441267d..4d273f6c 100644
--- a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
+++ b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
@@ -771,7 +771,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
}
private void playNow(final boolean shuffle, final boolean append, final boolean playNext) {
if(getSelectedSongs().size() > 0) {
- download(append, false, !append, playNext, shuffle);
+ download(append, false, !append, playNext);
selectAll(false, false);
}
else {
@@ -795,7 +795,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
downloadRecursively(id, false, append, !append, shuffle, false);
} else {
selectAll(true, false);
- download(append, false, !append, false, shuffle);
+ download(append, false, !append, false);
selectAll(false, false);
}
}
@@ -848,7 +848,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
return indexes;
}
- private void download(final boolean append, final boolean save, final boolean autoplay, final boolean playNext, final boolean shuffle) {
+ private void download(final boolean append, final boolean save, final boolean autoplay, final boolean playNext) {
if (getDownloadService() == null) {
return;
}
@@ -857,7 +857,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
warnIfNetworkOrStorageUnavailable();
// Conditions for using play now button
- if(!append && !save && autoplay && !playNext && !shuffle) {
+ if(!append && !save && autoplay && !playNext) {
// Call playNow which goes through and tries to use bookmark information
playNow(songs, playlistName, playlistId);
return;
@@ -870,7 +870,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
getDownloadService().clear();
}
- getDownloadService().download(songs, save, autoplay, playNext, shuffle);
+ getDownloadService().download(songs, save, autoplay, playNext);
if (playlistName != null) {
getDownloadService().setSuggestedPlaylistName(playlistName, playlistId);
} else {
diff --git a/src/github/daneren2005/dsub/fragments/SelectPlaylistFragment.java b/src/github/daneren2005/dsub/fragments/SelectPlaylistFragment.java
index caf9079f..741ed8a5 100644
--- a/src/github/daneren2005/dsub/fragments/SelectPlaylistFragment.java
+++ b/src/github/daneren2005/dsub/fragments/SelectPlaylistFragment.java
@@ -98,17 +98,6 @@ public class SelectPlaylistFragment extends SelectListFragment<Playlist> {
replaceFragment(fragment);
break;
- case R.id.playlist_menu_play_shuffled:
- fragment = new SelectDirectoryFragment();
- args = new Bundle();
- args.putString(Constants.INTENT_EXTRA_NAME_PLAYLIST_ID, playlist.getId());
- args.putString(Constants.INTENT_EXTRA_NAME_PLAYLIST_NAME, playlist.getName());
- args.putBoolean(Constants.INTENT_EXTRA_NAME_SHUFFLE, true);
- args.putBoolean(Constants.INTENT_EXTRA_NAME_AUTOPLAY, true);
- fragment.setArguments(args);
-
- replaceFragment(fragment);
- break;
case R.id.playlist_menu_delete:
deletePlaylist(playlist);
break;
diff --git a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java
index 5cab2497..1a5cd5a7 100644
--- a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java
+++ b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java
@@ -376,10 +376,6 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR
artistOverride = true;
downloadRecursively(entry.getId(), false, false, true, false, false);
break;
- case R.id.album_menu_play_shuffled:
- artistOverride = true;
- downloadRecursively(entry.getId(), false, false, true, true, false);
- break;
case R.id.album_menu_play_next:
artistOverride = true;
downloadRecursively(entry.getId(), false, true, false, false, false, true);
@@ -415,10 +411,10 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR
playNow(songs);
break;
case R.id.song_menu_play_next:
- getDownloadService().download(songs, false, false, true, false);
+ getDownloadService().download(songs, false, false, true);
break;
case R.id.song_menu_play_last:
- getDownloadService().download(songs, false, false, false, false);
+ getDownloadService().download(songs, false, false, false);
break;
case R.id.song_menu_download:
getDownloadService().downloadBackground(songs, false);
@@ -893,7 +889,7 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR
downloadService.clear();
}
if(!background) {
- downloadService.download(songs, save, autoplay, playNext, false);
+ downloadService.download(songs, save, autoplay, playNext);
if(!append) {
transition = true;
}
@@ -1557,7 +1553,7 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR
}
downloadService.clear();
- downloadService.download(entries, false, true, true, false, entries.indexOf(song), position);
+ downloadService.download(entries, false, true, true, entries.indexOf(song), position);
downloadService.setSuggestedPlaylistName(playlistName, playlistId);
return null;
diff --git a/src/github/daneren2005/dsub/service/DownloadService.java b/src/github/daneren2005/dsub/service/DownloadService.java
index 8d9f6867..69ed7c7f 100644
--- a/src/github/daneren2005/dsub/service/DownloadService.java
+++ b/src/github/daneren2005/dsub/service/DownloadService.java
@@ -53,12 +53,11 @@ import github.daneren2005.dsub.view.UpdateView;
import github.daneren2005.serverproxy.BufferProxy;
import java.io.File;
-import java.io.IOError;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.Iterator;
import java.util.List;
+import java.util.Random;
import java.util.Timer;
import java.util.TimerTask;
@@ -70,7 +69,6 @@ import android.content.SharedPreferences;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.audiofx.AudioEffect;
-import android.media.audiofx.Equalizer;
import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
@@ -231,6 +229,7 @@ public class DownloadService extends Service {
instance = this;
lifecycleSupport.onCreate();
shufflePlayBuffer = new ShufflePlayBuffer(this);
+ shuffleMode = prefs.getBoolean(Constants.PREFERENCES_KEY_SHUFFLE_MODE, false);
}
@Override
@@ -303,10 +302,10 @@ public class DownloadService extends Service {
return binder;
}
- public synchronized void download(List<MusicDirectory.Entry> songs, boolean save, boolean autoplay, boolean playNext, boolean shuffle) {
- download(songs, save, autoplay, playNext, shuffle, 0, 0);
+ public synchronized void download(List<MusicDirectory.Entry> songs, boolean save, boolean autoplay, boolean playNext) {
+ download(songs, save, autoplay, playNext, 0, 0);
}
- public synchronized void download(List<MusicDirectory.Entry> songs, boolean save, boolean autoplay, boolean playNext, boolean shuffle, int start, int position) {
+ public synchronized void download(List<MusicDirectory.Entry> songs, boolean save, boolean autoplay, boolean playNext, int start, int position) {
setShuffleRemote(false);
int offset = 1;
@@ -395,7 +394,7 @@ public class DownloadService extends Service {
removePlayed = true;
}
boolean startShufflePlay = prefs.getBoolean(Constants.PREFERENCES_KEY_SHUFFLE_REMOTE, false);
- download(songs, false, false, false, false);
+ download(songs, false, false, false);
if(startShufflePlay) {
shuffleRemote = true;
SharedPreferences.Editor editor = prefs.edit();
@@ -742,7 +741,7 @@ public class DownloadService extends Service {
// Add size condition to prevent infinite loop
do {
newIndex = random.nextInt(size());
- } while(index == newIndex && size() > 1)
+ } while(index == newIndex && size() > 1);
}
return newIndex;
diff --git a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
index 0a1e2cdd..9cd2896b 100644
--- a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
+++ b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
@@ -198,7 +198,7 @@ public class DownloadServiceLifecycleSupport {
}
editor.commit();
- downloadService.setShufflePlayEnabled(true);
+ downloadService.setShuffleRemote(true);
} else {
downloadService.start();
}
diff --git a/test/github/daneren2005/dsub/service/DownloadServiceTest.java b/test/github/daneren2005/dsub/service/DownloadServiceTest.java
index 44b77b84..7814b4ec 100644
--- a/test/github/daneren2005/dsub/service/DownloadServiceTest.java
+++ b/test/github/daneren2005/dsub/service/DownloadServiceTest.java
@@ -82,7 +82,7 @@ public class DownloadServiceTest extends
// Download two songs
downloadService.getDownloads().clear();
downloadService.download(this.createMusicSongs(2), false, false, false,
- false, 0, 0);
+ 0, 0);
Log.w("testPreviousWithPlayList", "Start waiting to downloads");
Thread.sleep(5000);
@@ -106,7 +106,7 @@ public class DownloadServiceTest extends
// Download two songs
downloadService.getDownloads().clear();
downloadService.download(this.createMusicSongs(2), false, false, false,
- false, 0, 0);
+ 0, 0);
Log.w("testPreviousWithPlayList", "Start waiting downloads");
Thread.sleep(5000);
@@ -185,7 +185,7 @@ public class DownloadServiceTest extends
// Download two songs
downloadService.getDownloads().clear();
downloadService.download(this.createMusicSongs(2), false, false, false,
- false, 0, 0);
+ 0, 0);
Log.w("testPreviousWithPlayList", "Start waiting downloads");
Thread.sleep(5000);
@@ -209,7 +209,7 @@ public class DownloadServiceTest extends
// Download one songs
downloadService.getDownloads().clear();
downloadService.download(this.createMusicSongs(1), false, true, false,
- false, 0, 0);
+ 0, 0);
Log.w("testPreviousWithPlayList", "Start waiting downloads");
Thread.sleep(5000);
@@ -242,7 +242,7 @@ public class DownloadServiceTest extends
// Launch download
downloadService.download(this.createMusicSongs(1), false, false, false,
- false, 0, 0);
+ 0, 0);
// Check number of download after
int afterDownloadAction = 0;