Add swipe action to clear queue
This commit is contained in:
parent
8172618a09
commit
a3aa6b4d6e
@ -53,6 +53,7 @@ THE SOFTWARE.
|
||||
<item>Enqueue Current Album</item>
|
||||
<item>Enqueue Current Artist</item>
|
||||
<item>Enqueue Current Genre</item>
|
||||
<item>Clear Queue</item>
|
||||
</string-array>
|
||||
<string-array name="entry_values">
|
||||
<!-- Note: even if this was an integer-array, these would be converted
|
||||
@ -68,5 +69,6 @@ THE SOFTWARE.
|
||||
<item>7</item>
|
||||
<item>8</item>
|
||||
<item>9</item>
|
||||
<item>10</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
|
@ -42,6 +42,7 @@ THE SOFTWARE.
|
||||
<item quantity="one">1 song enqueued.</item>
|
||||
<item quantity="other">%d songs enqueued.</item>
|
||||
</plurals>
|
||||
<string name="queue_cleared">Queue cleared.</string>
|
||||
|
||||
<!-- Widgets -->
|
||||
<string name="starting">Starting up...</string>
|
||||
|
@ -49,6 +49,7 @@ public class PlaybackActivity extends Activity implements Handler.Callback, View
|
||||
public static final int ACTION_ENQUEUE_ALBUM = 7;
|
||||
public static final int ACTION_ENQUEUE_ARTIST = 8;
|
||||
public static final int ACTION_ENQUEUE_GENRE = 9;
|
||||
public static final int ACTION_CLEAR_QUEUE = 10;
|
||||
|
||||
public static int mUpAction;
|
||||
public static int mDownAction;
|
||||
@ -402,6 +403,10 @@ public class PlaybackActivity extends Activity implements Handler.Callback, View
|
||||
case ACTION_ENQUEUE_GENRE:
|
||||
enqueue(MediaUtils.TYPE_GENRE);
|
||||
break;
|
||||
case ACTION_CLEAR_QUEUE:
|
||||
ContextApplication.getService().clearQueue();
|
||||
Toast.makeText(this, R.string.queue_cleared, Toast.LENGTH_SHORT).show();
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Invalid action: " + action);
|
||||
}
|
||||
|
@ -1041,6 +1041,14 @@ public final class PlaybackService extends Service implements Handler.Callback,
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the song queue.
|
||||
*/
|
||||
public void clearQueue()
|
||||
{
|
||||
mTimeline.clearQueue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the position at which songs are enqueued. That is, the next song
|
||||
* enqueued will be placed directly after the playing song.
|
||||
|
@ -439,6 +439,19 @@ public final class SongTimeline {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the song queue.
|
||||
*/
|
||||
public void clearQueue()
|
||||
{
|
||||
synchronized (this) {
|
||||
mSongs.subList(mCurrentPos + 1, mSongs.size()).clear();
|
||||
mQueueOffset = 0;
|
||||
}
|
||||
|
||||
mCallback.songReplaced(+1, getSong(+1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the song with the given id from the timeline.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user