Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
haanhvu committed Jan 30, 2025
1 parent 3d33a9e commit cb6b362
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ 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 disableHeadlockForVR;

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

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

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

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

// Reproject while reproducing VRVideo
mWidgetManager.showVRVideo(mAttachedWindow.getHandle(), projection);
}
closeFloatingMenus();
} else {
SettingsStore settingsStore = SettingsStore.getInstance(getContext());
if (settingsStore.isHeadLockEnabled() == true) {
settingsStore.setHeadLockEnabled(false);
disableHeadlockForVR = true;
}
enterVRVideo(projection);
}
});
Expand Down Expand Up @@ -996,6 +1018,10 @@ private void exitVRVideo() {
mWidgetManager.setCylinderDensityForce(mSavedCylinderDensity);
// Reposition UI in front of the user when exiting a VR video.
mWidgetManager.recenterUIYaw(WidgetManagerDelegate.YAW_TARGET_ALL);

if (disableHeadlockForVR == true) {
SettingsStore.getInstance(getContext()).setHeadLockEnabled(true);
}
}

private void setResizePreset(float aMultiplier) {
Expand Down

0 comments on commit cb6b362

Please sign in to comment.