Update notification when play queue is edited
This commit is contained in:
parent
a13e6b69e3
commit
1605e50cef
3 changed files with 24 additions and 9 deletions
|
@ -642,6 +642,12 @@ public class VideoPlayerImpl extends VideoPlayer
|
||||||
duration);
|
duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPlayQueueEdited() {
|
||||||
|
updatePlayback();
|
||||||
|
NotificationUtil.getInstance().createNotificationIfNeededAndUpdate(this, false);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public MediaSource sourceOf(final PlayQueueItem item, final StreamInfo info) {
|
public MediaSource sourceOf(final PlayQueueItem item, final StreamInfo info) {
|
||||||
|
|
|
@ -255,21 +255,21 @@ public class MediaSourceManager {
|
||||||
|
|
||||||
// Loading and Syncing
|
// Loading and Syncing
|
||||||
switch (event.type()) {
|
switch (event.type()) {
|
||||||
case INIT:
|
case INIT: case REORDER: case ERROR: case SELECT:
|
||||||
case REORDER:
|
|
||||||
case ERROR:
|
|
||||||
case SELECT:
|
|
||||||
loadImmediate(); // low frequency, critical events
|
loadImmediate(); // low frequency, critical events
|
||||||
break;
|
break;
|
||||||
case APPEND:
|
case APPEND: case REMOVE: case MOVE: case RECOVERY:
|
||||||
case REMOVE:
|
|
||||||
case MOVE:
|
|
||||||
case RECOVERY:
|
|
||||||
default:
|
default:
|
||||||
loadDebounced(); // high frequency or noncritical events
|
loadDebounced(); // high frequency or noncritical events
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update ui and notification
|
||||||
|
switch (event.type()) {
|
||||||
|
case APPEND: case REMOVE: case MOVE: case REORDER:
|
||||||
|
playbackListener.onPlayQueueEdited();
|
||||||
|
}
|
||||||
|
|
||||||
if (!isPlayQueueReady()) {
|
if (!isPlayQueueReady()) {
|
||||||
maybeBlock();
|
maybeBlock();
|
||||||
playQueue.fetch();
|
playQueue.fetch();
|
||||||
|
|
|
@ -69,7 +69,7 @@ public interface PlaybackListener {
|
||||||
MediaSource sourceOf(PlayQueueItem item, StreamInfo info);
|
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.
|
* Currently, this means the play queue is empty and complete.
|
||||||
* Signals to the listener that it should shutdown.
|
* Signals to the listener that it should shutdown.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -77,4 +77,13 @@ public interface PlaybackListener {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
void onPlaybackShutdown();
|
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();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue