From 6a4aaba4310c8fd72c9491b7c972efc2077852d4 Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Thu, 26 Dec 2024 01:02:59 +0100 Subject: [PATCH] PlayerHolder: add some more docstrings --- .../schabi/newpipe/player/helper/PlayerHolder.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHolder.java b/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHolder.java index d4da8ea45..92ef16d0c 100644 --- a/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHolder.java +++ b/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHolder.java @@ -23,6 +23,8 @@ import org.schabi.newpipe.player.event.PlayerServiceEventListener; import org.schabi.newpipe.player.event.PlayerServiceExtendedEventListener; import org.schabi.newpipe.player.playqueue.PlayQueue; +/** Singleton that manages a `PlayerService` + * and can be used to control the player instance through the service. */ public final class PlayerHolder { private PlayerHolder() { @@ -162,7 +164,11 @@ public final class PlayerHolder { context.stopService(new Intent(context, PlayerService.class)); } - + /** Call {@link Context#unbindService(ServiceConnection)} on our service + * (does not necesarily stop the service right away). + * Remove all our listeners and deinitialize them. + * @param context shared context + * */ private void unbind(final Context context) { if (DEBUG) { Log.d(TAG, "unbind() called"); @@ -215,6 +221,10 @@ public final class PlayerHolder { } } + /** Delegate all {@link PlayerServiceEventListener} events to our current `listener` object. + * Only difference is that if {@link PlayerServiceEventListener#onServiceStopped()} is called, + * it also calls {@link PlayerHolder#unbind(Context)}. + * */ private final PlayerServiceEventListener internalListener = new PlayerServiceEventListener() { @Override