Skip to content

Commit

Permalink
Fix remaining bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
haanhvu committed Dec 4, 2024
1 parent ccb8497 commit 6d29be0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ public WindowViewModel(Application application) {

isNativeContentVisible = new MediatorLiveData<>();
isNativeContentVisible.addSource(currentContentType, contentType ->
isNativeContentVisible.setValue(new ObservableBoolean(contentType != Windows.ContentType.WEB_CONTENT))
isNativeContentVisible.setValue(new ObservableBoolean(contentType != Windows.ContentType.WEB_CONTENT && contentType != Windows.ContentType.NEW_TAB))
);
isNativeContentVisible.setValue(new ObservableBoolean(currentContentType.getValue() != Windows.ContentType.WEB_CONTENT));
isNativeContentVisible.setValue(new ObservableBoolean(currentContentType.getValue() != Windows.ContentType.WEB_CONTENT && currentContentType.getValue() != Windows.ContentType.NEW_TAB));

backToNewTabEnabled = new MutableLiveData<>(new ObservableBoolean(false));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@ private void updateUI() {
if (getSession().canGoBack()) {
getSession().goBack();
} else if (mViewModel.getBackToNewTabEnabled().getValue().get()) {
mAttachedWindow.showNewTab();
//mAttachedWindow.showNewTab();
getSession().loadUri("about://newtab");
}

if (mAudio != null) {
Expand All @@ -256,15 +257,23 @@ private void updateUI() {
mBinding.navigationBarNavigation.forwardButton.setOnClickListener(v -> {
v.requestFocusFromTouch();
if (mViewModel.getCanGoForwardFromNewTab().getValue().get()) {
getSession().loadUri(mViewModel.getUrlForwardFromNewTab().getValue().toString());
//mAttachedWindow.hideNewTab();

String forwardUrl = mViewModel.getUrlForwardFromNewTab().getValue().toString();
getSession().loadUri(forwardUrl);

mAttachedWindow.hideNewTab();

mViewModel.setCurrentContentType(Windows.ContentType.WEB_CONTENT);
mViewModel.setUrl(forwardUrl);
mViewModel.setCanGoForwardFromNewTab(false);
} else {
getSession().goForward();
}
if (mAudio != null) {
mAudio.playSound(AudioEngine.Sound.CLICK);
}
mNavigationListeners.forEach(NavigationListener::onForward);
//mNavigationListeners.forEach(NavigationListener::onForward);
});

mBinding.navigationBarNavigation.reloadButton.setOnClickListener(v -> {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/navigation_bar_navigation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
style="?attr/navigationBarButtonStyle"
android:src="@{viewmodel.isLoading ? @drawable/ic_icon_exit : @drawable/ic_icon_reload}"
android:tooltipText="@{viewmodel.isLoading ? @string/stop_tooltip : @string/refresh_tooltip}"
android:enabled="@{viewmodel.currentContentType != ContentType.NEW_TAB}"
android:enabled="@{!viewmodel.isNativeContentVisible &amp;&amp; viewmodel.currentContentType != ContentType.NEW_TAB}"
app:privateMode="@{viewmodel.isPrivateSession}" />

<ProgressBar
Expand Down

0 comments on commit 6d29be0

Please sign in to comment.