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

Do not save window size when resize is cancelled #1465

Merged
merged 1 commit into from
Jul 26, 2019
Merged
Show file tree
Hide file tree
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 @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

Expand Down Expand Up @@ -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();
Expand Down