Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.
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 @@ -379,13 +379,19 @@ public void setBrowserWidget(WindowWidget aWidget) {

private void setFullScreenSize() {
mPlacementBeforeResize.copyFrom(mWindowWidget.getPlacement());
final float minScale = WidgetPlacement.floatDimension(getContext(), R.dimen.window_fullscreen_min_scale);
// Set browser fullscreen size
float aspect = SettingsStore.getInstance(getContext()).getWindowAspect();
Media media = SessionStore.get().getFullScreenVideo();
if (media != null && media.getWidth() > 0 && media.getHeight() > 0) {
aspect = (float)media.getWidth() / (float)media.getHeight();
}
mWindowWidget.resizeByMultiplier(aspect,1.75f);
float scale = mWindowWidget.getCurrentScale();
// Enforce min fullscreen size.
// If current window area is larger only resize if the aspect changes (e.g. media).
if (scale < minScale || aspect != mWindowWidget.getCurrentAspect()) {
mWindowWidget.resizeByMultiplier(aspect, Math.max(scale, minScale));
}
}

private void enterFullScreenMode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,20 @@ public void resizeByMultiplier(float aspect, float multiplier) {
handleResizeEvent(targetWidth, targetHeight);
}

public float getCurrentScale() {
float currentAspect = getCurrentAspect();
float currentWorldHeight = mWidgetPlacement.worldWidth / currentAspect;
float currentArea = mWidgetPlacement.worldWidth * currentWorldHeight;
float defaultWidth = WidgetPlacement.floatDimension(getContext(), R.dimen.window_world_width);
float defaultHeight = defaultWidth / SettingsStore.getInstance(getContext()).getWindowAspect();
float defaultArea = defaultWidth * defaultHeight;
return currentArea / defaultArea;
}

public float getCurrentAspect() {
return (float) mWidgetPlacement.width / (float) mWidgetPlacement.height;
}

public int getBorderWidth() {
return mBorderWidth;
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/dimen.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<item name="window_world_y" format="float" type="dimen">0.2</item>
<item name="window_world_z" format="float" type="dimen">-4.2</item>
<item name="browser_children_z_distance" format="float" type="dimen">1.5</item>
<item name="window_fullscreen_min_scale" format="float" type="dimen">1.75</item>

<!-- Navigation bar -->
<dimen name="navigation_bar_width">720dp</dimen>
Expand Down