Update notification when play queue is edited

This commit is contained in:
Stypox 2020-09-09 20:30:57 +02:00
parent a13e6b69e3
commit 1605e50cef
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
3 changed files with 24 additions and 9 deletions

View File

@ -642,6 +642,12 @@ public class VideoPlayerImpl extends VideoPlayer
duration);
}
@Override
public void onPlayQueueEdited() {
updatePlayback();
NotificationUtil.getInstance().createNotificationIfNeededAndUpdate(this, false);
}
@Override
@Nullable
public MediaSource sourceOf(final PlayQueueItem item, final StreamInfo info) {

View File

@ -255,21 +255,21 @@ public class MediaSourceManager {
// Loading and Syncing
switch (event.type()) {
case INIT:
case REORDER:
case ERROR:
case SELECT:
case INIT: case REORDER: case ERROR: case SELECT:
loadImmediate(); // low frequency, critical events
break;
case APPEND:
case REMOVE:
case MOVE:
case RECOVERY:
case APPEND: case REMOVE: case MOVE: case RECOVERY:
default:
loadDebounced(); // high frequency or noncritical events
break;
}
// update ui and notification
switch (event.type()) {
case APPEND: case REMOVE: case MOVE: case REORDER:
playbackListener.onPlayQueueEdited();
}
if (!isPlayQueueReady()) {
maybeBlock();
playQueue.fetch();

View File

@ -69,7 +69,7 @@ public interface PlaybackListener {
MediaSource sourceOf(PlayQueueItem item, StreamInfo info);
/**
* Called when the play queue can no longer to played or used.
* Called when the play queue can no longer be played or used.
* Currently, this means the play queue is empty and complete.
* Signals to the listener that it should shutdown.
* <p>
@ -77,4 +77,13 @@ public interface PlaybackListener {
* </p>
*/
void onPlaybackShutdown();
/**
* Called whenever the play queue was edited (items were added, deleted or moved),
* use this to e.g. update notification buttons or fragment ui.
* <p>
* May be called at any time.
* </p>
*/
void onPlayQueueEdited();
}