Skip to content

Commit 6a4aaba

Browse files
committed
PlayerHolder: add some more docstrings
1 parent 83d93e1 commit 6a4aaba

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

app/src/main/java/org/schabi/newpipe/player/helper/PlayerHolder.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
import org.schabi.newpipe.player.event.PlayerServiceExtendedEventListener;
2424
import org.schabi.newpipe.player.playqueue.PlayQueue;
2525

26+
/** Singleton that manages a `PlayerService`
27+
* and can be used to control the player instance through the service. */
2628
public final class PlayerHolder {
2729

2830
private PlayerHolder() {
@@ -162,7 +164,11 @@ public void stopService() {
162164
context.stopService(new Intent(context, PlayerService.class));
163165
}
164166

165-
167+
/** Call {@link Context#unbindService(ServiceConnection)} on our service
168+
* (does not necesarily stop the service right away).
169+
* Remove all our listeners and deinitialize them.
170+
* @param context shared context
171+
* */
166172
private void unbind(final Context context) {
167173
if (DEBUG) {
168174
Log.d(TAG, "unbind() called");
@@ -215,6 +221,10 @@ public void onServiceConnected(final ComponentName compName, final IBinder servi
215221
}
216222
}
217223

224+
/** Delegate all {@link PlayerServiceEventListener} events to our current `listener` object.
225+
* Only difference is that if {@link PlayerServiceEventListener#onServiceStopped()} is called,
226+
* it also calls {@link PlayerHolder#unbind(Context)}.
227+
* */
218228
private final PlayerServiceEventListener internalListener =
219229
new PlayerServiceEventListener() {
220230
@Override

0 commit comments

Comments
 (0)