From 627eda88c2142c5d90b52fa4cbb0a85839007321 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Wed, 22 Oct 2014 19:47:23 -0700 Subject: #405 Remove shuffle options from everywhere except at album and top levels --- res/menu/select_album_context.xml | 5 ----- res/menu/select_album_context_offline.xml | 6 ------ res/menu/select_playlist_context.xml | 5 ----- res/menu/select_playlist_context_offline.xml | 5 ----- res/menu/select_song.xml | 6 ------ res/menu/select_song_offline.xml | 6 ------ src/github/daneren2005/dsub/fragments/SearchFragment.java | 3 +-- .../daneren2005/dsub/fragments/SelectBookmarkFragment.java | 10 +--------- .../daneren2005/dsub/fragments/SelectDirectoryFragment.java | 10 +++++----- .../daneren2005/dsub/fragments/SelectPlaylistFragment.java | 11 ----------- src/github/daneren2005/dsub/fragments/SubsonicFragment.java | 12 ++++-------- src/github/daneren2005/dsub/service/DownloadService.java | 11 ++++------- .../github/daneren2005/dsub/service/DownloadServiceTest.java | 10 +++++----- 13 files changed, 20 insertions(+), 80 deletions(-) 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" /> - - - - - - - - - \ 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 @@ -7,12 +7,6 @@ android:title="@string/menu.play" compat:showAsAction="always|withText"/> - - 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 @@ -7,12 +7,6 @@ android:title="@string/menu.play" compat:showAsAction="always|withText"/> - - 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 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 @@ -96,17 +96,6 @@ public class SelectPlaylistFragment extends SelectListFragment { args.putBoolean(Constants.INTENT_EXTRA_NAME_AUTOPLAY, true); fragment.setArguments(args); - 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: 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 2b727dfb..643b2845 100644 --- a/src/github/daneren2005/dsub/service/DownloadService.java +++ b/src/github/daneren2005/dsub/service/DownloadService.java @@ -53,10 +53,8 @@ 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; @@ -71,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; @@ -305,10 +302,10 @@ public class DownloadService extends Service { return binder; } - public synchronized void download(List songs, boolean save, boolean autoplay, boolean playNext, boolean shuffle) { - download(songs, save, autoplay, playNext, shuffle, 0, 0); + public synchronized void download(List songs, boolean save, boolean autoplay, boolean playNext) { + download(songs, save, autoplay, playNext, 0, 0); } - public synchronized void download(List songs, boolean save, boolean autoplay, boolean playNext, boolean shuffle, int start, int position) { + public synchronized void download(List songs, boolean save, boolean autoplay, boolean playNext, int start, int position) { setShuffleRemote(false); int offset = 1; @@ -397,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(); 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; -- cgit v1.2.3