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

Commit

Permalink
Fixes #3426 Fixes fullscreen exit when opening a tab (#3434)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
keianhzo authored May 29, 2020
1 parent 569671a commit d8133b0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ public void detachFromWindow() {
exitResizeMode(ResizeAction.RESTORE_SIZE);
}
if (mAttachedWindow != null && mAttachedWindow.isFullScreen()) {
exitFullScreenMode();
mAttachedWindow.setIsFullScreen(false);
}

if (getSession() != null) {
Expand Down Expand Up @@ -570,7 +570,7 @@ private void cleanSession(@NonNull Session aSession) {
public void onSessionChanged(@NonNull Session aOldSession, @NonNull Session aSession) {
cleanSession(aOldSession);
setUpSession(aSession);
exitFullScreenMode();
mAttachedWindow.setIsFullScreen(false);
}

@Override
Expand Down Expand Up @@ -613,6 +613,8 @@ protected void onDraw(Canvas canvas) {
}

private void enterFullScreenMode() {
hideAllNotifications();

mWidgetManager.pushBackHandler(mFullScreenBackHandler);

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

private void exitFullScreenMode() {
hideAllNotifications();

if (mAttachedWindow == null || !mAttachedWindow.isFullScreen()) {
return;
}
Expand Down Expand Up @@ -675,6 +679,8 @@ private void exitFullScreenMode() {
}

private void enterResizeMode() {
hideAllNotifications();

if (mAttachedWindow.isResizing()) {
return;
}
Expand Down Expand Up @@ -721,8 +727,6 @@ private void enterResizeMode() {
}
}

hideAllNotifications();

// Update preset styles
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import androidx.annotation.StringRes;

import org.mozilla.vrbrowser.R;
import org.mozilla.vrbrowser.VRBrowserApplication;
import org.mozilla.vrbrowser.ui.views.UIButton;
import org.mozilla.vrbrowser.ui.widgets.NotificationManager.Notification.NotificationPosition;

Expand Down Expand Up @@ -88,6 +87,7 @@ public static class Builder {

public Builder(@NonNull UIWidget parent) {
this.parent = parent;
this.view = parent;
this.density = R.dimen.tooltip_default_density;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1165,6 +1165,19 @@ public void onCurrentSessionChange(GeckoSession aOldSession, GeckoSession aSessi

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

// Update the title bar media controls state
boolean mediaAvailable = mSession.getActiveVideo() != null;
if (mediaAvailable) {
if (mSession.getActiveVideo().isPlayed()) {
mViewModel.setIsMediaPlaying(true);
}
mViewModel.setIsMediaAvailable(true);

} else {
mViewModel.setIsMediaAvailable(false);
mViewModel.setIsMediaPlaying(false);
}

waitForFirstPaint();
}

Expand All @@ -1179,7 +1192,11 @@ public void onStackSession(Session aSession) {
Session current = mSession;
setSession(aSession, WindowWidget.DEACTIVATE_CURRENT_SESSION);
current.captureBackgroundBitmap(getWindowWidth(), getWindowHeight()).thenAccept(aVoid -> current.setActive(false));
mWidgetManager.getWindows().showTabAddedNotification();

// Delay the notification so it it's displayed in the tray when a link in
// full screen ones in a new tab. Otherwise the navigation bar has not the correct size and
// the notification is misplaced.
postDelayed(() -> mWidgetManager.getWindows().showTabAddedNotification(), 500);

GleanMetricsService.Tabs.openedCounter(GleanMetricsService.Tabs.TabSource.BROWSER);
}
Expand Down

0 comments on commit d8133b0

Please sign in to comment.