From cd61fefb21698ed5561c99e2b86ef9661e58fc15 Mon Sep 17 00:00:00 2001 From: James Babcock Date: Thu, 12 Nov 2026 12:16:33 -0800 Subject: [PATCH] Phone UI: Settings are a page instead of a tab, watch vs ring style input is a setting rather than a tab, EvenHub webview is a button with the main buttons rather than in the top bar --- .../com/faceclaw/app/PreviewBitmapUtil.kt | 2 +- ...b_keyboard.xml => ic_control_keyboard.xml} | 6 +- .../{ic_tab_mic.xml => ic_control_mic.xml} | 4 +- .../main/res/drawable/ic_control_settings.xml | 13 ++ .../Contents.json | 2 +- .../ic_control_keyboard@3x.png} | Bin .../Contents.json | 2 +- .../ic_control_mic@3x.png} | Bin .../Contents.json | 13 ++ .../ic_control_settings@3x.png | Bin 0 -> 1732 bytes app/app.css | 16 +- app/app.ios.css | 6 +- app/apps/evenhub/manager.ts | 14 +- app/g2/dashboard-controller.ts | 9 +- app/g2/glasses-display-state.ts | 2 +- app/g2/ios-preview-controller.ts | 2 +- app/native/gray-image-preview.ios.ts | 2 +- app/native/gray-image-preview.ts | 2 +- app/phone-ui/README.md | 23 ++- app/phone-ui/main-page.ios.ts | 46 ++--- app/phone-ui/main-page.xml | 23 +-- app/phone-ui/main-view-model.ts | 54 ++--- app/phone-ui/onboarding-register.ios.ts | 2 + app/phone-ui/remote-controls-view-model.ts | 180 ++++++----------- app/phone-ui/remote-controls.css | 93 +++------ app/phone-ui/remote-controls.xml | 98 ++++----- app/phone-ui/settings-page.css | 99 +++++++++ app/phone-ui/settings-page.ts | 22 ++ app/phone-ui/settings-page.xml | 54 +++++ app/phone-ui/settings-view-model.ts | 189 ++++++++++++++++++ app/ui/dashboard-settings.ts | 15 ++ app/ui/dashboard/settings-menus.ts | 3 + tests/ios-app-host.test.cjs | 5 +- tests/phone-settings-page.test.cjs | 170 ++++++++++++++++ tests/remote-controls.test.cjs | 106 +++++----- 35 files changed, 848 insertions(+), 429 deletions(-) rename App_Resources/Android/src/main/res/drawable/{ic_tab_keyboard.xml => ic_control_keyboard.xml} (72%) rename App_Resources/Android/src/main/res/drawable/{ic_tab_mic.xml => ic_control_mic.xml} (85%) create mode 100644 App_Resources/Android/src/main/res/drawable/ic_control_settings.xml rename App_Resources/iOS/Assets.xcassets/{ic_tab_keyboard.imageset => ic_control_keyboard.imageset}/Contents.json (74%) rename App_Resources/iOS/Assets.xcassets/{ic_tab_keyboard.imageset/ic_tab_keyboard@3x.png => ic_control_keyboard.imageset/ic_control_keyboard@3x.png} (100%) rename App_Resources/iOS/Assets.xcassets/{ic_tab_mic.imageset => ic_control_mic.imageset}/Contents.json (76%) rename App_Resources/iOS/Assets.xcassets/{ic_tab_mic.imageset/ic_tab_mic@3x.png => ic_control_mic.imageset/ic_control_mic@3x.png} (100%) create mode 100644 App_Resources/iOS/Assets.xcassets/ic_control_settings.imageset/Contents.json create mode 100644 App_Resources/iOS/Assets.xcassets/ic_control_settings.imageset/ic_control_settings@3x.png create mode 100644 app/phone-ui/settings-page.css create mode 100644 app/phone-ui/settings-page.ts create mode 100644 app/phone-ui/settings-page.xml create mode 100644 app/phone-ui/settings-view-model.ts create mode 100644 tests/phone-settings-page.test.cjs diff --git a/App_Resources/Android/src/main/java/com/faceclaw/app/PreviewBitmapUtil.kt b/App_Resources/Android/src/main/java/com/faceclaw/app/PreviewBitmapUtil.kt index 75135480..c7a53588 100644 --- a/App_Resources/Android/src/main/java/com/faceclaw/app/PreviewBitmapUtil.kt +++ b/App_Resources/Android/src/main/java/com/faceclaw/app/PreviewBitmapUtil.kt @@ -62,7 +62,7 @@ class PreviewBitmapUtil private constructor() { /** * A white-on-transparent bitmap of an 8bpp glasses icon (gray becomes * alpha; black, which the glasses show as unlit, is transparent), for - * showing glasses artwork on the phone's dark action bar. + * showing glasses artwork in the phone UI, which tints it to suit. */ @JvmStatic fun whiteIconFromGray(gray: ByteBuffer?, width: Int, height: Int): Bitmap { diff --git a/App_Resources/Android/src/main/res/drawable/ic_tab_keyboard.xml b/App_Resources/Android/src/main/res/drawable/ic_control_keyboard.xml similarity index 72% rename from App_Resources/Android/src/main/res/drawable/ic_tab_keyboard.xml rename to App_Resources/Android/src/main/res/drawable/ic_control_keyboard.xml index 4e531df8..95c0470a 100644 --- a/App_Resources/Android/src/main/res/drawable/ic_tab_keyboard.xml +++ b/App_Resources/Android/src/main/res/drawable/ic_control_keyboard.xml @@ -1,7 +1,7 @@ - + - + icon #1368757); base fill is overridden by tint-color in remote-controls.css. --> + + + + diff --git a/App_Resources/iOS/Assets.xcassets/ic_tab_keyboard.imageset/Contents.json b/App_Resources/iOS/Assets.xcassets/ic_control_keyboard.imageset/Contents.json similarity index 74% rename from App_Resources/iOS/Assets.xcassets/ic_tab_keyboard.imageset/Contents.json rename to App_Resources/iOS/Assets.xcassets/ic_control_keyboard.imageset/Contents.json index aae26278..b98be0ae 100644 --- a/App_Resources/iOS/Assets.xcassets/ic_tab_keyboard.imageset/Contents.json +++ b/App_Resources/iOS/Assets.xcassets/ic_control_keyboard.imageset/Contents.json @@ -2,7 +2,7 @@ "images": [ { "idiom": "universal", - "filename": "ic_tab_keyboard@3x.png", + "filename": "ic_control_keyboard@3x.png", "scale": "3x" } ], diff --git a/App_Resources/iOS/Assets.xcassets/ic_tab_keyboard.imageset/ic_tab_keyboard@3x.png b/App_Resources/iOS/Assets.xcassets/ic_control_keyboard.imageset/ic_control_keyboard@3x.png similarity index 100% rename from App_Resources/iOS/Assets.xcassets/ic_tab_keyboard.imageset/ic_tab_keyboard@3x.png rename to App_Resources/iOS/Assets.xcassets/ic_control_keyboard.imageset/ic_control_keyboard@3x.png diff --git a/App_Resources/iOS/Assets.xcassets/ic_tab_mic.imageset/Contents.json b/App_Resources/iOS/Assets.xcassets/ic_control_mic.imageset/Contents.json similarity index 76% rename from App_Resources/iOS/Assets.xcassets/ic_tab_mic.imageset/Contents.json rename to App_Resources/iOS/Assets.xcassets/ic_control_mic.imageset/Contents.json index b5dfb395..43d26907 100644 --- a/App_Resources/iOS/Assets.xcassets/ic_tab_mic.imageset/Contents.json +++ b/App_Resources/iOS/Assets.xcassets/ic_control_mic.imageset/Contents.json @@ -2,7 +2,7 @@ "images": [ { "idiom": "universal", - "filename": "ic_tab_mic@3x.png", + "filename": "ic_control_mic@3x.png", "scale": "3x" } ], diff --git a/App_Resources/iOS/Assets.xcassets/ic_tab_mic.imageset/ic_tab_mic@3x.png b/App_Resources/iOS/Assets.xcassets/ic_control_mic.imageset/ic_control_mic@3x.png similarity index 100% rename from App_Resources/iOS/Assets.xcassets/ic_tab_mic.imageset/ic_tab_mic@3x.png rename to App_Resources/iOS/Assets.xcassets/ic_control_mic.imageset/ic_control_mic@3x.png diff --git a/App_Resources/iOS/Assets.xcassets/ic_control_settings.imageset/Contents.json b/App_Resources/iOS/Assets.xcassets/ic_control_settings.imageset/Contents.json new file mode 100644 index 00000000..15ba8958 --- /dev/null +++ b/App_Resources/iOS/Assets.xcassets/ic_control_settings.imageset/Contents.json @@ -0,0 +1,13 @@ +{ + "images": [ + { + "idiom": "universal", + "filename": "ic_control_settings@3x.png", + "scale": "3x" + } + ], + "info": { + "author": "xcode", + "version": 1 + } +} diff --git a/App_Resources/iOS/Assets.xcassets/ic_control_settings.imageset/ic_control_settings@3x.png b/App_Resources/iOS/Assets.xcassets/ic_control_settings.imageset/ic_control_settings@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..91306b405a9e6ecbdd8655cf9e83d24c7898ea34 GIT binary patch literal 1732 zcmZ{kdpHvcAIB$`jk)AH2Qh31Wi{p&O4!&kciKW7vauLpQ^u1AGq(tHnQpf%)keqb?ElLwe?Z5>uPc#6~T4ZW1y%ZC$XK4U{T*iOp1^F>v8UpD!Zwycj z218I90}-rQX#}TZh;&i}o$MHyM3x%B8fk5Zu(Fa)kTuHD*2>Y!;Rq7xh(yi=>=XYF zh`U6(7{&NL(4vMGNdfc!HPA1{k!kdZxP^g^-9Q37j$_E7vIQ2xf0SXU zJLvE&niGDfI+S~TP=_YS`witk!*%_#7WfjPH5QcwH~f~lMxSfwav{aH;>tN!Uyb;u zG2ihlfa4sK+XqLycN}8^4+3ZjAt8fd!XncWeR)^D;9lpL=x4sRO?8mh9-aMB-K*-6 z)fPig2@9}f+<~*~u27te8?th@p5YqRo4#Jw+^-M1#gZ%-L^zps;8ZK@m4_y2GJvcO1j##dwjk@>nxJaZ}?8Q(77;PIYf>b^y zl#HM(&lGGh_XV*AeYs5hCyQ_y37}l!kS^g3$s-m5`=5TT(K}r2>yMu3s(Lh8;#-&b z!Q{y9>9ZyJ&`Rqm7H9w7uOk_~^`2+F?_=52*%f|(U(B(Y{2cqLVE5YlIwA!u>Dqvg ztzKRPsspW120bTXTIRPJWQ5L`e=4Osf5#j8%STInssq_6gklMM=ChGdV3?L>^p5}g z?4F`0AS{s5Q0*b!KowKRt8WfmhHE8odX-Et_7FF_Mtjcp z7AJCFKa5o8t|%bDHWNA8AGyg`)v$NU>olXi2kp<p@k?Ah2MrS8JwfYT1L z3*4*k$K-`LZ3xkgN~}D8IRFDqA)vqq)XX?z+Y!x&&AEg&L*;Yq`j9BriHD5YC-Dk} zbM1krrk_p=U=vH|alCr8%{+&@XL0I;7oukyQS3MH%an%+1v}0-8C}9+Z(H|n236;~ zIlso3?Xn{_`Nd|R-8Xrqa2QhTE*!Y#oI}7)-x?~d|Bdct>+QDb;yhAzL!0K%NKYT0 zg~O<~OkWub8Ja$R)OJ#c5i=EDoKIlCEyu1;*Fmq>9B@qy z2DUMXGe6df60T6r4KwF=@;FlqoVfGkDvG~J7LF>4JX2;MBAZP-$W?hT#muV1JiaflPFnw*Lsq(I7x3ta|>M!edOlk z)U6SGT=t=bPYK!drzL$xa#U1U)MjoVPG5IC@_;qE1L+@NKU6x?) zI{_VSSr*Ovj|KwdC`+ir8$wTmd0s`R_VQ#0ler}^1e-(am0!!`Hdoq~Qn~RN^qsPS z#FItv;dj0}v|i!Sim)?$&@r_?%$@EN6|;VT(F*F?Zq_Z9$NW&iM&;)m zY3G_WYU536kNU(etAmvGVvL!QmD6^$q75gz^N5+$hW9xin)&#h8lqs*n! literal 0 HcmV?d00001 diff --git a/app/app.css b/app/app.css index 28d6483c..89a15377 100644 --- a/app/app.css +++ b/app/app.css @@ -1,6 +1,7 @@ @import '@nativescript/theme/css/core.css'; @import '@nativescript/theme/css/default.css'; @import './phone-ui/remote-controls.css'; +@import './phone-ui/settings-page.css'; @import './phone-ui/pairing.css'; Page { @@ -17,9 +18,8 @@ ActionItem { color: #ffffff; } -/* The main page's custom titleView: title left; the EvenHub app icon, - * connection status and the warning triangle right-aligned beside the - * overflow menu. */ +/* The main page's custom titleView: title left; connection status and the + * warning triangle right-aligned beside the overflow menu. */ .action-bar-title { color: #ffffff; font-size: 18; @@ -34,16 +34,6 @@ ActionItem { vertical-align: center; } -/* The foreground EvenHub app's icon (opens its phone UI); the padding widens - * the tap target. */ -.action-bar-app-icon { - width: 32; - height: 32; - padding: 5.5; - margin-right: 8; - vertical-align: center; -} - /* The emoji brings its own yellow; the padding widens the tap target. */ .action-bar-warning { font-size: 18; diff --git a/app/app.ios.css b/app/app.ios.css index b3b6f08c..e0eace16 100644 --- a/app/app.ios.css +++ b/app/app.ios.css @@ -1,5 +1,6 @@ @import '@nativescript/theme/css/core.css'; @import './phone-ui/remote-controls.css'; +@import './phone-ui/settings-page.css'; @import './phone-ui/pairing.css'; .body-text { font-size: 18; } @@ -36,8 +37,6 @@ Page.main-page { .main-page .action-bar-title { font-size: 18; font-weight: bold; color: #ffffff; } .main-page .action-bar-status { font-size: 14; color: #ffffff; margin-right: 12; } .main-page .action-bar-warning { font-size: 18; padding: 4 6; } -/* Matches Android's 32x32 padded icon; the Image inside is 21x21. */ -.main-page .action-bar-app-icon { width: 32; height: 32; margin-right: 8; } .main-page .overflow-button { background-color: transparent; color: #ffffff; @@ -47,9 +46,6 @@ Page.main-page { margin: 0; padding: 0; } -/* Match Android's button layout boxes, including the inset around each tile. */ -.main-page Button.tab-button { height: 48; margin-top: 6; margin-bottom: 6; } -.main-page .mode-button { background-color: #e2e2e2; color: #333333; border-radius: 6; } .main-page .ble-bandwidth-indicator { color: #777777; font-size: 12; padding: 2 8; } .main-page .system-name-modal { diff --git a/app/apps/evenhub/manager.ts b/app/apps/evenhub/manager.ts index 14b9382f..8b2acb7c 100644 --- a/app/apps/evenhub/manager.ts +++ b/app/apps/evenhub/manager.ts @@ -6,8 +6,8 @@ * * Glasses-first: launching does NOT take over the phone screen. The phone * stays on the Faceclaw dashboard; an app's phone UI is shown on demand - * (window menu -> "Show phone UI", or the app-icon button in the phone's - * action bar while the app is foreground on the glasses), overlaying the + * (window menu -> "Show phone UI", or the app-icon button in the bar under the + * phone's mirror while the app is foreground on the glasses), overlaying the * dashboard, and the Back button or the overlay's close button returns to it. * Apps are kept alive until explicitly closed (no memory eviction yet). */ @@ -40,14 +40,14 @@ type RunningApp = { packageId: string; session: EvenHubSession; webView: EvenHubWebView; - /** The app's icon for the phone action bar, rendered on first use. */ + /** The app's icon for the phone's button bar, rendered on first use. */ phoneIcon?: ImageSource | null; }; -/** The phone action bar's button for opening the foreground app's phone UI. */ +/** The button under the phone's mirror that opens the foreground app's phone UI. */ export type PhoneUiButton = { windowId: string; title: string; icon: ImageSource | null }; -/** Pixel size the action-bar icon is rendered at (~21dp at xxhdpi). */ +/** Pixel size the button's icon is rendered at (~21dp at xxhdpi; shown at 20dp). */ const PHONE_ICON_SIZE = 63; const running = new Map(); @@ -244,7 +244,7 @@ export function hidePhone(): void { /** * The foreground glasses window, when it is an EvenHub app whose phone UI - * isn't showing: the phone action bar then offers a button to show it. + * isn't showing: the bar under the phone's mirror then offers a button to show it. */ export function phoneUiButton(): PhoneUiButton | null { const window = shell.foregroundWindow(); @@ -252,7 +252,7 @@ export function phoneUiButton(): PhoneUiButton | null { if (!window || !app || phoneShownWindowId === app.windowId) return null; if (app.phoneIcon === undefined) { // The same artwork as the glasses sidebar (installed icon, else the - // generic package icon), drawn white. + // generic package icon), drawn white; the button's stylesheet tints it. const image = new GrayImage(PHONE_ICON_SIZE, PHONE_ICON_SIZE, 0); window.drawIcon(image, 0, 0, PHONE_ICON_SIZE); app.phoneIcon = grayImageToWhiteIconSource(image); diff --git a/app/g2/dashboard-controller.ts b/app/g2/dashboard-controller.ts index e6513690..78bca5c1 100644 --- a/app/g2/dashboard-controller.ts +++ b/app/g2/dashboard-controller.ts @@ -111,8 +111,6 @@ type ConnectionPhase = "disconnected" | "connecting" | "connected" | "charging" export type DashboardSnapshot = { phase: ConnectionPhase; - /** Last-known battery levels: the glasses, their charging case, the R1 ring and a Wear OS watch. */ - batteries: ReturnType; status: string; displayPreview: ImageSource | null; /** @@ -155,7 +153,7 @@ export type DashboardSnapshot = { previewMode: boolean; /** * The foreground glasses window's EvenHub phone UI, when it can be opened - * (the action bar's app-icon button); null otherwise. + * (the app-icon button under the mirror); null otherwise. */ evenHubPhoneUi: PhoneUiButton | null; }; @@ -428,7 +426,7 @@ class DashboardController { launchApp: (appId) => this.launchApp(appId), requestShellRender: () => this.requestShellRender(), }); - // The action bar's EvenHub phone-UI button hides while that UI is showing. + // The main page's EvenHub phone-UI button hides while that UI is showing. onPhoneShownChanged(() => this.emit()); shell.configure({ actions: { @@ -1222,11 +1220,10 @@ class DashboardController { alarmReliabilityMessage: this.alarmReliabilityMessage, previewMode: this.isPreviewDisplayActive(), evenHubPhoneUi: phoneUiButton(), - batteries: shell.getBatteryLevels(), }; } - /** Overlay an EvenHub app's phone UI (the action bar's app-icon button). */ + /** Overlay an EvenHub app's phone UI (the app-icon button under the mirror). */ showEvenHubPhoneUi(windowId: string): void { showEvenHubPhoneUi(windowId); } diff --git a/app/g2/glasses-display-state.ts b/app/g2/glasses-display-state.ts index ab1e673e..869a154a 100644 --- a/app/g2/glasses-display-state.ts +++ b/app/g2/glasses-display-state.ts @@ -80,7 +80,7 @@ export type BatteryLevels = { }; /** - * The phone Settings tab's battery row: each device whose level is known, + * The phone settings page's battery row: each device whose level is known, * e.g. "G2 100% · Case 98% ⚡ · R1 72%" (⚡ = charging), or "" when none * is. Levels are the last known ones (the case only reports while the glasses * are docked), so ⚡ appears only while it is live: the glasses and Case only diff --git a/app/g2/ios-preview-controller.ts b/app/g2/ios-preview-controller.ts index a1d83172..60b1c881 100644 --- a/app/g2/ios-preview-controller.ts +++ b/app/g2/ios-preview-controller.ts @@ -360,7 +360,7 @@ export class IosPreviewController { this.logBluetooth(`Phone background; glasses ${this.state.phase}`) this.flushBluetoothLog() } - /** Overlay an EvenHub app's phone UI (the header's app-icon button). */ + /** Overlay an EvenHub app's phone UI (the app-icon button under the mirror). */ showEvenHubPhoneUi(windowId: string): void { showOnPhone(windowId) } diff --git a/app/native/gray-image-preview.ios.ts b/app/native/gray-image-preview.ios.ts index da6c89d6..4d2e83c6 100644 --- a/app/native/gray-image-preview.ios.ts +++ b/app/native/gray-image-preview.ios.ts @@ -11,7 +11,7 @@ export function grayImageToPreviewSource(image: GrayImage): ImageSource | null { /** * A glasses icon as a white-on-transparent phone image (gray becomes alpha), - * for the dark header. + * which the phone UI tints to suit its background. */ export function grayImageToWhiteIconSource(image: GrayImage): ImageSource | null { const baked = image.withDrawsBaked() diff --git a/app/native/gray-image-preview.ts b/app/native/gray-image-preview.ts index e59c2655..58ee723f 100644 --- a/app/native/gray-image-preview.ts +++ b/app/native/gray-image-preview.ts @@ -30,7 +30,7 @@ export function grayImageToPreviewSource(image: GrayImage): ImageSource | null { /** * A glasses icon as a white-on-transparent phone image (gray becomes alpha), - * for the dark action bar. + * which the phone UI tints to suit its background. */ export function grayImageToWhiteIconSource(image: GrayImage): ImageSource | null { if (!global.isAndroid) { diff --git a/app/phone-ui/README.md b/app/phone-ui/README.md index c8d13a6c..efcf0d54 100644 --- a/app/phone-ui/README.md +++ b/app/phone-ui/README.md @@ -1,10 +1,17 @@ # Main-screen UI Android and iOS share `remote-controls.xml`, `remote-controls.css`, and -`RemoteControlsViewModel`: tab order and selection, screen-size choices, -brightness/Auto settings, watch labels, ring markings, and microphone/keyboard -buttons. Import the stylesheet at the top of each platform's application CSS -(before any rules), so the NativeScript CSS pipeline includes it. +`RemoteControlsViewModel`: the bar of icon buttons under the mirror (the +foreground EvenHub app's phone UI, microphone, keyboard, settings) and the +touchpad below it, which is the simulated watch face or the ring pad according +to the Phone input style setting. The settings button opens `settings-page.xml` +(`SettingsViewModel`, `settings-page.css`), also shared: display mode, +brightness/Auto, Phone input style and battery levels. That page needs no host: +it reads the settings store, the shell's battery levels and +`g2/glasses-presence`, which both platforms' controllers feed. Import the +stylesheets at the top of each platform's application CSS (before any rules), +so the NativeScript CSS pipeline includes them; iOS also has to register each +shared page in `onboarding-register.ios.ts`. Android's `MainViewModel` extends that shared model and connects it to `dashboardController`. iOS loads the same XML with `Builder.load` and connects @@ -28,6 +35,8 @@ audio input in preview mode. The phone path requires both Speech Recognition and Microphone permissions and stops when Faceclaw leaves the foreground; connected-glasses capture retains its existing background behavior. -The iOS microphone and keyboard image assets are 3x rasterizations of the -Android vector drawables with the same names; regenerate them from those -vectors if the icon designs change. +The iOS microphone, keyboard and settings image assets (`ic_control_*`) are 3x +rasterizations of the Android vector drawables with the same names; regenerate +them from those vectors if the icon designs change. The EvenHub button's icon +is the app's own, rendered white on transparent; `.control-icon` tints all four +alike. diff --git a/app/phone-ui/main-page.ios.ts b/app/phone-ui/main-page.ios.ts index f42f9181..2054fad6 100644 --- a/app/phone-ui/main-page.ios.ts +++ b/app/phone-ui/main-page.ios.ts @@ -7,11 +7,9 @@ import { IosPreviewController } from '../g2/ios-preview-controller' import { PhoneGestureRecognizer } from './phone-gestures' import { BleBandwidthMeter } from './ble-bandwidth-meter' import { sampleBleTraffic } from '../native/ble-traffic' -import { glassesModelName, onAnySettingChanged, mirrorTouchSetting, showBleBandwidthSetting } from '../ui/dashboard-settings' +import { onAnySettingChanged, mirrorTouchSetting, showBleBandwidthSetting } from '../ui/dashboard-settings' import { loadDeviceAddresses } from '../g2/device-addresses' import { deviceAddressError } from '../g2/ios-peripheral-identity' -import { formatBatteryLine } from '../g2/glasses-display-state' -import { shell } from '../ui/shell/shell' export function createMainPage(): Page { const page = new Page() @@ -22,37 +20,26 @@ export function createMainPage(): Page { root.rows = 'auto,*' page.content = root const header = new GridLayout() - header.columns = '*,auto,auto,auto,auto'; header.className = 'main-header' + header.columns = '*,auto,auto,auto'; header.className = 'main-header' const title = new Label() title.text = 'Faceclaw'; title.className = 'action-bar-title' header.addChild(title) - // The foreground EvenHub app's icon, which opens its phone UI. UIImageView - // ignores padding, so a wrapper supplies Android's wider tap target. - const appIconButton = new GridLayout() - appIconButton.className = 'action-bar-app-icon'; appIconButton.verticalAlignment = 'middle' - appIconButton.visibility = 'collapse'; appIconButton.accessible = true - const appIcon = new Image() - appIcon.width = 21; appIcon.height = 21 - appIconButton.addChild(appIcon) - let phoneUiWindowId: string | null = null - appIconButton.on('tap', () => { if (phoneUiWindowId) controller.showEvenHubPhoneUi(phoneUiWindowId) }) - GridLayout.setColumn(appIconButton, 1); header.addChild(appIconButton) const state = new Label() state.text = 'Preview'; state.className = 'action-bar-status' state.verticalAlignment = 'middle' state.on('tap', () => { void openDevices() }) - GridLayout.setColumn(state, 2); header.addChild(state) + GridLayout.setColumn(state, 1); header.addChild(state) // Android's warning triangle: shown while the glasses report firmware Faceclaw can't run. const warning = new Label() warning.text = '\u26A0\uFE0F'; warning.className = 'action-bar-warning' warning.accessibilityLabel = 'Attention needed'; warning.verticalAlignment = 'middle' warning.visibility = 'collapse' warning.on('tap', () => { void showFirmwareWarning() }) - GridLayout.setColumn(warning, 3); header.addChild(warning) + GridLayout.setColumn(warning, 2); header.addChild(warning) const overflow = new Button() overflow.text = '⋮'; overflow.accessibilityLabel = 'More options'; overflow.className = 'overflow-button' overflow.on('tap', () => openMenu()) - GridLayout.setColumn(overflow, 4); header.addChild(overflow); root.addChild(header) + GridLayout.setColumn(overflow, 3); header.addChild(overflow); root.addChild(header) const body = new GridLayout() GridLayout.setRow(body, 1); root.addChild(body) const mirror = new Image() @@ -72,10 +59,6 @@ export function createMainPage(): Page { keyboardPanel.bindingContext = keyboardModel GridLayout.setRow(keyboardPanel, 1); root.addChild(keyboardPanel) let focusTimer: ReturnType | null = null - // The Settings tab's battery row. iOS reports charging sessions as - // connected, so "connected" is the whole live-link condition here. - let glassesLinked = false - const refreshBatteryLine = () => { model.batteryLine = formatBatteryLine(shell.getBatteryLevels(), glassesLinked, glassesModelName()) } const keyboardField = () => keyboardPanel.getViewById('keyboardInputField') const controller = new IosPreviewController((image, label) => { mirror.imageSource = image; model.set('padFocusLine', label) @@ -85,7 +68,6 @@ export function createMainPage(): Page { state.text = ({ connected: 'Connected', disconnected: 'Preview', connecting: 'Connecting', retrying: 'Reconnecting', disconnecting: 'Disconnecting', error: 'Failed' })[connection.phase] warning.visibility = connection.firmwareWarning ? 'visible' : 'collapse' - glassesLinked = connection.phase === 'connected'; refreshBatteryLine() }, session => { keyboardModel.setSession(session) controls.visibility = session ? 'collapse' : 'visible' @@ -95,11 +77,10 @@ export function createMainPage(): Page { focusTimer = setTimeout(() => { focusTimer = null; keyboardField()?.focus() }, 0) } else keyboardField()?.dismissSoftInput() }, button => { - phoneUiWindowId = button?.icon ? button.windowId : null - appIcon.imageSource = button?.icon ?? null - appIconButton.visibility = phoneUiWindowId ? 'visible' : 'collapse' - appIconButton.accessibilityLabel = button ? `Open ${button.title} on phone` : '' + // The foreground EvenHub app's button in the bar under the mirror. + model.evenHubPhoneUi = button }) + model.showEvenHubPhoneUi = windowId => controller.showEvenHubPhoneUi(windowId) async function navigateDevicePage(moduleName: string, context?: object): Promise { suppressAutoReconnect() await controller.disconnect() @@ -190,7 +171,8 @@ export function createMainPage(): Page { mirror.on('touch', touch(mirrorInput)) const cancelGestures = () => { watchInput.cancel(); ringInput.cancel(); mirrorInput.cancel() } model.on('propertyChange', (args: PropertyChangeData) => { - if (args.propertyName === 'watchTabVisibility') cancelGestures() + // The other pad took this one's place (Settings > Phone input style). + if (args.propertyName === 'watchPadVisibility') cancelGestures() }) let controlsLayoutTimer: ReturnType | null = null model.set('onControlsContentLayoutChanged', (args: { object: View }) => { @@ -263,7 +245,6 @@ export function createMainPage(): Page { const resume = () => { foreground = true; controller.resume(); syncBandwidth() } let keyboardObserver: any = null let offSettings: (() => void) | null = null - let offBattery: (() => void) | null = null page.on('loaded', () => { if (!keyboardObserver) keyboardObserver = NSNotificationCenter.defaultCenter.addObserverForNameObjectQueueUsingBlock( UIKeyboardWillChangeFrameNotification, null, NSOperationQueue.mainQueue, notification => { @@ -273,16 +254,15 @@ export function createMainPage(): Page { root.paddingBottom = Math.max(0, view.bounds.size.height - local.origin.y - view.safeAreaInsets.bottom) }) Application.on(Application.suspendEvent, pause); Application.on(Application.resumeEvent, resume) - offSettings?.(); offSettings = onAnySettingChanged(() => { model.refreshDisplayControls(); syncBandwidth() }) - offBattery?.(); offBattery = shell.onBatteryLevelsChanged(refreshBatteryLine) - model.refreshDisplayControls(); refreshBatteryLine(); resume() + offSettings?.(); offSettings = onAnySettingChanged(() => { model.refreshInputStyle(); syncBandwidth() }) + model.refreshInputStyle(); resume() if (!isPreviewOnlyMode() && !isAutoReconnectSuppressed() && !deviceAddressError(loadDeviceAddresses())) void controller.connect() }) page.on('unloaded', () => { if (keyboardObserver) NSNotificationCenter.defaultCenter.removeObserver(keyboardObserver) keyboardObserver = null root.paddingBottom = 0 - pause(); offSettings?.(); offSettings = null; offBattery?.(); offBattery = null + pause(); offSettings?.(); offSettings = null Application.off(Application.suspendEvent, pause); Application.off(Application.resumeEvent, resume) }) return page diff --git a/app/phone-ui/main-page.xml b/app/phone-ui/main-page.xml index 7868d259..29c12f08 100644 --- a/app/phone-ui/main-page.xml +++ b/app/phone-ui/main-page.xml @@ -1,13 +1,12 @@ - - + + @@ -32,8 +31,8 @@ visibility="{{ displayPreviewMessageVisibility }}"> - +