Avoid rebuilding BackgroundPlayerUi if already in place
This commit is contained in:
parent
3a7abecdcb
commit
2c2a595246
1 changed files with 2 additions and 1 deletions
|
|
@ -576,6 +576,7 @@ public final class Player implements PlaybackListener, Listener {
|
||||||
|
|
||||||
private void initUIsForCurrentPlayerType() {
|
private void initUIsForCurrentPlayerType() {
|
||||||
if ((UIs.get(MainPlayerUi.class).isPresent() && playerType == PlayerType.MAIN)
|
if ((UIs.get(MainPlayerUi.class).isPresent() && playerType == PlayerType.MAIN)
|
||||||
|
|| (UIs.get(BackgroundPlayerUi.class).isPresent() && playerType == PlayerType.AUDIO)
|
||||||
|| (UIs.get(PopupPlayerUi.class).isPresent() && playerType == PlayerType.POPUP)) {
|
|| (UIs.get(PopupPlayerUi.class).isPresent() && playerType == PlayerType.POPUP)) {
|
||||||
// correct UI already in place
|
// correct UI already in place
|
||||||
return;
|
return;
|
||||||
|
|
@ -603,7 +604,7 @@ public final class Player implements PlaybackListener, Listener {
|
||||||
UIs.addAndPrepare(new PopupPlayerUi(this, binding));
|
UIs.addAndPrepare(new PopupPlayerUi(this, binding));
|
||||||
break;
|
break;
|
||||||
case AUDIO:
|
case AUDIO:
|
||||||
UIs.destroyAll(VideoPlayerUi.class);
|
UIs.destroyAll(VideoPlayerUi.class); // destroys both MainPlayerUi and PopupPlayerUi
|
||||||
UIs.addAndPrepare(new BackgroundPlayerUi(this));
|
UIs.addAndPrepare(new BackgroundPlayerUi(this));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue