From 9c338d8ab037dc6278a1ea38df9a45c94b54e7aa Mon Sep 17 00:00:00 2001 From: Manuel Martin Date: Thu, 23 Apr 2020 00:04:31 +0200 Subject: [PATCH] Fixes full screen exit issues (#3220) --- .../ui/widgets/NavigationBarWidget.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/NavigationBarWidget.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/NavigationBarWidget.java index 91a1da4b9..c233a482f 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/NavigationBarWidget.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/NavigationBarWidget.java @@ -152,11 +152,15 @@ private void initialize(@NonNull Context aContext) { mNavigationListeners = new ArrayList<>(); - mFullScreenBackHandler = this::exitFullScreenMode; + mFullScreenBackHandler = () -> { + if (mAttachedWindow != null) { + mAttachedWindow.setIsFullScreen(false); + } + }; mVRVideoBackHandler = () -> { exitVRVideo(); - if (mViewModel.getAutoEnteredVRVideo().getValue().get()) { - exitFullScreenMode(); + if (mAttachedWindow != null) { + mAttachedWindow.setIsFullScreen(false); } }; @@ -278,7 +282,9 @@ private void updateUI() { mBinding.navigationBarFullscreen.fullScreenExitButton.setOnClickListener(view -> { view.requestFocusFromTouch(); - exitFullScreenMode(); + if (mAttachedWindow != null) { + mAttachedWindow.setIsFullScreen(false); + } if (mAudio != null) { mAudio.playSound(AudioEngine.Sound.CLICK); } @@ -601,7 +607,7 @@ private void enterFullScreenMode() { } private void exitFullScreenMode() { - if (mAttachedWindow == null || !mViewModel.getIsFullscreen().getValue().get()) { + if (mAttachedWindow == null) { return; }