1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2025-01-08 16:30:34 +00:00

PlayerHolder: add some more docstrings

This commit is contained in:
Profpatsch 2024-12-26 01:02:59 +01:00
parent 83d93e16e7
commit 6a4aaba431

View File

@ -23,6 +23,8 @@ import org.schabi.newpipe.player.event.PlayerServiceEventListener;
import org.schabi.newpipe.player.event.PlayerServiceExtendedEventListener; import org.schabi.newpipe.player.event.PlayerServiceExtendedEventListener;
import org.schabi.newpipe.player.playqueue.PlayQueue; 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 { public final class PlayerHolder {
private PlayerHolder() { private PlayerHolder() {
@ -162,7 +164,11 @@ public final class PlayerHolder {
context.stopService(new Intent(context, PlayerService.class)); 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) { private void unbind(final Context context) {
if (DEBUG) { if (DEBUG) {
Log.d(TAG, "unbind() called"); 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 = private final PlayerServiceEventListener internalListener =
new PlayerServiceEventListener() { new PlayerServiceEventListener() {
@Override @Override