From 9f557764765f492996814662e0ca56acd73bd28a Mon Sep 17 00:00:00 2001 From: haanhvu Date: Mon, 18 Nov 2024 13:05:16 +0700 Subject: [PATCH] Fixes #1494 Add a Fullscreen item in the hamburger menu to set the current window in the fullscreen mode. This item will not be available in kiosk mode. --- .../wolvic/ui/widgets/NavigationBarWidget.java | 5 +++++ .../ui/widgets/menus/HamburgerMenuWidget.java | 13 +++++++++++++ app/src/main/res/values/strings.xml | 4 ++++ 3 files changed, 22 insertions(+) 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 5e62273569..84ed72d88e 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 @@ -1347,6 +1347,11 @@ public void onResize() { enterResizeMode(); } + @Override + public void onFullScreen() { + mAttachedWindow.setIsFullScreen(true); + } + @Override public void onPassthrough() { mWidgetManager.togglePassthrough(); diff --git a/app/src/common/shared/com/igalia/wolvic/ui/widgets/menus/HamburgerMenuWidget.java b/app/src/common/shared/com/igalia/wolvic/ui/widgets/menus/HamburgerMenuWidget.java index 40c6b165c7..e4d20f4f71 100644 --- a/app/src/common/shared/com/igalia/wolvic/ui/widgets/menus/HamburgerMenuWidget.java +++ b/app/src/common/shared/com/igalia/wolvic/ui/widgets/menus/HamburgerMenuWidget.java @@ -55,6 +55,7 @@ public interface MenuDelegate { void onPageZoomIn(); void onPageZoomOut(); int getCurrentZoomLevel(); + void onFullScreen(); } public static final int SWITCH_ITEM_ID = 0; @@ -189,6 +190,18 @@ private void updateItems() { // In kiosk mode, only resize, find in page and passthrough are available. if (!mWidgetManager.getFocusedWindow().isKioskMode()) { + mItems.add(new HamburgerMenuAdapter.MenuItem.Builder( + HamburgerMenuAdapter.MenuItem.TYPE_DEFAULT, + (menuItem) -> { + if (mDelegate != null) { + mDelegate.onFullScreen(); + } + return null; + }) + .withTitle(getContext().getString(R.string.hamburger_menu_fullscreen)) + .withIcon(R.drawable.fullscreen_button) + .build()); + final Session activeSession = SessionStore.get().getActiveSession(); if (!BuildConfig.FLAVOR_backend.equals("chromium")) { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f7d2fbdfe1..bcacf902e6 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -2074,6 +2074,10 @@ the Select` button. When clicked it bookmarks all the previously selected tabs - it saves the Web App provided by the current page --> Save Web app… + + Fullscreen + Menu