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