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

Exit fullscreen on VR video exit when autoenter is used #906

Merged
merged 1 commit into from
Dec 20, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public class NavigationBarWidget extends UIWidget implements GeckoSession.Naviga
private boolean mIsInFullScreenMode;
private boolean mIsResizing;
private boolean mIsInVRVideo;
private boolean mAutoEnteredVRVideo;
private WidgetPlacement mSizeBeforeFullScreen;
private Runnable mResizeBackHandler;
private Runnable mFullScreenBackHandler;
Expand Down Expand Up @@ -130,7 +131,15 @@ private void initialize(Context aContext) {
mResizeBackHandler = () -> exitResizeMode(true);

mFullScreenBackHandler = this::exitFullScreenMode;
mVRVideoBackHandler = this::exitVRVideo;
mVRVideoBackHandler = new Runnable() {
@Override
public void run() {
exitVRVideo();
if (mAutoEnteredVRVideo) {
exitFullScreenMode();
}
}
};

mBackButton.setOnClickListener(v -> {
v.requestFocusFromTouch();
Expand Down Expand Up @@ -705,7 +714,10 @@ public void onFullScreen(GeckoSession session, boolean aFullScreen) {
AtomicBoolean autoEnter = new AtomicBoolean(false);
mAutoSelectedProjection = VideoProjectionMenuWidget.getAutomaticProjection(SessionStore.get().getUriFromSession(session), autoEnter);
if (mAutoSelectedProjection != null && autoEnter.get()) {
getHandler().postDelayed(() -> enterVRVideo(mAutoSelectedProjection), 300);
mAutoEnteredVRVideo = true;
postDelayed(() -> enterVRVideo(mAutoSelectedProjection), 300);
} else {
mAutoEnteredVRVideo = false;
}
} else {
if (mIsInVRVideo) {
Expand Down