diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/NavigationBarWidget.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/NavigationBarWidget.java index a825001a5..c1eb86500 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/NavigationBarWidget.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/NavigationBarWidget.java @@ -493,6 +493,7 @@ private void exitResizeMode(ResizeAction aResizeAction) { if (aResizeAction == ResizeAction.RESTORE_SIZE) { mWindowWidget.getPlacement().copyFrom(mPlacementBeforeResize); mWidgetManager.updateWidget(mWindowWidget); + mWindowWidget.saveCurrentSize(); } mIsResizing = false; finishWidgetResize(); diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/WindowWidget.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/WindowWidget.java index 0c6d82940..dd33ddfa3 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/WindowWidget.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/WindowWidget.java @@ -406,10 +406,8 @@ public void handleResizeEvent(float aWorldWidth, float aWorldHeight) { mWidgetPlacement.height = (int) ((aWorldHeight * defaultHeight) / worldHeight) + mBorderWidth * 2; mWidgetPlacement.worldWidth = aWorldWidth; mWidgetManager.updateWidget(this); - if (mSaveResizeChanges) { - SettingsStore.getInstance(getContext()).setBrowserWorldWidth(aWorldWidth); - SettingsStore.getInstance(getContext()).setBrowserWorldHeight(aWorldHeight); + saveCurrentSize(); } } @@ -603,6 +601,12 @@ public void setNoInternetToastVisible(boolean aVisible) { } } + public void saveCurrentSize() { + final float aspect = (float)mWidgetPlacement.width / (float)mWidgetPlacement.height; + SettingsStore.getInstance(getContext()).setBrowserWorldWidth(mWidgetPlacement.worldWidth); + SettingsStore.getInstance(getContext()).setBrowserWorldHeight(mWidgetPlacement.worldWidth / aspect); + } + public void showAlert(String title, @NonNull String msg, @NonNull AlertCallback callback) { mAlertPrompt = new AlertPromptWidget(getContext()); mAlertPrompt.mWidgetPlacement.parentHandle = getHandle();