From 28660eb2b44576396a8c71a98e885236173cd9c1 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 d7fa48e6a51..70e38f8b574 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 54751709aea..811af8ffd52 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 3919577492c..30a4de3d32f 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 @@ -537,6 +537,10 @@ int getSelectedPanel() { return mLibrary.getSelectedPanelType(); } + public void hideAllPanel() { + hideAllPanel(true); + } + private void hideAllPanel(boolean switchSurface) { if (mViewModel.getIsLibraryVisible().getValue().get()) { hidePanel(switchSurface); @@ -663,6 +667,7 @@ private void showDownloadsPanel(boolean switchSurface) { if (mView == null) { setView(mDownloads, switchSurface); mDownloads.onShow(); + mViewModel.setIsFindInPage(false); mViewModel.setIsDownloadsVisible(true); showPanelCommonAction(); @@ -694,6 +699,7 @@ private void showWebAppsPanel(boolean switchSurface) { if (mView == null) { setView(mWebApps, switchSurface); mWebApps.onShow(); + mViewModel.setIsFindInPage(false); mViewModel.setIsWebAppsVisible(true); showPanelCommonAction(); @@ -725,6 +731,7 @@ private void showAddonsPanel(boolean switchSurface) { if (mView == null) { setView(mAddons, switchSurface); mAddons.onShow(); + mViewModel.setIsFindInPage(false); mViewModel.setIsAddonsVisible(true); showPanelCommonAction();