From 5155b24ed673e6955ec9ab18572ffd142184bfef Mon Sep 17 00:00:00 2001 From: Stypox Date: Tue, 27 Jan 2026 23:44:20 +0100 Subject: [PATCH] Partial revert: fix VideoDetailFragment flickering This partially reverts commit 92a07a34456c5df560454a335f89ba677719c313, 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. --- .../newpipe/fragments/detail/VideoDetailFragment.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java index 9bffa149c..12920a8cb 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java @@ -1424,8 +1424,10 @@ public final class VideoDetailFragment bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED); } // Rebound to the service if it was closed via notification or mini player - playerHolder.setListener(VideoDetailFragment.this); - playerHolder.tryBindIfNeeded(context); + if (!playerHolder.isBound()) { + playerHolder.startService( + false, VideoDetailFragment.this); + } break; } }