Skip to content

Commit

Permalink
Keep fullscreen in hamburger menu when exiting fullscreen video
Browse files Browse the repository at this point in the history
  • Loading branch information
haanhvu committed Feb 6, 2025
1 parent 9f55776 commit 9114849
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public class WindowViewModel extends AndroidViewModel {
private MediatorLiveData<ObservableBoolean> isUrlBarIconsVisible;
private MutableLiveData<ObservableInt> mWidth;
private MutableLiveData<ObservableInt> mHeight;
private MutableLiveData<ObservableBoolean> keepFullscreenInHamburgerMenu;

public WindowViewModel(Application application) {
super(application);
Expand Down Expand Up @@ -183,6 +184,7 @@ public WindowViewModel(Application application) {

mWidth = new MutableLiveData<>(new ObservableInt());
mHeight = new MutableLiveData<>(new ObservableInt());
keepFullscreenInHamburgerMenu = new MutableLiveData<>(new ObservableBoolean(false));
}

private Observer<ObservableBoolean> mIsTopBarVisibleObserver = new Observer<ObservableBoolean>() {
Expand Down Expand Up @@ -353,6 +355,7 @@ public void refresh() {
isDrmUsed.postValue(isDrmUsed.getValue());
mWidth.postValue(mWidth.getValue());
mHeight.postValue(mHeight.getValue());
keepFullscreenInHamburgerMenu.postValue(keepFullscreenInHamburgerMenu.getValue());
}

@NonNull
Expand Down Expand Up @@ -444,6 +447,14 @@ public void setIsWindowVisible(boolean isWindowVisible) {
this.isWindowVisible.postValue(new ObservableBoolean(isWindowVisible));
}

public MutableLiveData<ObservableBoolean> getKeepFullscreenInHamburgerMenu() {
return keepFullscreenInHamburgerMenu;
}

public void setKeepFullscreenInHamburgerMenu(boolean keepFullscreenInHamburgerMenu) {
this.keepFullscreenInHamburgerMenu.postValue(new ObservableBoolean(keepFullscreenInHamburgerMenu));
}

@NonNull
public MutableLiveData<Windows.WindowPlacement> getPlacement() {
return placement;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,13 @@ private void updateUI() {
if (mAttachedWindow != null) {
mAttachedWindow.setIsFullScreen(false);
}
if (mViewModel.getKeepFullscreenInHamburgerMenu().getValue().get()) {
Log.e("2dFullscreenPR", "Reached");
postDelayed(() -> {
mAttachedWindow.setIsFullScreen(true);
}, 2000);
mViewModel.setKeepFullscreenInHamburgerMenu(false);
}
if (mAudio != null) {
mAudio.playSound(AudioEngine.Sound.CLICK);
}
Expand Down Expand Up @@ -1350,6 +1357,7 @@ public void onResize() {
@Override
public void onFullScreen() {
mAttachedWindow.setIsFullScreen(true);
mViewModel.setKeepFullscreenInHamburgerMenu(true);
}

@Override
Expand Down

0 comments on commit 9114849

Please sign in to comment.