File tree Expand file tree Collapse file tree
app/src/main/java/org/schabi/newpipe Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -352,7 +352,7 @@ protected void showStreamDialog(final StreamInfoItem item) {
352352 }
353353 final List <StreamDialogEntry > entries = new ArrayList <>();
354354
355- if (PlayerHolder .getInstance ().isPlayerOpen ()) {
355+ if (PlayerHolder .getInstance ().isPlayQueueReady ()) {
356356 entries .add (StreamDialogEntry .enqueue );
357357
358358 if (PlayerHolder .getInstance ().getQueueSize () > 1 ) {
Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ protected void showStreamDialog(final StreamInfoItem item) {
149149
150150 final ArrayList <StreamDialogEntry > entries = new ArrayList <>();
151151
152- if (PlayerHolder .getInstance ().isPlayerOpen ()) {
152+ if (PlayerHolder .getInstance ().isPlayQueueReady ()) {
153153 entries .add (StreamDialogEntry .enqueue );
154154
155155 if (PlayerHolder .getInstance ().getQueueSize () > 1 ) {
Original file line number Diff line number Diff line change @@ -362,7 +362,7 @@ class FeedFragment : BaseStateFragment<FeedState>() {
362362 if (context == null || context.resources == null || activity == null ) return
363363
364364 val entries = ArrayList <StreamDialogEntry >()
365- if (PlayerHolder .getInstance().isPlayerOpen ) {
365+ if (PlayerHolder .getInstance().isPlayQueueReady ) {
366366 entries.add(StreamDialogEntry .enqueue)
367367
368368 if (PlayerHolder .getInstance().queueSize > 1 ) {
Original file line number Diff line number Diff line change @@ -338,7 +338,7 @@ private void showStreamDialog(final StreamStatisticsEntry item) {
338338
339339 final ArrayList <StreamDialogEntry > entries = new ArrayList <>();
340340
341- if (PlayerHolder .getInstance ().isPlayerOpen ()) {
341+ if (PlayerHolder .getInstance ().isPlayQueueReady ()) {
342342 entries .add (StreamDialogEntry .enqueue );
343343
344344 if (PlayerHolder .getInstance ().getQueueSize () > 1 ) {
Original file line number Diff line number Diff line change @@ -753,7 +753,7 @@ protected void showStreamItemDialog(final PlaylistStreamEntry item) {
753753
754754 final ArrayList <StreamDialogEntry > entries = new ArrayList <>();
755755
756- if (PlayerHolder .getInstance ().isPlayerOpen ()) {
756+ if (PlayerHolder .getInstance ().isPlayQueueReady ()) {
757757 entries .add (StreamDialogEntry .enqueue );
758758
759759 if (PlayerHolder .getInstance ().getQueueSize () > 1 ) {
Original file line number Diff line number Diff line change @@ -70,6 +70,15 @@ public boolean isPlayerOpen() {
7070 return player != null ;
7171 }
7272
73+ /**
74+ * Use this method to only allow the user to manipulate the play queue (e.g. by enqueueing via
75+ * the stream long press menu) when there actually is a play queue to manipulate.
76+ * @return true only if the player is open and its play queue is ready (i.e. it is not null)
77+ */
78+ public boolean isPlayQueueReady () {
79+ return player != null && player .getPlayQueue () != null ;
80+ }
81+
7382 public boolean isBound () {
7483 return bound ;
7584 }
You can’t perform that action at this time.
0 commit comments