Skip to content

Commit

Permalink
Sergio's review
Browse files Browse the repository at this point in the history
  • Loading branch information
haanhvu committed Feb 1, 2025
1 parent 120e0b9 commit 678ed60
Showing 1 changed file with 13 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public class NavigationBarWidget extends UIWidget implements WSession.Navigation
private static final int POPUP_NOTIFICATION_ID = 3;
private static final int WEB_APP_ADDED_NOTIFICATION_ID = 4;

private static boolean disabledHeadlockForVRVideo;
private boolean shouldRestoreHeadLockOnVRVideoExit;

public interface NavigationListener {
void onBack();
Expand Down Expand Up @@ -683,12 +683,7 @@ public void onMediaFullScreen(@NonNull WMediaSession mediaSession, boolean aFull
}

if (mAutoSelectedProjection != VIDEO_PROJECTION_NONE && autoEnter.get()) {
SettingsStore settingsStore = SettingsStore.getInstance(getContext());
if (settingsStore.isHeadLockEnabled()) {
settingsStore.setHeadLockEnabled(false);
disabledHeadlockForVRVideo = true;
}

disableHeadlockForVRVideo();
mViewModel.setAutoEnteredVRVideo(true);
postDelayed(() -> enterVRVideo(mAutoSelectedProjection), 300);
} else {
Expand All @@ -704,9 +699,6 @@ public void onMediaFullScreen(@NonNull WMediaSession mediaSession, boolean aFull

if (isInVRVideo()) {
exitVRVideo();
if (disabledHeadlockForVRVideo) {
SettingsStore.getInstance(getContext()).setHeadLockEnabled(true);
}
}
}
}
Expand Down Expand Up @@ -766,22 +758,13 @@ private void enterFullScreenMode() {
exitVRVideo();
mAttachedWindow.reCenterFrontWindow();
} else {
SettingsStore settingsStore = SettingsStore.getInstance(getContext());
if (settingsStore.isHeadLockEnabled()) {
settingsStore.setHeadLockEnabled(false);
disabledHeadlockForVRVideo = true;
}

disableHeadlockForVRVideo();
// Reproject while reproducing VRVideo
mWidgetManager.showVRVideo(mAttachedWindow.getHandle(), projection);
}
closeFloatingMenus();
} else {
SettingsStore settingsStore = SettingsStore.getInstance(getContext());
if (settingsStore.isHeadLockEnabled()) {
settingsStore.setHeadLockEnabled(false);
disabledHeadlockForVRVideo = true;
}
disableHeadlockForVRVideo();
enterVRVideo(projection);
}
});
Expand All @@ -795,6 +778,14 @@ private void enterFullScreenMode() {
mWidgetManager.pushWorldBrightness(mBrightnessWidget, mBrightnessWidget.getSelectedBrightness());
}

private void disableHeadlockForVRVideo() {
SettingsStore settingsStore = SettingsStore.getInstance(getContext());
if (settingsStore.isHeadLockEnabled()) {
settingsStore.setHeadLockEnabled(false);
shouldRestoreHeadLockOnVRVideoExit = true;
}
}

private void exitFullScreenMode() {
mWidgetPlacement = mBeforeFullscreenPlacement;
updateWidget();
Expand Down Expand Up @@ -1019,7 +1010,7 @@ private void exitVRVideo() {
// Reposition UI in front of the user when exiting a VR video.
mWidgetManager.recenterUIYaw(WidgetManagerDelegate.YAW_TARGET_ALL);

if (disabledHeadlockForVRVideo) {
if (shouldRestoreHeadLockOnVRVideoExit) {
SettingsStore.getInstance(getContext()).setHeadLockEnabled(true);
}
}
Expand Down

0 comments on commit 678ed60

Please sign in to comment.