The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 14:30 UTC
feat(mobile): add One UI navigation preference on Android (#25758)
Alex committed
Oct 27, 2026 at 09:24 UTC
dc84b0962efa4f4e05ef392c08986a9cd7c994d1
20 files changed
+511
-63
apps/mobile/modules/t3-native-controls/android/src/main/java/expo/modules/t3nativecontrols/T3WorkspaceNavigationModule.kt
+52
@@ -14,6 +14,7 @@ import androidx.compose.foundation.layout.WindowInsets
14
import androidx.compose.foundation.layout.fillMaxHeight
15
import androidx.compose.foundation.layout.fillMaxSize
16
import androidx.compose.foundation.layout.height
17
+import androidx.compose.foundation.layout.size
18
import androidx.compose.foundation.layout.padding
19
import androidx.compose.foundation.layout.width
20
import androidx.compose.foundation.selection.selectable
@@ -71,6 +72,11 @@ class T3WorkspaceNavigationModule : Module() {
72
Prop("selectedTab") { view: T3WorkspaceNavigationView, value: String ->
73
view.selectedTab = value
74
}
75
+ Prop("floating") { view: T3WorkspaceNavigationView, value: Boolean ->
76
+ view.floating = value
77
+ view.clipToPadding = !value
78
+ view.clipChildren = !value
79
+ }
80
Prop("rail") { view: T3WorkspaceNavigationView, value: Boolean -> view.rail = value }
81
Prop("dark") { view: T3WorkspaceNavigationView, value: Boolean -> view.dark = value }
82
Prop("textScale") { view: T3WorkspaceNavigationView, value: Float -> view.textScale = value }
@@ -123,6 +129,7 @@ class T3WorkspaceNavigationView(
129
var tabs by mutableStateOf(listOf("threads", "pullRequests", "usage", "settings"))
130
var selectedTab by mutableStateOf("threads")
131
var rail by mutableStateOf(false)
132
+ var floating by mutableStateOf(false)
133
var dark by mutableStateOf(false)
134
var textScale by mutableStateOf(1f)
135
var newEnabled by mutableStateOf(false)
@@ -161,6 +168,7 @@ class T3WorkspaceNavigationView(
168
init {
169
addView(
170
ComposeView(context).apply {
171
+ clipChildren = false
172
setViewCompositionStrategy(
173
ViewCompositionStrategy.DisposeOnDetachedFromWindowOrReleasedFromPool
174
)
@@ -168,6 +176,8 @@ class T3WorkspaceNavigationView(
176
MaterialTheme(colorScheme = if (dark) darkColorScheme() else lightColorScheme()) {
177
if (rail) {
178
rail()
179
+ } else if (floating) {
180
+ floatingTabs()
181
} else {
182
NavigationBar(
183
modifier = Modifier.fillMaxSize(),
@@ -199,6 +209,48 @@ class T3WorkspaceNavigationView(
209
)
210
}
211
212
+ @Composable
213
+ private fun floatingTabs() {
214
+ Surface(
215
+ modifier = Modifier.fillMaxSize().padding(8.dp),
216
+ shape = CircleShape,
217
+ color = Color(containerColor),
218
+ shadowElevation = 6.dp,
219
+ ) {
220
+ Row(
221
+ modifier = Modifier.fillMaxSize().selectableGroup(),
222
+ verticalAlignment = Alignment.CenterVertically,
223
+ ) {
224
+ tabs.forEach { tab ->
225
+ val selected = selectedTab == tab
226
+ val tint = Color(if (selected) selectedColor else unselectedColor)
227
+ Box(
228
+ modifier = Modifier
229
+ .weight(1f)
230
+ .fillMaxHeight()
231
+ .clip(CircleShape)
232
+ .selectable(
233
+ selected = selected,
234
+ role = Role.Tab,
235
+ onClick = { onTabSelected(mapOf("tab" to tab)) },
236
+ )
237
+ .semantics { contentDescription = expandedTabTitle(tab) }
238
+ .padding(4.dp)
239
+ .background(if (selected) Color(indicatorColor) else Color.Transparent, CircleShape),
240
+ contentAlignment = Alignment.Center,
241
+ ) {
242
+ Icon(
243
+ tabIconPainter(tab),
244
+ contentDescription = null,
245
+ modifier = Modifier.size((24 * textScale).dp),
246
+ tint = tint,
247
+ )
248
+ }
249
+ }
250
+ }
251
+ }
252
+ }
253
+
254
@Composable
255
private fun rail() {
256
// One rail surface widens in place over the list. Material's ModalWideNavigationRail
apps/mobile/src/features/home/AndroidHomeFab.android.tsx
+45
-8
@@ -1,4 +1,4 @@
1
-import { useCallback, useRef, useState, type ComponentProps } from "react";
1
+import { useCallback, useMemo, useRef, useState, type ComponentProps } from "react";
2
import {
3
useWindowDimensions,
4
View,
@@ -14,15 +14,41 @@ import {
14
import { useWorkspaceState } from "../../state/workspace";
15
import { FabScrollContext } from "./FabScrollContext";
16
import { updateFabScroll } from "./fab-scroll";
17
-import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
17
+import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing";
18
+import { useEnabledNavigationTabs } from "../workspace/navigation-tabs";
19
+import { WorkspaceTabsContext, useWorkspaceTabs } from "../workspace/WorkspaceTabsContext";
20
+import { FLOATING_TABS, floatingTabsMetrics } from "../workspace/floating-workspace-tabs";
21
+import {
22
+ useAppearancePreferences,
23
+ useAndroidFloatingTabs,
24
+} from "../settings/appearance/AppearancePreferencesProvider";
25
26
export function AndroidHomeFabLayout(props: ComponentProps<typeof SharedAndroidHomeFabLayout>) {
27
+ const floatingTabsEnabled = useAndroidFloatingTabs();
28
const insets = useSafeAreaInsets();
29
const { appearance } = useAppearancePreferences();
30
const { fontScale } = useWindowDimensions();
31
const [layoutWidth, setLayoutWidth] = useState<number | null>(null);
32
const { state } = useWorkspaceState();
33
const [expanded, setExpanded] = useState(true);
34
+ const { scale, fabSize } = useAndroidControlSizing();
35
+ const tabs = useEnabledNavigationTabs();
36
+ const floating = floatingTabsMetrics(
37
+ tabs.length + 1,
38
+ scale,
39
+ fabSize,
40
+ props.paneWidth ?? layoutWidth ?? undefined,
41
+ );
42
+ const workspace = useWorkspaceTabs();
43
+ const bottomClearance =
44
+ insets.bottom +
45
+ FLOATING_TABS.bottom +
46
+ FLOATING_TABS.edge +
47
+ Math.max(floating.height, floating.fabOffset + fabSize);
48
+ const context = useMemo(
49
+ () => (floatingTabsEnabled && workspace ? { ...workspace, bottomClearance } : workspace),
50
+ [floatingTabsEnabled, workspace, bottomClearance],
51
+ );
52
const scrollState = useRef({ anchor: 0, expanded: true });
53
const onScroll = useCallback((event: NativeSyntheticEvent<NativeScrollEvent>) => {
54
const { contentOffset, contentSize, layoutMeasurement } = event.nativeEvent;
@@ -36,19 +62,30 @@ export function AndroidHomeFabLayout(props: ComponentProps<typeof SharedAndroidH
62
}, []);
63
64
// Remount only the FAB when its font or pane changes to clear the cached expanded width.
39
- // The split-view sidebar has no FAB: the navigation rail carries New thread. On phones it
40
- // keeps Material's 16dp corner margin; the bottom bar already consumes the gesture inset.
65
+ // Floating navigation shares this row; Material split views put New thread in the rail.
66
return (
67
<View className="flex-1" onLayout={(event) => setLayoutWidth(event.nativeEvent.layout.width)}>
43
- <FabScrollContext value={onScroll}>{props.children}</FabScrollContext>
44
- {!props.disabled && !props.sidebar && state.hasConnections && layoutWidth !== null ? (
68
+ <WorkspaceTabsContext value={context}>
69
+ <FabScrollContext value={onScroll}>{props.children}</FabScrollContext>
70
+ </WorkspaceTabsContext>
71
+ {!props.disabled &&
72
+ (!props.sidebar || floatingTabsEnabled) &&
73
+ state.hasConnections &&
74
+ layoutWidth !== null ? (
75
<NewThreadButton
76
key={`${appearance.baseFontSize}:${fontScale}:${layoutWidth}`}
77
extended
48
- expanded={expanded}
78
+ expanded={floatingTabsEnabled ? false : expanded}
79
onPress={props.onStartNewTask}
80
className="absolute"
51
- style={androidHomeFabPosition(insets.bottom, props.sidebar)}
81
+ style={
82
+ floatingTabsEnabled
83
+ ? {
84
+ right: FLOATING_TABS.edge,
85
+ bottom: insets.bottom + FLOATING_TABS.bottom + floating.fabOffset,
86
+ }
87
+ : androidHomeFabPosition(insets.bottom, props.sidebar)
88
+ }
89
/>
90
) : null}
91
</View>
apps/mobile/src/features/home/AndroidHomeFab.shared.tsx
+1
@@ -5,6 +5,7 @@ export function AndroidHomeFabLayout(props: {
5
readonly children: ReactNode;
6
readonly sidebar?: boolean;
7
readonly disabled?: boolean;
8
+ readonly paneWidth?: number;
9
}) {
10
return <>{props.children}</>;
11
}
apps/mobile/src/features/home/ThreadUndoNotice.tsx
+5
-1
@@ -1,3 +1,4 @@
1
+import { useAndroidFloatingTabs } from "../settings/appearance/AppearancePreferencesProvider";
2
import { useState } from "react";
3
import { useKeyboardState } from "react-native-keyboard-controller";
4
import { Platform, View } from "react-native";
@@ -18,6 +19,7 @@ import {
19
} from "./thread-undo-notice";
20
21
export function ThreadUndoNotice(props: { readonly visible: boolean }) {
22
+ const floatingTabsEnabled = useAndroidFloatingTabs();
23
const notice = useThreadUndoNotice();
24
const insets = useSafeAreaInsets();
25
const columnMetrics = useNativeColumnLayoutMetrics();
@@ -64,7 +66,9 @@ export function ThreadUndoNotice(props: { readonly visible: boolean }) {
66
columnMetrics?.safeArea.bottom ?? 0,
67
(workspace?.bottomClearance ?? 0) - workspacePadding,
68
) + 8
67
- : insets.bottom + 12;
69
+ : floatingTabsEnabled && keyboardHeight === 0
70
+ ? Math.max(insets.bottom + 12, workspace?.bottomClearance ?? 0)
71
+ : insets.bottom + 12;
72
return (
73
<View
74
key={instance.key}
apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx
+80
-18
@@ -1,3 +1,4 @@
1
+import { useAndroidFloatingTabs } from "../settings/appearance/AppearancePreferencesProvider";
2
import { SafeAreaInsetsContext, useSafeAreaInsets } from "react-native-safe-area-context";
3
import { AdaptiveWorkspaceContext, useAdaptiveWorkspaceLayout } from "./adaptive-workspace-context";
4
import { threadSelectionDeferral } from "./deferred-navigation";
@@ -47,9 +48,13 @@ import {
48
parseActiveThreadPath,
49
useHardwareKeyboardCommand,
50
} from "../keyboard/hardwareKeyboardCommands";
51
+import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing";
52
+import { useEnabledNavigationTabs } from "../workspace/navigation-tabs";
53
+import { FLOATING_TABS, floatingTabsMetrics } from "../workspace/floating-workspace-tabs";
54
import { AndroidHomeFabLayout } from "../home/AndroidHomeFab";
55
import {
56
AndroidWorkspaceNavigation,
57
+ FloatingWorkspaceTabs,
58
ANDROID_WORKSPACE_RAIL_WIDTH,
59
} from "../workspace/AndroidWorkspaceNavigation";
60
import { AndroidWorkspaceSidebar } from "../workspace/AndroidWorkspaceSidebar";
@@ -168,6 +173,7 @@ function AdaptiveWorkspaceLayoutContent(
173
readonly savedThreadListFilters?: ThreadListFilters | undefined;
174
},
175
) {
176
+ const floatingTabsEnabled = useAndroidFloatingTabs();
177
const projectGroupingMode = props.projectGroupingMode;
178
const nativeWorkspace = use(NativeWorkspaceModeContext);
179
const windowDimensions = useWindowDimensions();
@@ -244,7 +250,11 @@ function AdaptiveWorkspaceLayoutContent(
250
const showPrimarySidebar =
251
!workspacePage &&
252
(primarySidebarPinned || (preferredSidebarVisible && !composerKeyboardActive));
247
- const shouldRenderNavigationRail = Platform.OS === "android" && baseLayout.usesSplitView;
253
+ const shouldRenderNavigationRail =
254
+ Platform.OS === "android" && baseLayout.usesSplitView && !floatingTabsEnabled;
255
+ const enabledTabs = useEnabledNavigationTabs();
256
+ const { scale, fabSize } = useAndroidControlSizing();
257
+ const floatingTabs = floatingTabsMetrics(enabledTabs.length + 1, scale, fabSize);
258
const navigationRailWidth =
259
shouldRenderNavigationRail && (showPrimarySidebar || workspacePage)
260
? ANDROID_WORKSPACE_RAIL_WIDTH
@@ -255,16 +265,31 @@ function AdaptiveWorkspaceLayoutContent(
265
setHinge(next);
266
setWindowHinge(nextWindow);
267
};
258
- const layout = useMemo(
259
- () =>
260
- alignListPaneToHinge({
261
- layout: baseLayout,
262
- hinge,
263
- viewportWidth,
264
- leadingWidth: navigationRailWidth,
265
- }),
266
- [baseLayout, hinge, navigationRailWidth, viewportWidth],
267
- );
268
+ const layout = useMemo(() => {
269
+ const aligned = alignListPaneToHinge({
270
+ layout: baseLayout,
271
+ hinge,
272
+ viewportWidth,
273
+ leadingWidth: navigationRailWidth,
274
+ });
275
+ if (
276
+ !floatingTabsEnabled ||
277
+ !aligned.usesSplitView ||
278
+ aligned.listPaneGap !== undefined ||
279
+ aligned.listPaneWidth === null ||
280
+ aligned.listPaneWidth >= floatingTabs.row ||
281
+ viewportWidth - floatingTabs.row < 320
282
+ )
283
+ return aligned;
284
+ return { ...aligned, listPaneWidth: floatingTabs.row };
285
+ }, [
286
+ baseLayout,
287
+ hinge,
288
+ navigationRailWidth,
289
+ viewportWidth,
290
+ floatingTabs.row,
291
+ floatingTabsEnabled,
292
+ ]);
293
const width = viewportWidth - navigationRailWidth;
294
// The sidebar stays mounted under a workspace page, so its list is ready on the way back.
295
const shouldRenderPrimarySidebar = layout.usesSplitView;
@@ -733,7 +758,10 @@ function AdaptiveWorkspaceLayoutContent(
758
}));
759
const sidebarAnimatedStyle = useAnimatedStyle(() => ({
760
// Fading a UIKit glass ancestor can leave remounted header effects missing.
736
- opacity: Platform.OS === "ios" ? 1 : Math.min(1, renderedSidebarWidth.value / 80),
761
+ opacity:
762
+ Platform.OS === "ios" || floatingTabsEnabled
763
+ ? 1
764
+ : Math.min(1, renderedSidebarWidth.value / 80),
765
width: renderedSidebarWidth.value,
766
}));
767
@@ -829,12 +857,12 @@ function AdaptiveWorkspaceLayoutContent(
857
{shouldRenderPrimarySidebar && layout.listPaneWidth !== null ? (
858
<Animated.View
859
className="self-stretch overflow-hidden"
832
- accessibilityElementsHidden={!panes.primarySidebarVisible}
860
+ accessibilityElementsHidden={workspacePage || !panes.primarySidebarVisible}
861
collapsable={false}
862
importantForAccessibility={
835
- panes.primarySidebarVisible ? "auto" : "no-hide-descendants"
863
+ !workspacePage && panes.primarySidebarVisible ? "auto" : "no-hide-descendants"
864
}
837
- pointerEvents={panes.primarySidebarVisible ? "auto" : "none"}
865
+ pointerEvents={!workspacePage && panes.primarySidebarVisible ? "auto" : "none"}
866
// Under a workspace page the sidebar leaves the row but keeps its size, so its
867
// lists never lay out at zero size and are ready, unchanged, on the way back. The
868
// content pane, laid out after it, covers it, in the same mount as the page.
@@ -857,7 +885,12 @@ function AdaptiveWorkspaceLayoutContent(
885
onRequestVisibility={revealPrimarySidebar}
886
selectedPullRequestKey={props.selectedPullRequestKey ?? null}
887
>
860
- <AndroidHomeFabLayout sidebar onStartNewTask={handleStartNewTask}>
888
+ <AndroidHomeFabLayout
889
+ sidebar
890
+ disabled={workspacePage}
891
+ paneWidth={layout.listPaneWidth}
892
+ onStartNewTask={handleStartNewTask}
893
+ >
894
<ThreadNavigationSidebar
895
width={layout.listPaneWidth}
896
visible={panes.primarySidebarVisible}
@@ -876,6 +909,14 @@ function AdaptiveWorkspaceLayoutContent(
909
</AndroidHomeFabLayout>
910
</AndroidWorkspaceSidebar>
911
</RenderErrorBoundary>
912
+ {/* Keep the pill under the content throughout the sidebar's clipping animation. */}
913
+ {floatingTabsEnabled && !workspacePage ? (
914
+ <FloatingWorkspaceTabs
915
+ paneWidth={layout.listPaneWidth}
916
+ onNewThread={handleStartNewTask}
917
+ onSelect={revealPrimarySidebar}
918
+ />
919
+ ) : null}
920
</Animated.View>
921
</Animated.View>
922
) : null}
@@ -913,14 +954,35 @@ function AdaptiveWorkspaceLayoutContent(
954
{/* Compact Settings keeps the bottom navigation under all of its pages. */}
955
<SafeAreaInsetsContext
956
value={
916
- compactAndroidSettings ? { ...safeAreaInsets, bottom: 0 } : safeAreaInsets
957
+ floatingTabsEnabled &&
958
+ (compactAndroidSettings || (layout.usesSplitView && workspacePage))
959
+ ? {
960
+ ...safeAreaInsets,
961
+ bottom:
962
+ safeAreaInsets.bottom +
963
+ FLOATING_TABS.bottom +
964
+ FLOATING_TABS.edge +
965
+ floatingTabs.height,
966
+ }
967
+ : compactAndroidSettings
968
+ ? { ...safeAreaInsets, bottom: 0 }
969
+ : safeAreaInsets
970
}
971
>
972
<View className="flex-1">
973
<SettingsWorkspaceLayout>{props.children}</SettingsWorkspaceLayout>
974
</View>
975
</SafeAreaInsetsContext>
923
- {compactAndroidSettings ? (
976
+ {floatingTabsEnabled &&
977
+ (compactAndroidSettings || (layout.usesSplitView && workspacePage)) ? (
978
+ <FloatingWorkspaceTabs
979
+ paneWidth={
980
+ layout.usesSplitView ? (layout.listPaneWidth ?? undefined) : undefined
981
+ }
982
+ fillWidth={compactAndroidSettings}
983
+ onNewThread={handleStartNewTask}
984
+ />
985
+ ) : compactAndroidSettings ? (
986
<AndroidWorkspaceNavigation onNewThread={handleStartNewTask} />
987
) : null}
988
</WorkspaceSettledContentWidthContext>
apps/mobile/src/features/settings/SettingsAppearanceRouteScreen.tsx
+3
@@ -1,3 +1,5 @@
1
+import { Platform } from "react-native";
2
+import { AndroidNavigationAppearanceSection } from "./appearance/sections/AndroidNavigationAppearanceSection";
3
import { ScreenScrollView as ScrollView } from "../../components/ui/ScreenScrollView";
4
import { useSafeAreaInsets } from "react-native-safe-area-context";
5
@@ -22,6 +24,7 @@ export function SettingsAppearanceRouteScreen() {
24
}}
25
>
26
<ThemeAppearanceSection />
27
+ {Platform.OS === "android" ? <AndroidNavigationAppearanceSection /> : null}
28
<TextAppearanceSection />
29
<TerminalAppearanceSection />
30
<CodeAppearanceSection />
apps/mobile/src/features/settings/appearance/AppearancePreferencesProvider.tsx
+27
@@ -1,6 +1,12 @@
1
import { createContext, startTransition, use, useCallback, useMemo, type ReactNode } from "react";
2
import { AppState, Appearance, Platform, useColorScheme } from "react-native";
3
4
+import { manufacturer } from "expo-device";
5
+import {
6
+ resolveAndroidNavigationStyle,
7
+ type AndroidNavigationStyle,
8
+} from "../../../lib/androidNavigationStyle";
9
+
10
import { useAtomSet, useAtomValue } from "@effect/atom-react";
11
import { Atom, AsyncResult } from "effect/reactivity";
12
@@ -43,6 +49,8 @@ interface AppearancePreferencesContextValue {
49
readonly themeId: MobileThemeId;
50
readonly themeIds: MobileThemeIds;
51
readonly themeMode: MobileThemeMode;
52
+ readonly androidNavigationStyle: AndroidNavigationStyle;
53
+ readonly setAndroidNavigationStyle: (value: AndroidNavigationStyle) => void;
54
readonly themeAppearance: MobileThemeAppearance;
55
readonly systemColorsAvailable: boolean;
56
readonly systemColorsActive: boolean;
@@ -188,6 +196,11 @@ export function AppearancePreferencesProvider(props: { readonly children: ReactN
196
() => resolveAppearancePreferences(storedPreferences),
197
[storedPreferences],
198
);
199
+ const androidNavigationStyle = resolveAndroidNavigationStyle(
200
+ storedPreferences?.androidNavigationStyle,
201
+ manufacturer,
202
+ process.env.EXPO_PUBLIC_T3_FLOATING_TABS === "1",
203
+ );
204
const themeMode = normalizeMobileThemeMode(storedPreferences?.themeMode);
205
const themeAppearance = themeMode === "system" ? systemColorScheme : themeMode;
206
const resolvedThemeIds = resolveMobileThemeIds(storedPreferences ?? {});
@@ -271,6 +284,11 @@ export function AppearancePreferencesProvider(props: { readonly children: ReactN
284
[updateThemePreferences],
285
);
286
287
+ const setAndroidNavigationStyle = useCallback(
288
+ (value: AndroidNavigationStyle) => updatePreferences({ androidNavigationStyle: value }),
289
+ [updatePreferences],
290
+ );
291
+
292
const setBaseFontSize = useCallback(
293
(value: number) => {
294
applyThemeRuntime({ ...currentRuntimeState(), baseFontSize: value });
@@ -312,6 +330,8 @@ export function AppearancePreferencesProvider(props: { readonly children: ReactN
330
themeId,
331
themeIds,
332
themeMode,
333
+ androidNavigationStyle,
334
+ setAndroidNavigationStyle,
335
themeAppearance,
336
systemColorsAvailable: isSystemColorsAvailable,
337
systemColorsActive,
@@ -334,6 +354,8 @@ export function AppearancePreferencesProvider(props: { readonly children: ReactN
354
themeId,
355
themeIds,
356
themeMode,
357
+ androidNavigationStyle,
358
+ setAndroidNavigationStyle,
359
themeAppearance,
360
systemColorsActive,
361
themeVariables,
@@ -368,3 +390,8 @@ export function useAppearancePreferences(): AppearancePreferencesContextValue {
390
}
391
return context;
392
}
393
+
394
+export function useAndroidFloatingTabs() {
395
+ const { androidNavigationStyle } = useAppearancePreferences();
396
+ return Platform.OS === "android" && androidNavigationStyle === "one-ui";
397
+}
apps/mobile/src/features/settings/appearance/sections/AndroidNavigationAppearanceSection.tsx
new
+30
@@ -0,0 +1,30 @@
1
+import { View } from "react-native";
2
+
3
+import { SettingsChoiceRow } from "../../components/SettingsChoiceRow";
4
+import { SettingsSection } from "../../components/SettingsSection";
5
+import { useAppearancePreferences } from "../AppearancePreferencesProvider";
6
+
7
+export function AndroidNavigationAppearanceSection() {
8
+ const { isReady, androidNavigationStyle, setAndroidNavigationStyle } = useAppearancePreferences();
9
+ return (
10
+ <SettingsSection title="Navigation">
11
+ <View accessibilityRole="radiogroup">
12
+ <SettingsChoiceRow
13
+ label="One UI"
14
+ description="Floating navigation with a separate compose button."
15
+ disabled={!isReady}
16
+ selected={androidNavigationStyle === "one-ui"}
17
+ onPress={() => setAndroidNavigationStyle("one-ui")}
18
+ />
19
+ <SettingsChoiceRow
20
+ label="Material"
21
+ description="Standard Android navigation bar and side rail."
22
+ disabled={!isReady}
23
+ selected={androidNavigationStyle === "material"}
24
+ onPress={() => setAndroidNavigationStyle("material")}
25
+ separated
26
+ />
27
+ </View>
28
+ </SettingsSection>
29
+ );
30
+}
apps/mobile/src/features/threads/ThreadComposer.tsx
+7
-3
@@ -3,7 +3,10 @@ import { Button } from "../../components/ui/Button";
3
import * as Dialog from "../../components/ui/Dialog";
4
import type { ComposerTextPaste } from "../../native/T3ComposerEditor.types";
5
import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
6
-import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
6
+import {
7
+ useAppearancePreferences,
8
+ useAndroidFloatingTabs,
9
+} from "../settings/appearance/AppearancePreferencesProvider";
10
import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell";
11
import { settlePromise, squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime";
12
import { AsyncResult } from "effect/reactivity";
@@ -561,7 +564,8 @@ export const ThreadComposer = function ThreadComposer(props: ThreadComposerProps
564
);
565
const isVoiceInputPresented = voicePresentation.statusLabel !== null;
566
const isExpanded = isFocused || settingsSheetPresentation.keepsComposerExpanded;
564
- const { setComposerEditing } = useAdaptiveWorkspaceLayout();
567
+ const { layout, setComposerEditing } = useAdaptiveWorkspaceLayout();
568
+ const floatingSidebarComposer = useAndroidFloatingTabs() && layout.usesSplitView;
569
const usesLargeControls =
570
useSidebarWorkspaceTabs() === "picker" || (Platform.OS === "ios" && Platform.isPad);
571
const [compactRowWidth, setCompactRowWidth] = useState(0);
@@ -856,7 +860,7 @@ export const ThreadComposer = function ThreadComposer(props: ThreadComposerProps
860
borderRadius: usesLargeControls ? 31 : 27,
861
borderCurve: "circular",
862
overflow: "hidden",
859
- paddingVertical: usesLargeControls ? 9 : 2,
863
+ paddingVertical: usesLargeControls ? 9 : floatingSidebarComposer ? 6 : 2,
864
}}
865
>
866
{isExpanded ? editingAttachments : null}
apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx
+15
-3
@@ -2,7 +2,10 @@ import { useActiveNewTask } from "../../state/active-new-task";
2
import { ThreadUndoNotice } from "../home/ThreadUndoNotice";
3
import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing";
4
import { resolveScratchProjectScopeKey } from "@t3tools/client-runtime/state/project-grouping";
5
-import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
5
+import {
6
+ useAppearancePreferences,
7
+ useAndroidFloatingTabs,
8
+} from "../settings/appearance/AppearancePreferencesProvider";
9
import type {
10
EnvironmentProject,
11
EnvironmentThreadShell,
@@ -17,6 +20,8 @@ import type { LayoutChangeEvent, TextInputInstance } from "react-native";
20
import { Platform, StyleSheet, TextInput, View } from "react-native";
21
import { GestureDetector, useNativeGesture } from "react-native-gesture-handler";
22
import type { SwipeableMethods } from "react-native-gesture-handler/ReanimatedSwipeable";
23
+import { useEnabledNavigationTabs } from "../workspace/navigation-tabs";
24
+import { FLOATING_TABS, floatingTabsMetrics } from "../workspace/floating-workspace-tabs";
25
import { useSafeAreaInsets } from "react-native-safe-area-context";
26
import type { SearchBarCommands } from "react-native-screens";
27
@@ -133,11 +138,14 @@ function NativeSidebarContainer(props: ThreadNavigationSidebarProps) {
138
function ThreadNavigationSidebarPane(
139
props: ThreadNavigationSidebarProps & { readonly nativeChrome: boolean },
140
) {
141
+ const floatingTabsEnabled = useAndroidFloatingTabs();
142
const { themeVariables: materialTheme } = useAppearancePreferences();
143
const drawerColor = materialTheme["--color-drawer"];
144
145
const insets = useSafeAreaInsets();
140
- const { fabClearance } = useAndroidControlSizing();
146
+ const { fabClearance, scale, fabSize } = useAndroidControlSizing();
147
+ const enabledTabs = useEnabledNavigationTabs();
148
+ const floatingTabs = floatingTabsMetrics(enabledTabs.length + 1, scale, fabSize, props.width);
149
const projects = useProjects();
150
const threads = useNavigationThreadShells();
151
const { environments: workspaceEnvironments, state: catalogState } = useWorkspaceState();
@@ -809,7 +817,11 @@ function ThreadNavigationSidebarPane(
817
{
818
paddingBottom:
819
Platform.OS === "android"
812
- ? Math.max(insets.bottom, 16) + fabClearance - insets.bottom
820
+ ? floatingTabsEnabled
821
+ ? FLOATING_TABS.bottom +
822
+ FLOATING_TABS.edge +
823
+ Math.max(floatingTabs.height, floatingTabs.fabOffset + fabSize)
824
+ : Math.max(insets.bottom, 16) + fabClearance - insets.bottom
825
: 16 + insets.bottom,
826
paddingTop: Platform.OS === "android" ? 6 : topListInset,
827
},
apps/mobile/src/features/workspace/AndroidWorkspaceNavigation.android.tsx
+58
-5
@@ -4,6 +4,7 @@ import { CommonActions, useNavigation } from "@react-navigation/native";
4
import {
5
Keyboard,
6
processColor,
7
+ useWindowDimensions,
8
View,
9
type NativeSyntheticEvent,
10
type ViewProps,
@@ -24,12 +25,14 @@ import { useAppearancePreferences } from "../settings/appearance/AppearancePrefe
25
import { useAndroidWorkspaceRoot } from "./AndroidWorkspaceTabsProvider";
26
import { useNavigationTabOrder, useHiddenNavigationTabs } from "./navigation-tabs";
27
import { useWorkspaceTabs } from "./WorkspaceTabsContext";
28
+import { FLOATING_TABS, floatingTabsMetrics } from "./floating-workspace-tabs";
29
30
// Matches RAIL_WIDTH in the native rail.
31
export const ANDROID_WORKSPACE_RAIL_WIDTH = 72;
32
33
interface NativeNavigationProps extends ViewProps {
34
readonly rail: boolean;
35
+ readonly floating: boolean;
36
readonly tabs: readonly string[];
37
readonly selectedTab: AndroidWorkspaceNavigationTab;
38
readonly dark: boolean;
@@ -61,6 +64,9 @@ function nativeColor(value: string) {
64
export function AndroidWorkspaceNavigation(props: {
65
readonly onNewThread: () => void;
66
readonly rail?: boolean;
67
+ readonly floating?: boolean;
68
+ readonly fillWidth?: boolean;
69
+ readonly paneWidth?: number;
70
readonly onSelect?: () => void;
71
/** The rail needs the whole workspace while it widens over the list. */
72
readonly onOverlayChange?: (overlay: boolean) => void;
@@ -75,10 +81,20 @@ export function AndroidWorkspaceNavigation(props: {
81
const connectionState = useWorkspaceConnectionState();
82
const keyboardVisible = useKeyboardState((state) => state.isVisible);
83
const { themeAppearance, themeVariables: colors } = useAppearancePreferences();
78
- const { scale } = useAndroidControlSizing();
84
+ const { scale, fabSize } = useAndroidControlSizing();
85
+ const window = useWindowDimensions();
86
const rail = Boolean(props.rail);
87
+ const floating = !rail && Boolean(props.floating);
88
+ const tabs = [...visibleNavigationTabs(order, hidden, rail ? 5 : 4), "settings"];
89
+ const metrics = floatingTabsMetrics(
90
+ tabs.length,
91
+ scale,
92
+ fabSize,
93
+ props.paneWidth ?? window.width,
94
+ props.fillWidth,
95
+ );
96
const { containerColor, indicatorColor, selectedColor, unselectedColor } =
81
- androidWorkspaceNavigationColors(colors, rail);
97
+ androidWorkspaceNavigationColors(colors, rail, floating);
98
const selectedTab = selectedNavigationTab(
99
order,
100
workspace.state.selectedTab,
@@ -93,12 +109,17 @@ export function AndroidWorkspaceNavigation(props: {
109
style={
110
// The rail draws its own surface and pads the system bars; while open it spans the
111
// workspace, so the rest of it must stay transparent.
96
- rail ? { flex: 1 } : { backgroundColor: containerColor, paddingBottom: insets.bottom }
112
+ rail
113
+ ? { flex: 1 }
114
+ : floating
115
+ ? undefined
116
+ : { backgroundColor: containerColor, paddingBottom: insets.bottom }
117
}
118
>
119
<NativeNavigation
120
rail={rail}
101
- tabs={[...visibleNavigationTabs(order, hidden, rail ? 5 : 4), "settings"]}
121
+ floating={floating}
122
+ tabs={tabs}
123
selectedTab={selectedTab}
124
dark={themeAppearance === "dark"}
125
textScale={scale}
@@ -133,8 +154,40 @@ export function AndroidWorkspaceNavigation(props: {
154
props.onNewThread();
155
}}
156
onOverlayChange={(event) => props.onOverlayChange?.(event.nativeEvent.overlay)}
136
- style={rail ? { flex: 1 } : { height: 80 * Math.max(1, scale) }}
157
+ style={
158
+ rail
159
+ ? { flex: 1 }
160
+ : floating
161
+ ? {
162
+ width: metrics.pill + 2 * FLOATING_TABS.shadow,
163
+ height: metrics.height + 2 * FLOATING_TABS.shadow,
164
+ }
165
+ : { height: 80 * Math.max(1, scale) }
166
+ }
167
/>
168
</View>
169
);
170
}
171
+
172
+export function FloatingWorkspaceTabs(props: {
173
+ readonly fillWidth?: boolean;
174
+ readonly onNewThread: () => void;
175
+ readonly paneWidth?: number;
176
+ readonly onSelect?: () => void;
177
+}) {
178
+ const insets = useSafeAreaInsets();
179
+ return (
180
+ <View
181
+ pointerEvents="box-none"
182
+ style={{
183
+ position: "absolute",
184
+ left: Math.max(insets.left, FLOATING_TABS.edge) - FLOATING_TABS.shadow,
185
+ right: 0,
186
+ bottom: insets.bottom + FLOATING_TABS.bottom - FLOATING_TABS.shadow,
187
+ alignItems: "flex-start",
188
+ }}
189
+ >
190
+ <AndroidWorkspaceNavigation {...props} floating />
191
+ </View>
192
+ );
193
+}
apps/mobile/src/features/workspace/AndroidWorkspaceNavigation.tsx
+12
@@ -1,6 +1,9 @@
1
export function AndroidWorkspaceNavigation(_props: {
2
readonly onNewThread: () => void;
3
readonly rail?: boolean;
4
+ readonly floating?: boolean;
5
+ readonly fillWidth?: boolean;
6
+ readonly paneWidth?: number;
7
readonly onSelect?: () => void;
8
readonly onOverlayChange?: (overlay: boolean) => void;
9
}) {
@@ -8,3 +11,12 @@ export function AndroidWorkspaceNavigation(_props: {
11
}
12
13
export const ANDROID_WORKSPACE_RAIL_WIDTH = 72;
14
+
15
+export function FloatingWorkspaceTabs(_props: {
16
+ readonly fillWidth?: boolean;
17
+ readonly onNewThread: () => void;
18
+ readonly paneWidth?: number;
19
+ readonly onSelect?: () => void;
20
+}) {
21
+ return null;
22
+}
apps/mobile/src/features/workspace/AndroidWorkspaceSidebar.android.tsx
+12
-1
@@ -1,7 +1,11 @@
1
+import { useAndroidFloatingTabs } from "../settings/appearance/AppearancePreferencesProvider";
2
import { WorkspaceNoTabs } from "./WorkspaceNoTabs";
3
import { useEnabledNavigationTabs } from "./navigation-tabs";
4
import { NAVIGATION_TAB_ORDER } from "./navigation-tab-order";
5
import { useMemo, type ReactNode } from "react";
6
+import { useSafeAreaInsets } from "react-native-safe-area-context";
7
+import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing";
8
+import { FLOATING_TABS, floatingTabsMetrics } from "./floating-workspace-tabs";
9
import { View } from "react-native";
10
import { ScreenContent } from "../../components/ui/ScreenContent";
11
import { PullRequestsScreen } from "../pull-requests/PullRequestsScreen";
@@ -14,9 +18,16 @@ export function AndroidWorkspaceSidebar(props: {
18
readonly onRequestVisibility: () => void;
19
readonly selectedPullRequestKey: string | null;
20
}) {
21
+ const floatingTabsEnabled = useAndroidFloatingTabs();
22
const workspace = useWorkspaceTabs()!;
23
const enabled = useEnabledNavigationTabs();
19
- const context = useMemo(() => ({ ...workspace, bottomClearance: 16 }), [workspace]);
24
+ const insets = useSafeAreaInsets();
25
+ const { scale, fabSize } = useAndroidControlSizing();
26
+ const floating = floatingTabsMetrics(enabled.length + 1, scale, fabSize);
27
+ const bottomClearance = floatingTabsEnabled
28
+ ? insets.bottom + FLOATING_TABS.bottom + FLOATING_TABS.edge + floating.height
29
+ : 16;
30
+ const context = useMemo(() => ({ ...workspace, bottomClearance }), [workspace, bottomClearance]);
31
if (enabled.length === 0) return <WorkspaceNoTabs />;
32
return (
33
<WorkspaceTabPanes
apps/mobile/src/features/workspace/WorkspaceRootScreen.android.tsx
+42
-7
@@ -1,9 +1,10 @@
1
+import { useAndroidFloatingTabs } from "../settings/appearance/AppearancePreferencesProvider";
2
import { WorkspaceNoTabs } from "./WorkspaceNoTabs";
3
import { useEnabledNavigationTabs } from "./navigation-tabs";
4
import { NAVIGATION_TAB_ORDER } from "./navigation-tab-order";
5
import { WorkspaceExtraTab } from "./WorkspaceExtraTab";
6
import { useMemo } from "react";
6
-import { View } from "react-native";
7
+import { useWindowDimensions, View } from "react-native";
8
import { SafeAreaInsetsContext, useSafeAreaInsets } from "react-native-safe-area-context";
9
import { NativeStackScreenOptions } from "../../native/StackHeader";
10
import { AndroidScreenHeader } from "../../components/ui/AndroidScreenHeader";
@@ -14,7 +15,8 @@ import { HomeRouteScreen } from "../home/HomeRouteScreen";
15
import { PullRequestsScreen } from "../pull-requests/PullRequestsScreen";
16
import { PullRequestToolbar } from "../pull-requests/PullRequestToolbar.android";
17
import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
17
-import { AndroidWorkspaceNavigation } from "./AndroidWorkspaceNavigation";
18
+import { AndroidWorkspaceNavigation, FloatingWorkspaceTabs } from "./AndroidWorkspaceNavigation";
19
+import { FLOATING_TABS, floatingTabsMetrics } from "./floating-workspace-tabs";
20
import { WorkspaceTabsContext, useWorkspaceTabs } from "./WorkspaceTabsContext";
21
import { WorkspaceTabPanes } from "./WorkspaceTabPanes";
22
import type { WorkspaceTab } from "./workspace-tabs-state";
@@ -22,17 +24,38 @@ import type { WorkspaceTab } from "./workspace-tabs-state";
24
const TABS: readonly WorkspaceTab[] = NAVIGATION_TAB_ORDER;
25
26
export function WorkspaceRootScreen() {
27
+ const floatingTabsEnabled = useAndroidFloatingTabs();
28
const { layout, startNewTask } = useAdaptiveWorkspaceLayout();
29
const workspace = useWorkspaceTabs()!;
30
const enabled = useEnabledNavigationTabs();
31
const insets = useSafeAreaInsets();
29
- const { fabClearance } = useAndroidControlSizing();
32
+ const { fabClearance, scale, fabSize } = useAndroidControlSizing();
33
+ const window = useWindowDimensions();
34
+ const floating = floatingTabsMetrics(enabled.length + 1, scale, fabSize, window.width);
35
const context = useMemo(
36
() => ({
37
...workspace,
33
- bottomClearance: workspace.state.selectedTab === "threads" ? fabClearance + 16 : 16,
38
+ bottomClearance: floatingTabsEnabled
39
+ ? insets.bottom +
40
+ FLOATING_TABS.bottom +
41
+ FLOATING_TABS.edge +
42
+ Math.max(
43
+ floating.height,
44
+ workspace.state.selectedTab === "threads" ? floating.fabOffset + fabSize : 0,
45
+ )
46
+ : workspace.state.selectedTab === "threads"
47
+ ? fabClearance + 16
48
+ : 16,
49
}),
35
- [workspace, fabClearance],
50
+ [
51
+ floatingTabsEnabled,
52
+ workspace,
53
+ fabClearance,
54
+ insets.bottom,
55
+ floating.height,
56
+ floating.fabOffset,
57
+ fabSize,
58
+ ],
59
);
60
const tab = workspace.state.selectedTab;
61
@@ -69,7 +92,15 @@ export function WorkspaceRootScreen() {
92
<WorkspaceTabsContext value={context}>
93
<View className="flex-1 bg-header">
94
<NativeStackScreenOptions options={{ headerShown: false }} />
72
- <SafeAreaInsetsContext value={{ ...insets, bottom: 0 }}>
95
+ <SafeAreaInsetsContext
96
+ value={
97
+ floatingTabsEnabled
98
+ ? tab === "usage"
99
+ ? { ...insets, bottom: context.bottomClearance }
100
+ : insets
101
+ : { ...insets, bottom: 0 }
102
+ }
103
+ >
104
{enabled.length === 0 ? (
105
<WorkspaceNoTabs />
106
) : (
@@ -95,7 +126,11 @@ export function WorkspaceRootScreen() {
126
/>
127
)}
128
</SafeAreaInsetsContext>
98
- <AndroidWorkspaceNavigation onNewThread={startNewTask} />
129
+ {floatingTabsEnabled ? (
130
+ <FloatingWorkspaceTabs fillWidth onNewThread={startNewTask} />
131
+ ) : (
132
+ <AndroidWorkspaceNavigation onNewThread={startNewTask} />
133
+ )}
134
</View>
135
</WorkspaceTabsContext>
136
);
apps/mobile/src/features/workspace/android-workspace-navigation-colors.test.ts
+19
-14
@@ -34,19 +34,20 @@ function expectVisibleSelection(colors: ReturnType<typeof androidWorkspaceNaviga
34
}
35
36
describe("Android workspace navigation colors", () => {
37
- it.each(MOBILE_THEME_IDS)(
38
- "keeps %s selection visible in both navigation positions",
39
- (themeId) => {
40
- for (const appearance of ["light", "dark"] as const) {
41
- const variables = getMobileThemeRuntimeVariables(themeId, appearance, "android");
42
- const snapshot = { ...variables };
43
- for (const rail of [false, true]) {
44
- expectVisibleSelection(androidWorkspaceNavigationColors(variables, rail));
45
- }
46
- expect(variables).toEqual(snapshot);
37
+ it.each(MOBILE_THEME_IDS)("keeps %s selection visible in every navigation layout", (themeId) => {
38
+ for (const appearance of ["light", "dark"] as const) {
39
+ const variables = getMobileThemeRuntimeVariables(themeId, appearance, "android");
40
+ const snapshot = { ...variables };
41
+ for (const [rail, floating] of [
42
+ [false, false],
43
+ [true, false],
44
+ [false, true],
45
+ ] as const) {
46
+ expectVisibleSelection(androidWorkspaceNavigationColors(variables, rail, floating));
47
}
48
- },
49
- );
48
+ expect(variables).toEqual(snapshot);
49
+ }
50
+ });
51
52
it.each(["#6750a4", "#9c4146"])(
53
"keeps Material You selection visible for system seed %s",
@@ -90,8 +91,12 @@ describe("Android workspace navigation colors", () => {
91
appearance,
92
getMobileThemeRuntimeVariables("material-you", appearance, "android"),
93
);
93
- for (const rail of [false, true]) {
94
- expectVisibleSelection(androidWorkspaceNavigationColors(variables, rail));
94
+ for (const [rail, floating] of [
95
+ [false, false],
96
+ [true, false],
97
+ [false, true],
98
+ ] as const) {
99
+ expectVisibleSelection(androidWorkspaceNavigationColors(variables, rail, floating));
100
}
101
}
102
},
apps/mobile/src/features/workspace/android-workspace-navigation-colors.ts
+14
-3
@@ -5,11 +5,17 @@ import {
5
type MobileThemeVariables,
6
} from "../../lib/mobileTheme";
7
8
-export function androidWorkspaceNavigationColors(colors: MobileThemeVariables, rail: boolean) {
8
+export function androidWorkspaceNavigationColors(
9
+ colors: MobileThemeVariables,
10
+ rail: boolean,
11
+ floating = false,
12
+) {
13
const header = flattenThemeColor(colors["--color-header"], colors["--color-screen"]);
14
const containerColor = rail
15
? header
12
- : flattenThemeColor(themeColorWithAlpha(colors["--color-header-foreground"], 0.05), header);
16
+ : floating
17
+ ? flattenThemeColor(colors["--color-secondary"], colors["--color-screen"])
18
+ : flattenThemeColor(themeColorWithAlpha(colors["--color-header-foreground"], 0.05), header);
19
const indicatorColor = themeColorWithContrast(
20
flattenThemeColor(colors["--color-secondary"], containerColor),
21
containerColor,
@@ -22,6 +28,11 @@ export function androidWorkspaceNavigationColors(colors: MobileThemeVariables, r
28
flattenThemeColor(colors["--color-secondary-foreground"], indicatorColor),
29
[indicatorColor, containerColor],
30
),
25
- unselectedColor: flattenThemeColor(colors["--color-header-foreground"], containerColor),
31
+ unselectedColor: floating
32
+ ? themeColorWithContrast(
33
+ flattenThemeColor(colors["--color-secondary-foreground"], containerColor),
34
+ containerColor,
35
+ )
36
+ : flattenThemeColor(colors["--color-header-foreground"], containerColor),
37
};
38
}
apps/mobile/src/features/workspace/floating-workspace-tabs.test.ts
new
+41
@@ -0,0 +1,41 @@
1
+import { expect, it } from "vite-plus/test";
2
+
3
+import { floatingTabsMetrics } from "./floating-workspace-tabs";
4
+import { resolveAndroidNavigationStyle } from "../../lib/androidNavigationStyle";
5
+
6
+it.each([
7
+ [undefined, "Samsung", false, "one-ui"],
8
+ [undefined, "samsung", false, "one-ui"],
9
+ [undefined, "Google", false, "material"],
10
+ [undefined, null, false, "material"],
11
+ [undefined, "Google", true, "one-ui"],
12
+ ["material", "Samsung", false, "material"],
13
+ ["one-ui", "Google", false, "one-ui"],
14
+ ["material", "Google", true, "material"],
15
+] as const)(
16
+ "resolves navigation preference %s on %s with preview %s",
17
+ (preference, manufacturer, preview, expected) => {
18
+ expect(resolveAndroidNavigationStyle(preference, manufacturer, preview)).toBe(expected);
19
+ },
20
+);
21
+
22
+it.each([
23
+ [475, 1, 56],
24
+ [411, 1, 56],
25
+ [475, 1.25, 70],
26
+] as const)(
27
+ "fills a %sdp cover row at scale %s with a %sdp compose button",
28
+ (width, scale, fabSize) => {
29
+ const metrics = floatingTabsMetrics(4, scale, fabSize, width, true);
30
+ expect(metrics.sharesRow).toBe(true);
31
+ expect(metrics.pill + 2 * 16 + 12 + fabSize).toBe(width);
32
+ expect(metrics.height).toBe(fabSize);
33
+ },
34
+);
35
+
36
+it("stacks compose above a full-width pill when a cover row is too narrow", () => {
37
+ const metrics = floatingTabsMetrics(4, 1, 56, 300, true);
38
+ expect(metrics.sharesRow).toBe(false);
39
+ expect(metrics.pill).toBe(268);
40
+ expect(metrics.fabOffset).toBe(68);
41
+});
apps/mobile/src/features/workspace/floating-workspace-tabs.ts
new
+30
@@ -0,0 +1,30 @@
1
+// Keep the native drawing inset out of the visible size and edge margins.
2
+export const FLOATING_TABS = { edge: 16, bottom: 6, gap: 12, shadow: 8 };
3
+
4
+export function floatingTabsMetrics(
5
+ count: number,
6
+ scale: number,
7
+ fabSize: number,
8
+ paneWidth?: number,
9
+ fillWidth = false,
10
+) {
11
+ const unit = Math.max(1, scale);
12
+ const height = fabSize;
13
+ const beside = 2 * FLOATING_TABS.edge + FLOATING_TABS.gap + fabSize;
14
+ const row = beside + count * 60 * unit;
15
+ const sharesRow = paneWidth === undefined || paneWidth >= row;
16
+ const room =
17
+ paneWidth === undefined
18
+ ? count * 60 * unit
19
+ : sharesRow
20
+ ? paneWidth - beside
21
+ : paneWidth - 2 * FLOATING_TABS.edge;
22
+ return {
23
+ // Reserve the compose slot even while its button is hidden.
24
+ pill: Math.max(0, fillWidth ? room : Math.min(count * 72 * unit, room)),
25
+ height,
26
+ row,
27
+ sharesRow,
28
+ fabOffset: sharesRow ? (height - fabSize) / 2 : height + FLOATING_TABS.gap,
29
+ };
30
+}
apps/mobile/src/lib/androidNavigationStyle.ts
new
+12
@@ -0,0 +1,12 @@
1
+export type AndroidNavigationStyle = "one-ui" | "material";
2
+
3
+export function resolveAndroidNavigationStyle(
4
+ preference: AndroidNavigationStyle | undefined,
5
+ manufacturer: string | null,
6
+ previewEnabled: boolean,
7
+): AndroidNavigationStyle {
8
+ return (
9
+ preference ??
10
+ (manufacturer?.toLowerCase() === "samsung" || previewEnabled ? "one-ui" : "material")
11
+ );
12
+}
apps/mobile/src/persistence/mobile-preferences.ts
+6
@@ -14,6 +14,7 @@ import {
14
type PullRequestMergeMethod,
15
type SidebarProjectGroupingMode,
16
} from "@t3tools/contracts";
17
+import type { AndroidNavigationStyle } from "../lib/androidNavigationStyle";
18
import type { ComposerEnterBehavior } from "../lib/composerEnterBehavior";
19
import type { FollowUpBehavior } from "../lib/followUpBehavior";
20
import { isMicrophoneKind, type MicrophoneEntry } from "../lib/microphonePriority";
@@ -95,6 +96,7 @@ export interface Preferences {
96
readonly lightThemeId?: MobileThemeId;
97
readonly darkThemeId?: MobileThemeId;
98
readonly themeMode?: MobileThemeMode;
99
+ readonly androidNavigationStyle?: AndroidNavigationStyle;
100
readonly baseFontSize?: number;
101
readonly terminalFontSize?: number | null;
102
readonly markdownFontSize?: number;
@@ -174,6 +176,7 @@ function sanitizePreferences(parsed: Preferences): Preferences {
176
lightThemeId?: MobileThemeId;
177
darkThemeId?: MobileThemeId;
178
themeMode?: MobileThemeMode;
179
+ androidNavigationStyle?: AndroidNavigationStyle;
180
baseFontSize?: number;
181
terminalFontSize?: number | null;
182
markdownFontSize?: number;
@@ -253,6 +256,9 @@ function sanitizePreferences(parsed: Preferences): Preferences {
256
) {
257
preferences.themeMode = parsed.themeMode;
258
}
259
+ if (parsed.androidNavigationStyle === "one-ui" || parsed.androidNavigationStyle === "material") {
260
+ preferences.androidNavigationStyle = parsed.androidNavigationStyle;
261
+ }
262
if (typeof parsed.baseFontSize === "number") preferences.baseFontSize = parsed.baseFontSize;
263
if (typeof parsed.terminalFontSize === "number" || parsed.terminalFontSize === null) {
264
preferences.terminalFontSize = parsed.terminalFontSize;