Fix issue 148

Commit 7d21710015b7e4211e2b16b29824846b07115ac3 broke the play or enqueue short-tab option.
This commit should fix the issue and also adds 'play as next' as an default option for the short-press
This commit is contained in:
Adrian Ulrich 2015-03-24 22:38:02 +01:00
parent 88df9776c7
commit 7fabf739d6
2 changed files with 16 additions and 2 deletions

View File

@ -35,6 +35,7 @@ THE SOFTWARE.
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</item>
</string-array>
<string-array name="swipe_action_values">
<!-- This must match the order of swipe_action_entries exactly and
@ -90,6 +91,7 @@ THE SOFTWARE.
<item>@string/do_nothing</item>
<item>@string/expand</item>
<item>@string/play_or_enqueue</item>
<item>@string/enqueue_as_next</item>
</string-array>
<string-array name="notification_mode_entries">
<item>@string/never_show</item>

View File

@ -74,6 +74,12 @@ public class LibraryActivity
, DialogInterface.OnClickListener
, DialogInterface.OnDismissListener
{
/**
* NOTE: ACTION_* must be in sync with default_action_entries
*/
/**
* Action for row click: play the row.
*/
@ -104,17 +110,21 @@ public class LibraryActivity
* Action for row click: expand the row.
*/
public static final int ACTION_EXPAND = 6;
/**
* Action for row click: play if paused or enqueue if playing.
*/
public static final int ACTION_PLAY_OR_ENQUEUE = 7;
/**
* Action for row click: queue selection as next item
*/
public static final int ACTION_ENQUEUE_AS_NEXT = 7;
public static final int ACTION_ENQUEUE_AS_NEXT = 8;
/**
* The SongTimeline add song modes corresponding to each relevant action.
*/
private static final int[] modeForAction =
{ SongTimeline.MODE_PLAY, SongTimeline.MODE_ENQUEUE, -1,
SongTimeline.MODE_PLAY_ID_FIRST, SongTimeline.MODE_ENQUEUE_ID_FIRST,
-1, -1, SongTimeline.MODE_ENQUEUE_AS_NEXT };
-1, -1, -1, SongTimeline.MODE_ENQUEUE_AS_NEXT };
private static final String SEARCH_BOX_VISIBLE = "search_box_visible";
@ -472,6 +482,8 @@ public class LibraryActivity
// default to playing when trying to expand something that can't
// be expanded
action = ACTION_PLAY;
} else if (action == ACTION_PLAY_OR_ENQUEUE) {
action = (mState & PlaybackService.FLAG_PLAYING) == 0 ? ACTION_PLAY : ACTION_ENQUEUE;
}
pickSongs(rowData, action);
}