From 9c0535014a28c96439198fbf9c53bc4d0a37e419 Mon Sep 17 00:00:00 2001 From: Om Alve Date: Sun, 1 Nov 2026 21:29:32 +0530 Subject: [PATCH] Phone UI: show the glasses, charging case and R1 battery levels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A line under the mirror lists each device whose level is known, e.g. "G2 100% · Case 98% ⚡ · R1 72%" (⚡ = charging), in portrait and landscape. The case level joins the shell's battery state beside the glasses and R1 (it is not drawn in the glasses' top bar) and reaches the page through the dashboard snapshot. Like the glasses level it is kept across disconnects: the case only reports while the glasses are docked and only drains while charging them. --- app/app.css | 7 +++++++ app/g2/dashboard-controller.ts | 14 +++++++++++++ app/phone-ui/main-page.xml | 12 ++++++----- app/phone-ui/main-view-model.ts | 36 ++++++++++++++++++++++++++++++++- app/ui/shell/chrome-layer.ts | 6 ++++++ app/ui/shell/shell.ts | 1 + 6 files changed, 70 insertions(+), 6 deletions(-) diff --git a/app/app.css b/app/app.css index 4dbacd37..8b4ba544 100644 --- a/app/app.css +++ b/app/app.css @@ -136,6 +136,13 @@ Button.-primary { text-align: center; } +/* Battery levels under the mirror (main-page.xml). */ +.battery-line { + font-size: 14; + text-align: center; + padding: 12 16 0 16; +} + .system-name-modal { margin: 16; padding: 16; diff --git a/app/g2/dashboard-controller.ts b/app/g2/dashboard-controller.ts index 0b995653..f6d92f3a 100644 --- a/app/g2/dashboard-controller.ts +++ b/app/g2/dashboard-controller.ts @@ -103,6 +103,8 @@ 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; /** @@ -333,6 +335,7 @@ class DashboardController { private offState: (() => void) | null = null; private offRing: (() => void) | null = null; private offBattery: (() => void) | null = null; + private offCaseBattery: (() => void) | null = null; private offSilentMode: (() => void) | null = null; private offWearState: (() => void) | null = null; private offPhoneLockState: (() => void) | null = null; @@ -1130,6 +1133,7 @@ class DashboardController { alarmReliabilityMessage: this.alarmReliabilityMessage, previewMode: this.isPreviewDisplayActive(), evenHubPhoneUi: phoneUiButton(), + batteries: shell.getBatteryLevels(), }; } @@ -1584,6 +1588,12 @@ class DashboardController { // the watch state, so refresh both consumers on every report. this.emit(); }); + this.offCaseBattery = communicator.onCaseState((state) => { + // Kept across disconnects: the case only reports while the glasses are + // docked and only drains while charging them, so the last level holds. + shell.setBatteryLevels({ case: state.battery, caseCharging: state.charging }); + this.emit(); + }); this.offEvenAppConflict = communicator.onEvenAppConflict((message) => { this.refreshEvenAppStatus(); if (!this.evenNotificationActive) { @@ -1704,6 +1714,8 @@ class DashboardController { this.offRing = null; this.offBattery?.(); this.offBattery = null; + this.offCaseBattery?.(); + this.offCaseBattery = null; this.offSilentMode?.(); this.offSilentMode = null; this.offWearState?.(); @@ -1816,6 +1828,8 @@ class DashboardController { this.offRing = null; this.offBattery?.(); this.offBattery = null; + this.offCaseBattery?.(); + this.offCaseBattery = null; this.offSilentMode?.(); this.offSilentMode = null; this.offWearState?.(); diff --git a/app/phone-ui/main-page.xml b/app/phone-ui/main-page.xml index 846fa253..880b9032 100644 --- a/app/phone-ui/main-page.xml +++ b/app/phone-ui/main-page.xml @@ -19,7 +19,7 @@ - + @@ -31,9 +31,10 @@ visibility="{{ displayPreviewMessageVisibility }}"> +