Commit ec3a0610 authored by Jens's avatar Jens Committed by Geoffrey Métais

Add: 'Insert next'.

Signed-off-by: default avatarGeoffrey Métais <geoffrey.metais@gmail.com>
parent 729243e7
......@@ -7,6 +7,9 @@
<item
android:id="@+id/audio_list_browser_append"
android:title="@string/append" />
<item
android:id="@+id/audio_list_browser_insert_next"
android:title="@string/insert_next" />
<group android:id="@+id/songs_view_only">
<item
android:id="@+id/audio_list_browser_play_all"
......@@ -27,4 +30,4 @@
android:title="@string/set_song"/>
</group>
</menu>
\ No newline at end of file
</menu>
......@@ -24,6 +24,7 @@
<string name="play_as_audio_background">Videos im Hintergrund abspielen</string>
<string name="play_as_audio_background_summary">Video-Wiedergabe im Hintergund fortsetzen, wenn der Gerätebildschirm ausgeschaltet oder der HOME-Button gedrückt wurde.</string>
<string name="append">Anhängen</string>
<string name="insert_next">Einfügen als Nächstes</string>
<string name="play_all">Alle wiedergeben</string>
<string name="append_all">Alle anhängen</string>
<string name="last_playlist">Letzte Wiedergabeliste</string>
......
......@@ -28,6 +28,7 @@
<string name="play_as_audio_background">Play videos in background</string>
<string name="play_as_audio_background_summary">Continue video playback in background when turning device screen off or clicking HOME button.</string>
<string name="append">Append</string>
<string name="insert_next">Insert next</string>
<string name="play_all">Play all</string>
<string name="append_all">Append all</string>
<string name="last_playlist">Last playlist</string>
......
......@@ -2078,6 +2078,39 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
append(arrayList);
}
/**
* Insert into the current existing playlist
*/
@MainThread
public void insertNext(MediaWrapper[] mediaList) {
insertNext(Arrays.asList(mediaList));
}
@MainThread
public void insertNext(List<MediaWrapper> mediaList) {
if (!hasCurrentMedia()) {
load(mediaList, 0);
return;
}
int startIndex = mCurrentIndex + 1;
for (int i = 0; i < mediaList.size(); i++) {
MediaWrapper mediaWrapper = mediaList.get(i);
mMediaList.insert(startIndex + i, mediaWrapper);
}
onMediaListChanged();
updateMediaQueue();
}
@MainThread
public void insertNext(MediaWrapper media) {
ArrayList<MediaWrapper> arrayList = new ArrayList<>();
arrayList.add(media);
insertNext(arrayList);
}
/**
* Move an item inside the playlist.
*/
......
......@@ -315,6 +315,9 @@ public class PlaylistActivity extends AudioPlayerContainerActivity implements IE
} else if (id == R.id.audio_list_browser_append) {
mService.append(media);
return true;
} else if (id == R.id.audio_list_browser_insert_next) {
mService.insertNext(media);
return true;
} else if (id == R.id.audio_list_browser_delete) {
mAdapter.remove(media);
UiTools.snackerWithCancel(getWindow().getDecorView(), getString(R.string.file_deleted), new Runnable() {
......
......@@ -200,6 +200,7 @@ public class AudioAlbumsSongsFragment extends BaseAudioBrowser implements SwipeR
boolean useAllItems = id == R.id.audio_list_browser_play_all;
boolean append = id == R.id.audio_list_browser_append;
boolean insert_next = id == R.id.audio_list_browser_insert_next;
if (id == R.id.audio_list_browser_delete) {
......@@ -254,6 +255,8 @@ public class AudioAlbumsSongsFragment extends BaseAudioBrowser implements SwipeR
if (mService != null) {
if (append)
mService.append(medias);
else if (insert_next)
mService.insertNext(medias);
else
mService.load(medias, startPosition);
return true;
......
......@@ -350,6 +350,7 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements DevicesDis
boolean useAllItems = id == R.id.audio_list_browser_play_all;
boolean append = id == R.id.audio_list_browser_append;
boolean insert_next = id == R.id.audio_list_browser_insert_next;
// Play/Append
if (useAllItems) {
......@@ -368,6 +369,8 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements DevicesDis
if (mService != null) {
if (append)
mService.append(medias);
else if (insert_next)
mService.insertNext(medias);
else
mService.load(medias, startPosition);
return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment