Added clear playing queue menu item to now playing screen.
This commit is contained in:
parent
d7f57bb1f1
commit
1816c264a9
5 changed files with 26 additions and 3 deletions
|
|
@ -345,6 +345,14 @@ public class MusicPlayerRemote {
|
|||
return false;
|
||||
}
|
||||
|
||||
public static boolean clearQueue() {
|
||||
if (musicService != null) {
|
||||
musicService.clearQueue();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int getAudioSessionId() {
|
||||
if (musicService != null) {
|
||||
return musicService.getAudioSessionId();
|
||||
|
|
|
|||
|
|
@ -673,6 +673,14 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
|
|||
notifyChange(QUEUE_CHANGED);
|
||||
}
|
||||
|
||||
public void clearQueue() {
|
||||
playingQueue.clear();
|
||||
originalPlayingQueue.clear();
|
||||
|
||||
setPosition(-1);
|
||||
notifyChange(QUEUE_CHANGED);
|
||||
}
|
||||
|
||||
public void playSongAt(final int position) {
|
||||
// handle this on the handlers thread to avoid blocking the ui thread
|
||||
playerHandler.removeMessages(PLAY_SONG);
|
||||
|
|
|
|||
|
|
@ -63,8 +63,9 @@ public abstract class AbsPlayerFragment extends AbsMusicServiceFragment implemen
|
|||
case R.id.action_add_to_playlist:
|
||||
AddToPlaylistDialog.create(song).show(getFragmentManager(), "ADD_PLAYLIST");
|
||||
return true;
|
||||
// case R.id.action_playing_queue:
|
||||
// return true;
|
||||
case R.id.action_clear_playing_queue:
|
||||
MusicPlayerRemote.clearQueue();
|
||||
return true;
|
||||
case R.id.action_tag_editor:
|
||||
Intent intent = new Intent(getActivity(), SongTagEditorActivity.class);
|
||||
intent.putExtra(AbsTagEditorActivity.EXTRA_ID, song.id);
|
||||
|
|
@ -83,7 +84,7 @@ public abstract class AbsPlayerFragment extends AbsMusicServiceFragment implemen
|
|||
return false;
|
||||
}
|
||||
|
||||
protected void toggleFavorite(Song song){
|
||||
protected void toggleFavorite(Song song) {
|
||||
MusicUtil.toggleFavorite(getActivity(), song);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,11 @@
|
|||
android:title="@string/action_shuffle_all"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_clear_playing_queue"
|
||||
android:title="@string/action_clear_playing_queue"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_sleep_timer"
|
||||
android:title="@string/action_sleep_timer"
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@
|
|||
<string name="action_shuffle_album">Shuffle album</string>
|
||||
<string name="action_shuffle_artist">Shuffle artist</string>
|
||||
<string name="action_shuffle_playlist">Shuffle playlist</string>
|
||||
<string name="action_clear_playing_queue">Clear playing queue</string>
|
||||
<string name="last_opened">Last opened</string>
|
||||
<string name="light_theme_name">Light</string>
|
||||
<string name="dark_theme_name">Dark</string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue