diff --git a/res/values/translatable.xml b/res/values/translatable.xml
index 700caf79..1a0e0b8f 100644
--- a/res/values/translatable.xml
+++ b/res/values/translatable.xml
@@ -61,6 +61,7 @@ THE SOFTWARE.
Sort By
Search
Done
+ Remove
- 1 song playing.
@@ -155,6 +156,7 @@ THE SOFTWARE.
Controls in Library
Show the currently playing song and media controls in the library view
Default Action
+ Default Playlist Action
Miscellaneous Features
Disable Lockscreen
diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml
index d4ffb57b..6170fa06 100644
--- a/res/xml/preferences.xml
+++ b/res/xml/preferences.xml
@@ -121,6 +121,12 @@ THE SOFTWARE.
android:entries="@array/default_action_entries"
android:entryValues="@array/entry_values"
android:defaultValue="0" />
+
adapterView, View view, int position, long id)
{
@@ -149,8 +259,7 @@ public class PlaylistActivity extends Activity
if (mediaView.isRightBitmapPressed()) {
mAdapter.remove(id);
} else if (!mEditing) {
- QueryTask query = MediaUtils.buildPlaylistQuery(mPlaylistId, Song.FILLED_PLAYLIST_PROJECTION, null);
- PlaybackService.get(this).addSongs(SongTimeline.MODE_PLAY_POS_FIRST, query, position - mListView.getHeaderViewsCount());
+ performAction(mDefaultAction, position, (Long)mediaView.getTag());
}
}
}
diff --git a/src/org/kreed/vanilla/PlaylistAdapter.java b/src/org/kreed/vanilla/PlaylistAdapter.java
index 9bfaf712..9e8e625f 100644
--- a/src/org/kreed/vanilla/PlaylistAdapter.java
+++ b/src/org/kreed/vanilla/PlaylistAdapter.java
@@ -111,6 +111,7 @@ public class PlaylistAdapter extends CursorAdapter implements Handler.Callback {
{
MediaView mediaView = (MediaView)view;
mediaView.updateMedia(cursor, true);
+ mediaView.setTag(cursor.getLong(3));
mediaView.setShowBitmaps(mEditable);
}
diff --git a/src/org/kreed/vanilla/SongTimeline.java b/src/org/kreed/vanilla/SongTimeline.java
index 24202e3a..7eb4a6a1 100644
--- a/src/org/kreed/vanilla/SongTimeline.java
+++ b/src/org/kreed/vanilla/SongTimeline.java
@@ -140,6 +140,16 @@ public final class SongTimeline {
* @see SongTimeline#addSongs(int, android.database.Cursor, int, long)
*/
public static final int MODE_ENQUEUE_ID_FIRST = 5;
+ /**
+ * Like enqueue mode, but make the song at the given position play first by
+ * removing the songs before the given position in the query and appending
+ * them to the end of the queue.
+ *
+ * Pass the position in the integer argument.
+ *
+ * @see SongTimeline#addSongs(int, android.database.Cursor, int, long)
+ */
+ public static final int MODE_ENQUEUE_POS_FIRST = 6;
/**
* Disable shuffle.
@@ -558,6 +568,7 @@ public final class SongTimeline {
switch (mode) {
case MODE_ENQUEUE:
+ case MODE_ENQUEUE_POS_FIRST:
case MODE_ENQUEUE_ID_FIRST: {
int j = timeline.size();
while (--j > mCurrentPos) {
@@ -589,7 +600,7 @@ public final class SongTimeline {
timeline.add(song);
if (jumpSong == null) {
- if (mode == MODE_PLAY_POS_FIRST && j == i) {
+ if ((mode == MODE_PLAY_POS_FIRST || mode == MODE_ENQUEUE_POS_FIRST) && j == i) {
jumpSong = song;
} else if (mode == MODE_PLAY_ID_FIRST || mode == MODE_ENQUEUE_ID_FIRST) {
long id;