From 8b400b48f7ad5ecfa7762854b55a06aa5c828dd0 Mon Sep 17 00:00:00 2001 From: Isira Seneviratne Date: Wed, 20 Jul 2022 04:36:54 +0530 Subject: [PATCH] Refactor notifying method in PlayQueue. --- .../newpipe/player/playqueue/AbstractInfoPlayQueue.java | 4 ++-- .../org/schabi/newpipe/player/playqueue/PlayQueue.java | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/playqueue/AbstractInfoPlayQueue.java b/app/src/main/java/org/schabi/newpipe/player/playqueue/AbstractInfoPlayQueue.java index df2747c3b..e51ee4720 100644 --- a/app/src/main/java/org/schabi/newpipe/player/playqueue/AbstractInfoPlayQueue.java +++ b/app/src/main/java/org/schabi/newpipe/player/playqueue/AbstractInfoPlayQueue.java @@ -82,7 +82,7 @@ abstract class AbstractInfoPlayQueue> public void onError(@NonNull final Throwable e) { Log.e(getTag(), "Error fetching more playlist, marking playlist as complete.", e); isComplete = true; - append(); // Notify change + notifyChange(); } }; } @@ -117,7 +117,7 @@ abstract class AbstractInfoPlayQueue> public void onError(@NonNull final Throwable e) { Log.e(getTag(), "Error fetching more playlist, marking playlist as complete.", e); isComplete = true; - append(); // Notify change + notifyChange(); } }; } diff --git a/app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueue.java b/app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueue.java index d54fed248..edf5a771c 100644 --- a/app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueue.java +++ b/app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueue.java @@ -257,13 +257,10 @@ public abstract class PlayQueue implements Serializable { } /** - * Appends the given {@link PlayQueueItem}s to the current play queue. - * - * @see #append(List items) - * @param items {@link PlayQueueItem}s to append + * Notifies that a change has occurred. */ - public synchronized void append(@NonNull final PlayQueueItem... items) { - append(List.of(items)); + public synchronized void notifyChange() { + broadcast(new AppendEvent(0)); } /**