diff --git a/app/src/common/chromium/com/igalia/wolvic/browser/api/impl/SessionFinderImpl.java b/app/src/common/chromium/com/igalia/wolvic/browser/api/impl/SessionFinderImpl.java new file mode 100644 index 00000000000..7940c510c08 --- /dev/null +++ b/app/src/common/chromium/com/igalia/wolvic/browser/api/impl/SessionFinderImpl.java @@ -0,0 +1,22 @@ +package com.igalia.wolvic.browser.api.impl; + +import androidx.annotation.Nullable; + +import com.igalia.wolvic.browser.api.WResult; +import com.igalia.wolvic.browser.api.WSession; + +import org.chromium.content_public.browser.WebContents; + +import org.chromium.components.browser_ui.media.MediaImageManager; +import org.jni_zero.JNINamespace; +import org.chromium.components.find_in_page; + +public class SessionFinderImpl implements WSession.SessionFinder { + + private WebContents mWebContents; + + @Override + public WResult find(@Nullable String searchString, int flags) { + + } +} \ No newline at end of file diff --git a/app/src/common/shared/com/igalia/wolvic/ui/viewmodel/WindowViewModel.java b/app/src/common/shared/com/igalia/wolvic/ui/viewmodel/WindowViewModel.java index 70310f55747..7c7c74319da 100644 --- a/app/src/common/shared/com/igalia/wolvic/ui/viewmodel/WindowViewModel.java +++ b/app/src/common/shared/com/igalia/wolvic/ui/viewmodel/WindowViewModel.java @@ -66,6 +66,7 @@ public class WindowViewModel extends AndroidViewModel { private MutableLiveData isPopUpAvailable; private MutableLiveData isPopUpBlocked; private MutableLiveData canGoForward; + private MutableLiveData canGoForwardFromNewTab; private MutableLiveData canGoBack; private MutableLiveData isInVRVideo; private MutableLiveData autoEnteredVRVideo; @@ -154,6 +155,7 @@ public WindowViewModel(Application application) { isPopUpAvailable = new MutableLiveData<>(new ObservableBoolean(false)); isPopUpBlocked = new MutableLiveData<>(new ObservableBoolean(false)); canGoForward = new MutableLiveData<>(new ObservableBoolean(false)); + canGoForwardFromNewTab = new MutableLiveData<>(new ObservableBoolean(false)); canGoBack = new MutableLiveData<>(new ObservableBoolean(false)); isInVRVideo = new MutableLiveData<>(new ObservableBoolean(false)); autoEnteredVRVideo = new MutableLiveData<>(new ObservableBoolean(false)); @@ -359,6 +361,7 @@ public void refresh() { isPopUpAvailable.postValue(isPopUpAvailable.getValue()); isPopUpBlocked.postValue(isPopUpBlocked.getValue()); canGoForward.postValue(canGoForward.getValue()); + canGoForwardFromNewTab.postValue(canGoForwardFromNewTab.getValue()); canGoBack.postValue(canGoBack.getValue()); isInVRVideo.postValue(isInVRVideo.getValue()); autoEnteredVRVideo.postValue(autoEnteredVRVideo.getValue()); @@ -697,6 +700,15 @@ public void setCanGoForward(boolean canGoForward) { this.canGoForward.postValue(new ObservableBoolean(canGoForward)); } + @NonNull + public MutableLiveData getCanGoForwardFromNewTab() { + return canGoForwardFromNewTab; + } + + public void setCanGoForwardFromNewTab(boolean canGoForwardFromNewTab) { + this.canGoForwardFromNewTab.postValue(new ObservableBoolean(canGoForwardFromNewTab)); + } + @NonNull public MutableLiveData getCanGoBack() { return canGoBack; 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 53488944427..45572661f12 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 @@ -255,6 +255,10 @@ private void updateUI() { mBinding.navigationBarNavigation.forwardButton.setOnClickListener(v -> { v.requestFocusFromTouch(); + if (mViewModel.getCanGoForwardFromNewTab().getValue().get()) { + getSession().loadUri(mAttachedWindow.uriForwardFromNewTab); + mViewModel.setCanGoForwardFromNewTab(false); + } getSession().goForward(); if (mAudio != null) { mAudio.playSound(AudioEngine.Sound.CLICK); 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 21618b68359..88022f7804d 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 @@ -155,6 +155,7 @@ public class WindowWidget extends UIWidget implements SessionChangeListener, private SharedPreferences mPrefs; private DownloadsManager mDownloadsManager; private float mBrowserDensity; + public String uriForwardFromNewTab; public interface WindowListener { default void onFocusRequest(@NonNull WindowWidget aWindow) {} @@ -558,7 +559,6 @@ public void showNewTab() { mViewModel.setIsFindInPage(false); mViewModel.setCurrentContentType(Windows.ContentType.NEW_TAB); mViewModel.setUrl(Windows.ContentType.NEW_TAB.URL); - mViewModel.enableBackToNewTab(false); setView(mNewTab, true); if (mRestoreFirstPaint == null) { onFirstContentfulPaint(mSession.getWSession()); @@ -574,6 +574,10 @@ public void showNewTab() { }; } } + if (mViewModel.getBackToNewTabEnabled().getValue().get()) { + mViewModel.enableBackToNewTab(false); + mViewModel.setCanGoForwardFromNewTab(true); + } } public void hidePanel() { @@ -2076,6 +2080,9 @@ WResult onLoadRequest(WSession aSession, @NonNull LoadRequest aReq hideNewTab(); mViewModel.setCurrentContentType(Windows.ContentType.WEB_CONTENT); mViewModel.setUrl(uri.toString()); + if (mViewModel.lastContentType.getValue() == Windows.ContentType.NEW_TAB) { + uriForwardFromNewTab = uri.toString(); + } } if ("file".equalsIgnoreCase(uri.getScheme())) { diff --git a/app/src/main/res/layout/navigation_bar_navigation.xml b/app/src/main/res/layout/navigation_bar_navigation.xml index d9935ea828a..e154f459f1f 100644 --- a/app/src/main/res/layout/navigation_bar_navigation.xml +++ b/app/src/main/res/layout/navigation_bar_navigation.xml @@ -36,7 +36,7 @@ android:layout_weight="0" android:src="@drawable/ic_icon_forward" android:tooltipText="@string/forward_tooltip" - android:enabled="@{viewmodel.canGoForward}" + android:enabled="@{viewmodel.canGoForward || viewmodel.canGoForwardFromNewTab}" app:privateMode="@{viewmodel.isPrivateSession}"/>