From fad27d74a027d3c1564dd9334819abffca6791d8 Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Tue, 10 Mar 2026 00:36:13 +0800 Subject: [PATCH] compat(android): show button navigation bar on Android, closes #3466 (#3501) --- .../android/src/main/java/NativeBridgePlugin.kt | 4 ++-- .../reader/components/footerbar/ColorPanel.tsx | 9 ++++++++- .../components/footerbar/FontLayoutPanel.tsx | 11 +++++++++-- .../components/footerbar/MobileFooterBar.tsx | 3 +-- .../reader/components/footerbar/NavigationBar.tsx | 15 ++++++++++++--- .../components/footerbar/NavigationPanel.tsx | 13 +++++++++++-- .../src/app/reader/components/sidebar/Content.tsx | 4 +--- .../src/app/reader/components/tts/TTSControl.tsx | 2 +- 8 files changed, 45 insertions(+), 16 deletions(-) diff --git a/apps/readest-app/src-tauri/plugins/tauri-plugin-native-bridge/android/src/main/java/NativeBridgePlugin.kt b/apps/readest-app/src-tauri/plugins/tauri-plugin-native-bridge/android/src/main/java/NativeBridgePlugin.kt index c4a2dcb0..1ac1da57 100644 --- a/apps/readest-app/src-tauri/plugins/tauri-plugin-native-bridge/android/src/main/java/NativeBridgePlugin.kt +++ b/apps/readest-app/src-tauri/plugins/tauri-plugin-native-bridge/android/src/main/java/NativeBridgePlugin.kt @@ -285,7 +285,7 @@ class NativeBridgePlugin(private val activity: Activity): Plugin(activity) { } if (visible) { controller.show(WindowInsets.Type.statusBars()) - controller.hide(WindowInsets.Type.navigationBars()) + controller.show(WindowInsets.Type.navigationBars()) } else { controller.hide(WindowInsets.Type.systemBars()) } @@ -301,7 +301,7 @@ class NativeBridgePlugin(private val activity: Activity): Plugin(activity) { } if (visible) { it.show(WindowInsetsCompat.Type.statusBars()) - it.hide(WindowInsetsCompat.Type.navigationBars()) + it.show(WindowInsetsCompat.Type.navigationBars()) } else { it.hide(WindowInsetsCompat.Type.systemBars()) } diff --git a/apps/readest-app/src/app/reader/components/footerbar/ColorPanel.tsx b/apps/readest-app/src/app/reader/components/footerbar/ColorPanel.tsx index 668e9af9..96cda389 100644 --- a/apps/readest-app/src/app/reader/components/footerbar/ColorPanel.tsx +++ b/apps/readest-app/src/app/reader/components/footerbar/ColorPanel.tsx @@ -79,7 +79,14 @@ export const ColorPanel: React.FC = ({ actionTab, bottomOffset ); return ( -
+
{appService?.hasScreenBrightness && ( = ({ marginIconSize, }) => { const _ = useTranslation(); - const { envConfig } = useEnv(); + const { envConfig, appService } = useEnv(); const { getView, getViewSettings } = useReaderStore(); const viewSettings = getViewSettings(bookKey); const view = getView(bookKey); @@ -98,7 +98,14 @@ export const FontLayoutPanel: React.FC = ({ ); return ( -
+
= ({ const sliderHeight = useResponsiveSize(28); const marginIconSize = useResponsiveSize(20); const bottomOffset = isMobile ? `${gridInsets.bottom * 0.33 + 64}px` : '64px'; - const navPadding = isMobile ? `${gridInsets.bottom * 0.33 + 16}px` : '0px'; return ( <> @@ -42,7 +41,7 @@ const MobileFooterBar: React.FC = ({ diff --git a/apps/readest-app/src/app/reader/components/footerbar/NavigationBar.tsx b/apps/readest-app/src/app/reader/components/footerbar/NavigationBar.tsx index d211280c..fde96dcd 100644 --- a/apps/readest-app/src/app/reader/components/footerbar/NavigationBar.tsx +++ b/apps/readest-app/src/app/reader/components/footerbar/NavigationBar.tsx @@ -5,34 +5,43 @@ import { RxSlider as SliderIcon } from 'react-icons/rx'; import { RiFontFamily as FontIcon } from 'react-icons/ri'; import { PiSun as ColorIcon } from 'react-icons/pi'; import { MdOutlineHeadphones as TTSIcon } from 'react-icons/md'; +import { useEnv } from '@/context/EnvContext'; import { useReaderStore } from '@/store/readerStore'; import { useTranslation } from '@/hooks/useTranslation'; import { useResponsiveSize } from '@/hooks/useResponsiveSize'; import Button from '@/components/Button'; +import { Insets } from '@/types/misc'; interface NavigationBarProps { bookKey: string; actionTab: string; - navPadding: string; + gridInsets: Insets; onSetActionTab: (tab: string) => void; } export const NavigationBar: React.FC = ({ bookKey, actionTab, - navPadding: mobileNavPadding, + gridInsets, onSetActionTab, }) => { + const isMobile = window.innerWidth < 640 || window.innerHeight < 640; const _ = useTranslation(); + const { appService } = useEnv(); const { getViewState } = useReaderStore(); const viewState = getViewState(bookKey); const tocIconSize = useResponsiveSize(23); const fontIconSize = useResponsiveSize(18); + const navPadding = isMobile ? `${gridInsets.bottom * 0.33 + 16}px` : '0px'; return (