Skip to content

Commit 7908456

Browse files
committed
Fix fullscreen eliciting "clear queue" prompt
1 parent 2dd11f7 commit 7908456

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@ class PlayerServiceConnection implements ServiceConnection {
159159

160160
private boolean playAfterConnect = false;
161161

162+
/**
163+
* @param playAfterConnection Sets the value of `playAfterConnect` to pass to the {@link
164+
* PlayerServiceExtendedEventListener#onPlayerConnected(Player, boolean)} the next time it
165+
* is called. The value of `playAfterConnect` will be reset to false after that.
166+
*/
162167
public void doPlayAfterConnect(final boolean playAfterConnection) {
163168
this.playAfterConnect = playAfterConnection;
164169
}
@@ -183,7 +188,6 @@ public void onServiceConnected(final ComponentName compName, final IBinder servi
183188
playerService = localBinder.getService();
184189
if (listener != null) {
185190
listener.onServiceConnected(playerService);
186-
getPlayer().ifPresent(p -> listener.onPlayerConnected(p, playAfterConnect));
187191
}
188192
startPlayerListener();
189193
// ^ will call listener.onPlayerConnected() down the line if there is an active player
@@ -357,6 +361,8 @@ public void onServiceStopped() {
357361
listener.onPlayerDisconnected();
358362
} else {
359363
listener.onPlayerConnected(player, serviceConnection.playAfterConnect);
364+
// reset the value of playAfterConnect: if it was true before, it is now "consumed"
365+
serviceConnection.playAfterConnect = false;
360366
player.setFragmentListener(internalListener);
361367
}
362368
}

0 commit comments

Comments
 (0)