From 7d1c67b2e5ba95c220666aa7f1385a1af1fe5676 Mon Sep 17 00:00:00 2001 From: Manuel Martin Date: Mon, 20 Apr 2020 20:52:27 +0200 Subject: [PATCH] Fixes #2861 Fix panels being closed on pause (#3198) * Fixes NullPointerException * Fix library restore issues --- .../shared/org/mozilla/vrbrowser/VRBrowserActivity.java | 3 --- .../vrbrowser/ui/views/VectorClippedEventDelegate.java | 2 +- .../org/mozilla/vrbrowser/ui/widgets/NavigationBarWidget.java | 4 +++- app/src/main/res/layout/navigation_bar_fullscreen.xml | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java b/app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java index bd1e402b6..6eca53e98 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java @@ -437,9 +437,6 @@ protected void onPause() { // Also prevents a deadlock in onDestroy when the BrowserWidget is released. exitImmersiveSync(); } - // If we are in fullscreen or immersive VR video, we need to consume their back handlers - // before pausing to prevent the windows from getting stuck in fullscreen mode. - flushBackHandlers(); mAudioEngine.pauseEngine(); diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/views/VectorClippedEventDelegate.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/views/VectorClippedEventDelegate.java index dcf8777c1..bcb1e3bcd 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/views/VectorClippedEventDelegate.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/views/VectorClippedEventDelegate.java @@ -138,7 +138,7 @@ public boolean onTouch(View v, MotionEvent event) { } public boolean isInside(MotionEvent event) { - return mRegion.contains((int)event.getX(),(int) event.getY()); + return event != null && mRegion != null && mRegion.contains((int)event.getX(),(int) event.getY()); } } 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 bd86b6442..c0bf94961 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 @@ -401,6 +401,8 @@ public void onConfigurationChanged(Configuration newConfig) { public void onPause() { super.onPause(); mBinding.navigationBarNavigation.urlBar.onPause(); + exitFullScreenMode(); + exitVRVideo(); } @Override @@ -601,7 +603,7 @@ private void enterFullScreenMode() { } private void exitFullScreenMode() { - if (mAttachedWindow == null) { + if (mAttachedWindow == null || !mViewModel.getIsFullscreen().getValue().get()) { return; } diff --git a/app/src/main/res/layout/navigation_bar_fullscreen.xml b/app/src/main/res/layout/navigation_bar_fullscreen.xml index d2309e0ed..346d7f9e8 100644 --- a/app/src/main/res/layout/navigation_bar_fullscreen.xml +++ b/app/src/main/res/layout/navigation_bar_fullscreen.xml @@ -15,7 +15,7 @@ android:layout_height="wrap_content" android:layout_gravity="center" android:background="@drawable/resize_bar_background" - android:visibility="gone"> + app:visibleGone="@{viewmodel.isFullscreen}">