Skip to content

Commit 60615e6

Browse files
Fix compile errors
1 parent 35315d0 commit 60615e6

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

app/src/main/java/org/schabi/newpipe/player/Player.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -570,9 +570,9 @@ private static PlayQueue getPlayQueueFromCache(@NonNull final Intent intent) {
570570
}
571571

572572
private void initUIsForCurrentPlayerType() {
573-
if ((UIs.get(MainPlayerUi.class).isPresent() && playerType == PlayerType.MAIN)
574-
|| (UIs.get(BackgroundPlayerUi.class).isPresent() && playerType == PlayerType.AUDIO)
575-
|| (UIs.get(PopupPlayerUi.class).isPresent() && playerType == PlayerType.POPUP)) {
573+
if ((UIs.get(MainPlayerUi.class) != null && playerType == PlayerType.MAIN)
574+
|| (UIs.get(BackgroundPlayerUi.class) != null && playerType == PlayerType.AUDIO)
575+
|| (UIs.get(PopupPlayerUi.class) != null && playerType == PlayerType.POPUP)) {
576576
// correct UI already in place
577577
return;
578578
}
@@ -590,17 +590,18 @@ private void initUIsForCurrentPlayerType() {
590590

591591
switch (playerType) {
592592
case MAIN:
593-
UIs.destroyAll(PopupPlayerUi.class);
594-
UIs.destroyAll(BackgroundPlayerUi.class);
593+
UIs.destroyAllOfType(PopupPlayerUi.class);
594+
UIs.destroyAllOfType(BackgroundPlayerUi.class);
595595
UIs.addAndPrepare(new MainPlayerUi(this, binding));
596596
break;
597597
case POPUP:
598-
UIs.destroyAll(MainPlayerUi.class);
599-
UIs.destroyAll(BackgroundPlayerUi.class);
598+
UIs.destroyAllOfType(MainPlayerUi.class);
599+
UIs.destroyAllOfType(BackgroundPlayerUi.class);
600600
UIs.addAndPrepare(new PopupPlayerUi(this, binding));
601601
break;
602602
case AUDIO:
603-
UIs.destroyAll(VideoPlayerUi.class); // destroys both MainPlayerUi and PopupPlayerUi
603+
// destroys both MainPlayerUi and PopupPlayerUi
604+
UIs.destroyAllOfType(VideoPlayerUi.class);
604605
UIs.addAndPrepare(new BackgroundPlayerUi(this));
605606
break;
606607
}

0 commit comments

Comments
 (0)