aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-04-14 18:24:35 -0700
committerScott Jackson <daneren2005@gmail.com>2014-04-14 18:24:35 -0700
commit7c29438f0ab44d1d7bad478334635758b93b0d3c (patch)
tree57e8c8a863d45fda9bdcbc7ffa190a8dfa00ee46 /src
parentfc20c13e81a7194c372a9f3bc598840776bcbbf3 (diff)
downloaddsub-7c29438f0ab44d1d7bad478334635758b93b0d3c.tar.gz
dsub-7c29438f0ab44d1d7bad478334635758b93b0d3c.tar.bz2
dsub-7c29438f0ab44d1d7bad478334635758b93b0d3c.zip
#310 Add option to have play now play everything after that spot
Diffstat (limited to 'src')
-rw-r--r--src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java16
-rw-r--r--src/github/daneren2005/dsub/util/Constants.java1
2 files changed, 17 insertions, 0 deletions
diff --git a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
index edfff31e..c8937ea7 100644
--- a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
+++ b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
@@ -20,11 +20,13 @@ import android.widget.ListView;
import android.widget.TextView;
import github.daneren2005.dsub.R;
import github.daneren2005.dsub.domain.MusicDirectory;
+import github.daneren2005.dsub.domain.MusicFolder;
import github.daneren2005.dsub.domain.Share;
import github.daneren2005.dsub.util.ImageLoader;
import github.daneren2005.dsub.view.EntryAdapter;
import java.io.Serializable;
+import java.util.Iterator;
import java.util.List;
import com.mobeta.android.dslv.*;
import github.daneren2005.dsub.activity.DownloadActivity;
@@ -297,6 +299,20 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuItem.getMenuInfo();
Object selectedItem = entries.get(showHeader ? (info.position - 1) : info.position);
+
+ if(Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_PLAY_NOW_AFTER, false) && menuItem.getItemId() == R.id.song_menu_play_now) {
+ List<MusicDirectory.Entry> songs = new ArrayList<MusicDirectory.Entry>();
+ Iterator it = entries.listIterator(info.position - 1);
+ while(it.hasNext()) {
+ songs.add((MusicDirectory.Entry) it.next());
+ }
+
+ getDownloadService().clear();
+ getDownloadService().download(songs, false, true, true, false);
+ Util.startActivityWithoutTransition(context, DownloadActivity.class);
+
+ return true;
+ }
if(onContextItemSelected(menuItem, selectedItem)) {
return true;
diff --git a/src/github/daneren2005/dsub/util/Constants.java b/src/github/daneren2005/dsub/util/Constants.java
index 0eef1c94..874579a5 100644
--- a/src/github/daneren2005/dsub/util/Constants.java
+++ b/src/github/daneren2005/dsub/util/Constants.java
@@ -138,6 +138,7 @@ public final class Constants {
public static final String PREFERENCES_KEY_BROWSE_TAGS = "browseTags";
public static final String PREFERENCES_KEY_OPEN_TO_LIBRARY = "openToLibrary";
public static final String PREFERENCES_KEY_OVERRIDE_SYSTEM_LANGUAGE = "overrideSystemLanguage";
+ public static final String PREFERENCES_KEY_PLAY_NOW_AFTER = "playNowAfter";
public static final String OFFLINE_SCROBBLE_COUNT = "scrobbleCount";
public static final String OFFLINE_SCROBBLE_ID = "scrobbleID";