Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit 78da896

Browse files
authored
Fixes #2660 Set the correct fullscreen controls and menus curved state (#3305)
* Fix navigation bar and menus curved mode * Close brightness/projection menus when clicked in the widget
1 parent 444367e commit 78da896

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/MediaControlsWidget.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import org.mozilla.vrbrowser.R;
2020
import org.mozilla.geckoview.MediaElement;
2121
import org.mozilla.vrbrowser.browser.Media;
22+
import org.mozilla.vrbrowser.browser.SettingsStore;
2223
import org.mozilla.vrbrowser.ui.views.MediaSeekBar;
2324
import org.mozilla.vrbrowser.ui.views.UIButton;
2425
import org.mozilla.vrbrowser.ui.views.VolumeControl;
@@ -123,6 +124,7 @@ private void initialize(Context aContext) {
123124
placement.parentAnchorX = 0.65f;
124125
placement.parentAnchorY = 0.4f;
125126
placement.cylinderMapRadius = 0.0f;
127+
placement.cylinder = SettingsStore.getInstance(getContext()).isCurvedModeEnabled();
126128
if (mWidgetManager.getCylinderDensity() > 0) {
127129
placement.rotationAxisY = 1.0f;
128130
placement.rotation = (float) Math.toRadians(-7);

app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/NavigationBarWidget.java

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import android.util.Log;
1717
import android.util.Pair;
1818
import android.view.LayoutInflater;
19+
import android.view.MotionEvent;
1920
import android.view.View;
2021
import android.webkit.URLUtil;
2122
import android.widget.EditText;
@@ -115,7 +116,7 @@ public interface NavigationListener {
115116
private Executor mUIThreadExecutor;
116117
private ArrayList<NavigationListener> mNavigationListeners;
117118
private TrackingProtectionStore mTrackingDelegate;
118-
private boolean mIsWindowAttached;
119+
private WidgetPlacement mBeforeFullscreenPlacement;
119120

120121
public NavigationBarWidget(Context aContext) {
121122
super(aContext);
@@ -141,8 +142,6 @@ private void initialize(@NonNull Context aContext) {
141142

142143
updateUI();
143144

144-
mIsWindowAttached = false;
145-
146145
mAppContext = aContext.getApplicationContext();
147146

148147
mUIThreadExecutor = ((VRBrowserApplication)aContext.getApplicationContext()).getExecutors().mainThread();
@@ -304,6 +303,8 @@ private void updateUI() {
304303
boolean wasVisible = mProjectionMenu.isVisible();
305304
closeFloatingMenus();
306305

306+
mProjectionMenu.mWidgetPlacement.cylinder = SettingsStore.getInstance(getContext()).isCurvedModeEnabled();
307+
307308
if (!wasVisible) {
308309
mProjectionMenu.show(REQUEST_FOCUS);
309310
}
@@ -321,6 +322,8 @@ private void updateUI() {
321322
boolean wasVisible = mBrightnessWidget.isVisible();
322323
closeFloatingMenus();
323324

325+
mBrightnessWidget.mWidgetPlacement.cylinder = SettingsStore.getInstance(getContext()).isCurvedModeEnabled();
326+
324327
if (!wasVisible) {
325328
float anchor = 0.5f + (float)mBinding.navigationBarFullscreen.brightnessButton.getMeasuredWidth() / (float)NavigationBarWidget.this.getMeasuredWidth();
326329
mBrightnessWidget.getPlacement().parentAnchorX = anchor;
@@ -383,6 +386,12 @@ private void updateUI() {
383386
if (mAttachedWindow != null) {
384387
mBinding.navigationBarNavigation.urlBar.attachToWindow(mAttachedWindow);
385388
}
389+
390+
setOnTouchListener((v, event) -> {
391+
closeFloatingMenus();
392+
v.performClick();
393+
return true;
394+
});
386395
}
387396

388397
TrackingProtectionStore.TrackingProtectionListener mTrackingListener = new TrackingProtectionStore.TrackingProtectionListener() {
@@ -501,8 +510,6 @@ public void detachFromWindow() {
501510
mViewModel.getIsPopUpBlocked().removeObserver(mIsPopUpBlockedListener);
502511
mViewModel = null;
503512
}
504-
505-
mIsWindowAttached = false;
506513
}
507514

508515
@Override
@@ -530,14 +537,14 @@ public void attachToWindow(@NonNull WindowWidget aWindow) {
530537

531538
mAttachedWindow.addWindowListener(this);
532539

540+
mBeforeFullscreenPlacement = mWidgetPlacement;
541+
533542
clearFocus();
534543

535544
if (getSession() != null) {
536545
setUpSession(getSession());
537546
}
538547
handleWindowResize();
539-
540-
mIsWindowAttached = true;
541548
}
542549

543550
private Session getSession() {
@@ -572,6 +579,10 @@ public void onFullScreen(@NonNull WindowWidget aWindow, boolean aFullScreen) {
572579
if (aFullScreen) {
573580
enterFullScreenMode();
574581

582+
mBeforeFullscreenPlacement = mWidgetPlacement.clone();
583+
mWidgetPlacement.cylinder = SettingsStore.getInstance(getContext()).isCurvedModeEnabled();
584+
updateWidget();
585+
575586
if (mAttachedWindow.isResizing()) {
576587
exitResizeMode(ResizeAction.KEEP_SIZE);
577588
}
@@ -587,6 +598,9 @@ public void onFullScreen(@NonNull WindowWidget aWindow, boolean aFullScreen) {
587598
}
588599
}
589600
} else {
601+
mWidgetPlacement = mBeforeFullscreenPlacement;
602+
updateWidget();
603+
590604
if (mViewModel.getIsInVRVideo().getValue().get()) {
591605
exitVRVideo();
592606
}

0 commit comments

Comments
 (0)