Skip to content

Commit

Permalink
Only load home page if session uri is blank on new intent. (#3545)
Browse files Browse the repository at this point in the history
Fixes #3530
Fixes #3543
  • Loading branch information
bluemarvin committed Jun 26, 2020
1 parent d59799f commit 50e2735
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ void loadFromIntent(final Intent intent) {
}
mWindows.openNewTabAfterRestore(uri.toString(), location);
} else {
mWindows.getFocusedWindow().loadHomeIfNotRestored();
mWindows.getFocusedWindow().loadHomeIfBlank();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ public class WindowWidget extends UIWidget implements SessionChangeListener,
private Windows.WindowPlacement mWindowPlacement = Windows.WindowPlacement.FRONT;
private Windows.WindowPlacement mWindowPlacementBeforeFullscreen = Windows.WindowPlacement.FRONT;
private float mMaxWindowScale = 3;
private boolean mIsRestored = false;
private CopyOnWriteArrayList<WindowListener> mListeners;
boolean mActive = false;
boolean mHovered = false;
Expand Down Expand Up @@ -382,8 +381,9 @@ public void close() {
mListeners.clear();
}

public void loadHomeIfNotRestored() {
if (!mIsRestored) {
public void loadHomeIfBlank() {
final String currentUri = mSession.getCurrentUri();
if ((currentUri == null) || currentUri.isEmpty() || UrlUtils.isBlankUri(getContext(), mSession.getCurrentUri())) {
loadHome();
}
}
Expand All @@ -397,10 +397,6 @@ public void loadHome() {
}
}

protected void setRestored(boolean restored) {
mIsRestored = restored;
}

private void setView(View view, boolean switchSurface) {
Runnable setView = () -> {
if (switchSurface) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,6 @@ private WindowWidget addRestoredWindow(@NonNull WindowState aState, @Nullable Se
newWindow.getPlacement().width = aState.textureWidth;
newWindow.getPlacement().height = aState.textureHeight;
newWindow.getPlacement().worldWidth = aState.worldWidth;
newWindow.setRestored(true);
placeWindow(newWindow, aState.placement);
if (newWindow.getSession() != null) {
if (aState.panelType != null) {
Expand Down

0 comments on commit 50e2735

Please sign in to comment.