Skip to content

Commit 5155b24

Browse files
committed
Partial revert: fix VideoDetailFragment flickering
This partially reverts commit 92a07a3, which was needed to fix ghost notifications. There I broke the "cycle" causing the useless notifications to popup in 2 different places (see points 3 and 4 of the commit description). However, breaking the cycle in point 4 ("`PlayerHolder::tryBindIfNeeded()` is now used to passively try to bind, instead of `PlayerHolder::startService()`" was not correct, for the following reason. I assumed that `ACTION_PLAYER_STARTED` was used for notifying that the player was instantiated anew, while it actually is used to notify that something is now ready for use: it could be the player, but it could also just be that the bottom sheet view was just added and thus the VideoDetailFragment needs to start the player. Therefore, when handling `ACTION_PLAYER_STARTED` it is correct to start the player service and not just try to bind to it. The other point in which I broke the cycle (point 3) should still prevent ghost notifications, although I could not test.
1 parent d7dffb7 commit 5155b24

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,8 +1424,10 @@ public void onReceive(final Context context, final Intent intent) {
14241424
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
14251425
}
14261426
// Rebound to the service if it was closed via notification or mini player
1427-
playerHolder.setListener(VideoDetailFragment.this);
1428-
playerHolder.tryBindIfNeeded(context);
1427+
if (!playerHolder.isBound()) {
1428+
playerHolder.startService(
1429+
false, VideoDetailFragment.this);
1430+
}
14291431
break;
14301432
}
14311433
}

0 commit comments

Comments
 (0)