From feec65cdd4e12b6cb05b7a354db956f4b3c03928 Mon Sep 17 00:00:00 2001 From: Songlin Jiang Date: Wed, 6 Sep 2023 13:50:07 +0200 Subject: [PATCH] Stop having findInPage and Panel opened at same time Extend the commit https://github.com/Igalia/wolvic/pull/959/commits/a23e2cf5a283adf921eec692916549e86ad673c8 here Signed-off-by: Songlin Jiang --- .../com/igalia/wolvic/ui/viewmodel/WindowViewModel.java | 2 +- .../com/igalia/wolvic/ui/widgets/NavigationBarWidget.java | 2 +- .../shared/com/igalia/wolvic/ui/widgets/WindowWidget.java | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) 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 d7fa48e6a5..70e38f8b57 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 @@ -698,7 +698,7 @@ public MutableLiveData getIsFindInPage() { } public void setIsFindInPage(boolean isFindInPage) { - this.isFindInPage.postValue(new ObservableBoolean(isFindInPage)); + this.isFindInPage.setValue(new ObservableBoolean(isFindInPage)); } @NonNull 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 54751709ae..811af8ffd5 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 @@ -1327,7 +1327,7 @@ public void onSendTab() { @Override public void onFindInPage() { hideMenu(); - mAttachedWindow.hidePanel(); + mAttachedWindow.hideAllPanel(); mViewModel.setIsFindInPage(true); } 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 ca29ff233d..704d053d6e 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 @@ -536,6 +536,10 @@ int getSelectedPanel() { return mLibrary.getSelectedPanelType(); } + public void hideAllPanel() { + hideAllPanel(true); + } + private void hideAllPanel(boolean switchSurface) { if (mViewModel.getIsLibraryVisible().getValue().get()) { hidePanel(switchSurface); @@ -662,6 +666,7 @@ private void showDownloadsPanel(boolean switchSurface) { if (mView == null) { setView(mDownloads, switchSurface); mDownloads.onShow(); + mViewModel.setIsFindInPage(false); mViewModel.setIsDownloadsVisible(true); showPanelCommonAction(); @@ -693,6 +698,7 @@ private void showWebAppsPanel(boolean switchSurface) { if (mView == null) { setView(mWebApps, switchSurface); mWebApps.onShow(); + mViewModel.setIsFindInPage(false); mViewModel.setIsWebAppsVisible(true); showPanelCommonAction(); @@ -724,6 +730,7 @@ private void showAddonsPanel(boolean switchSurface) { if (mView == null) { setView(mAddons, switchSurface); mAddons.onShow(); + mViewModel.setIsFindInPage(false); mViewModel.setIsAddonsVisible(true); showPanelCommonAction();