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

Commit d8133b0

Browse files
authored
Fixes #3426 Fixes fullscreen exit when opening a tab (#3434)
* Fixes fullscreen exit when opening a tab * Fix fullscreen mode when a link is opened in a new session/window * Update the playback controls when session is changed
1 parent 569671a commit d8133b0

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ public void detachFromWindow() {
486486
exitResizeMode(ResizeAction.RESTORE_SIZE);
487487
}
488488
if (mAttachedWindow != null && mAttachedWindow.isFullScreen()) {
489-
exitFullScreenMode();
489+
mAttachedWindow.setIsFullScreen(false);
490490
}
491491

492492
if (getSession() != null) {
@@ -570,7 +570,7 @@ private void cleanSession(@NonNull Session aSession) {
570570
public void onSessionChanged(@NonNull Session aOldSession, @NonNull Session aSession) {
571571
cleanSession(aOldSession);
572572
setUpSession(aSession);
573-
exitFullScreenMode();
573+
mAttachedWindow.setIsFullScreen(false);
574574
}
575575

576576
@Override
@@ -613,6 +613,8 @@ protected void onDraw(Canvas canvas) {
613613
}
614614

615615
private void enterFullScreenMode() {
616+
hideAllNotifications();
617+
616618
mWidgetManager.pushBackHandler(mFullScreenBackHandler);
617619

618620
AnimationHelper.fadeIn(mBinding.navigationBarFullscreen.fullScreenModeContainer, AnimationHelper.FADE_ANIMATION_DURATION, null);
@@ -648,6 +650,8 @@ private void enterFullScreenMode() {
648650
}
649651

650652
private void exitFullScreenMode() {
653+
hideAllNotifications();
654+
651655
if (mAttachedWindow == null || !mAttachedWindow.isFullScreen()) {
652656
return;
653657
}
@@ -675,6 +679,8 @@ private void exitFullScreenMode() {
675679
}
676680

677681
private void enterResizeMode() {
682+
hideAllNotifications();
683+
678684
if (mAttachedWindow.isResizing()) {
679685
return;
680686
}
@@ -721,8 +727,6 @@ private void enterResizeMode() {
721727
}
722728
}
723729

724-
hideAllNotifications();
725-
726730
// Update preset styles
727731
}
728732

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import androidx.annotation.StringRes;
1111

1212
import org.mozilla.vrbrowser.R;
13-
import org.mozilla.vrbrowser.VRBrowserApplication;
1413
import org.mozilla.vrbrowser.ui.views.UIButton;
1514
import org.mozilla.vrbrowser.ui.widgets.NotificationManager.Notification.NotificationPosition;
1615

@@ -88,6 +87,7 @@ public static class Builder {
8887

8988
public Builder(@NonNull UIWidget parent) {
9089
this.parent = parent;
90+
this.view = parent;
9191
this.density = R.dimen.tooltip_default_density;
9292
}
9393

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1165,6 +1165,19 @@ public void onCurrentSessionChange(GeckoSession aOldSession, GeckoSession aSessi
11651165

11661166
mViewModel.setIsPrivateSession(aSession.getSettings().getUsePrivateMode());
11671167

1168+
// Update the title bar media controls state
1169+
boolean mediaAvailable = mSession.getActiveVideo() != null;
1170+
if (mediaAvailable) {
1171+
if (mSession.getActiveVideo().isPlayed()) {
1172+
mViewModel.setIsMediaPlaying(true);
1173+
}
1174+
mViewModel.setIsMediaAvailable(true);
1175+
1176+
} else {
1177+
mViewModel.setIsMediaAvailable(false);
1178+
mViewModel.setIsMediaPlaying(false);
1179+
}
1180+
11681181
waitForFirstPaint();
11691182
}
11701183

@@ -1179,7 +1192,11 @@ public void onStackSession(Session aSession) {
11791192
Session current = mSession;
11801193
setSession(aSession, WindowWidget.DEACTIVATE_CURRENT_SESSION);
11811194
current.captureBackgroundBitmap(getWindowWidth(), getWindowHeight()).thenAccept(aVoid -> current.setActive(false));
1182-
mWidgetManager.getWindows().showTabAddedNotification();
1195+
1196+
// Delay the notification so it it's displayed in the tray when a link in
1197+
// full screen ones in a new tab. Otherwise the navigation bar has not the correct size and
1198+
// the notification is misplaced.
1199+
postDelayed(() -> mWidgetManager.getWindows().showTabAddedNotification(), 500);
11831200

11841201
GleanMetricsService.Tabs.openedCounter(GleanMetricsService.Tabs.TabSource.BROWSER);
11851202
}

0 commit comments

Comments
 (0)