diff --git a/app/src/common/shared/com/igalia/wolvic/ui/widgets/WindowWidget.java b/app/src/common/shared/com/igalia/wolvic/ui/widgets/WindowWidget.java index e659dffe4f0..8f23c6f3f50 100644 --- a/app/src/common/shared/com/igalia/wolvic/ui/widgets/WindowWidget.java +++ b/app/src/common/shared/com/igalia/wolvic/ui/widgets/WindowWidget.java @@ -549,6 +549,8 @@ private void showPanel(Windows.ContentType contentType, boolean switchSurface) { } }; } + } else if (mView == mLibrary) { + mLibrary.selectPanel(contentType); } } @@ -582,7 +584,6 @@ private void hidePanel(boolean switchSurface) { if (mView != null && mLibrary != null) { unsetView(mLibrary, switchSurface); mLibrary.onHide(); - mViewModel.setCurrentContentType(Windows.ContentType.WEB_CONTENT); } if (switchSurface && mRestoreFirstPaint != null) { mRestoreFirstPaint.run(); @@ -590,6 +591,8 @@ private void hidePanel(boolean switchSurface) { } if (mViewModel.getBackToNewTabEnabled().getValue().get()) { showNewTab(); + } else { + mViewModel.setCurrentContentType(Windows.ContentType.WEB_CONTENT); } } @@ -2049,23 +2052,24 @@ WResult onLoadRequest(WSession aSession, @NonNull LoadRequest aReq Uri uri = Uri.parse(aRequest.uri); if (UrlUtils.isAboutPage(uri.toString())) { if(UrlUtils.isBookmarksUrl(uri.toString())) { - hideNewTab(true); + hideNewTab(); showPanel(Windows.ContentType.BOOKMARKS); } else if (UrlUtils.isHistoryUrl(uri.toString())) { - hideNewTab(true); + hideNewTab(); showPanel(Windows.ContentType.HISTORY); } else if (UrlUtils.isDownloadsUrl(uri.toString())) { - hideNewTab(true); + hideNewTab(); showPanel(Windows.ContentType.DOWNLOADS); } else if (UrlUtils.isAddonsUrl(uri.toString())) { - hideNewTab(true); + hideNewTab(); showPanel(Windows.ContentType.ADDONS); } else if (UrlUtils.isNewTabUrl(uri.toString())) { - showNewTab(); + hideLibraryPanel(); + showNewTab(); } else { hideNewTab(); @@ -2075,6 +2079,8 @@ WResult onLoadRequest(WSession aSession, @NonNull LoadRequest aReq } else { hideNewTab(); hideLibraryPanel(); + mViewModel.setCurrentContentType(Windows.ContentType.WEB_CONTENT); + mViewModel.setUrl(uri.toString()); } if ("file".equalsIgnoreCase(uri.getScheme())) {