diff --git a/app/src/common/shared/com/igalia/wolvic/ui/widgets/NavigationBarWidget.java b/app/src/common/shared/com/igalia/wolvic/ui/widgets/NavigationBarWidget.java index b6e76499206..2f4952568ab 100644 --- a/app/src/common/shared/com/igalia/wolvic/ui/widgets/NavigationBarWidget.java +++ b/app/src/common/shared/com/igalia/wolvic/ui/widgets/NavigationBarWidget.java @@ -242,7 +242,8 @@ private void updateUI() { v.requestFocusFromTouch(); if (mViewModel.getBackToNewTabEnabled().getValue().get()) { - mAttachedWindow.showNewTab(); + //mAttachedWindow.showNewTab(); + getSession().loadUri(UrlUtils.ABOUT_NEWTAB); } if (getSession().canGoBack()) { 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 8d913706976..1b788c8a92f 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 @@ -527,6 +527,7 @@ public void showPanel(Windows.ContentType panelType) { private void showPanel(Windows.ContentType contentType, boolean switchSurface) { if (mLibrary == null) { + Log.e("New Tab PR", "showPanel(): mLibrary is null"); return; } @@ -535,10 +536,12 @@ private void showPanel(Windows.ContentType contentType, boolean switchSurface) { mViewModel.setCurrentContentType(contentType); mViewModel.setUrl(contentType.URL); if (mView == null) { + Log.e("New Tab PR", "mView == null"); setView(mLibrary, switchSurface); mLibrary.selectPanel(contentType); mLibrary.onShow(); if (mRestoreFirstPaint == null && !isFirstPaintReady() && (mFirstDrawCallback != null) && (mSurface != null)) { + Log.e("New Tab PR", "if clause is run"); final Runnable firstDrawCallback = mFirstDrawCallback; onFirstContentfulPaint(mSession.getWSession()); mRestoreFirstPaint = () -> { @@ -548,9 +551,14 @@ private void showPanel(Windows.ContentType contentType, boolean switchSurface) { mWidgetManager.updateWidget(WindowWidget.this); } }; + } else { + Log.e("New Tab PR", "if clause is NOT run"); } } else if (mView == mLibrary) { + Log.e("New Tab PR", "mView == null"); mLibrary.selectPanel(contentType); + } else { + Log.e("New Tab PR", "Other case"); } } @@ -601,16 +609,23 @@ public void hideNewTab() { if (mViewModel.getCurrentContentType().getValue() == Windows.ContentType.NEW_TAB) { mViewModel.enableBackToNewTab(true); hideNewTab(true); + } else { + Log.e("New Tab PR", "Current content type is not New Tab"); } } private void hideNewTab(boolean switchSurface) { if (mView != null && mNewTab != null) { unsetView(mNewTab, switchSurface); + } else { + Log.e("New Tab PR", "Cannot unset New Tab view"); } if (switchSurface && mRestoreFirstPaint != null) { + Log.e("New Tab PR", "mRestoreFirstPaint is not null => Can make null"); mRestoreFirstPaint.run(); mRestoreFirstPaint = null; + } else { + Log.e("New Tab PR", "Cannot make mRestoreFirstPaint null"); } }