EvenHub phone UI: add top bar, add open icon

This commit is contained in:
James Babcock committed 2026-09-27 21:38:04 -07:00
1 parent c6949fde3b
commit e879c58d9c
9 files changed
+284 -30

No files matched your search

+7 -5
View File
@@ -1,11 +1,13 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd" xmlns:rc="phone-ui" navigatingTo="navigatingTo" loaded="loaded" unloaded="unloaded">
<ActionBar>
<!-- Custom titleView: app title on the left; connection status and the
warning-triangle indicator right-aligned beside the overflow menu. -->
<GridLayout columns="auto,*,auto,auto" width="100%" verticalAlignment="center">
<!-- Custom titleView: app title on the left; the foreground EvenHub
app's phone-UI button, connection status and the warning-triangle
indicator right-aligned beside the overflow menu. -->
<GridLayout columns="auto,*,auto,auto,auto" width="100%" verticalAlignment="center">
<Label col="0" text="Faceclaw" class="action-bar-title" />
<Label col="2" text="{{ connectionStatusLabel }}" tap="{{ onConnectionStatusTap }}" class="action-bar-status" />
<Label col="3" text="&#x26A0;&#xFE0F;" tap="{{ onWarningIconTap }}" visibility="{{ warningIconVisibility }}" class="action-bar-warning" />
<Image col="2" src="{{ evenHubPhoneUiIcon }}" tap="{{ onEvenHubPhoneUiTap }}" visibility="{{ evenHubPhoneUiVisibility }}" class="action-bar-app-icon" />
<Label col="3" text="{{ connectionStatusLabel }}" tap="{{ onConnectionStatusTap }}" class="action-bar-status" />
<Label col="4" text="&#x26A0;&#xFE0F;" tap="{{ onWarningIconTap }}" visibility="{{ warningIconVisibility }}" class="action-bar-warning" />
</GridLayout>
<ActionItem text="{{ buttonLabel }}" tap="{{ onTap }}" isEnabled="{{ connectItemEnabled }}" visibility="{{ glassesMenuItemsVisibility }}" android.position="popup" />
<ActionItem text="Pair glasses" tap="{{ onPairGlassesTap }}" isEnabled="{{ canRun }}" android.position="popup" />
+25
View File
@@ -25,6 +25,7 @@ import { isAutoReconnectSuppressed, resumeAutoReconnect } from "../g2/reconnect-
import { isPreviewOnlyMode } from "./onboarding-state";
import { formatErrorMessage } from "../util/format-error";
import { G2_LENS_HEIGHT, G2_LENS_WIDTH } from "../graphics/image";
import { type PhoneUiButton } from "../apps/evenhub/manager";
const LENS_ASPECT_RATIO = G2_LENS_WIDTH / G2_LENS_HEIGHT;
@@ -63,6 +64,7 @@ export class MainViewModel extends RemoteControlsViewModel {
private _alarmReliabilityMessage = "";
private _warningsModalVisible = false;
private _previewMode = false;
private _evenHubPhoneUi: PhoneUiButton | null = null;
private _phase: "disconnected" | "connecting" | "connected" | "charging" | "disconnecting" = "disconnected";
// A new view model is built on every navigation to the main page; these
@@ -112,6 +114,7 @@ export class MainViewModel extends RemoteControlsViewModel {
this.batteryOptimizationWarningVisible = snapshot.batteryOptimizationWarningVisible;
this.fontsMissingWarningVisible = snapshot.fontsMissingWarningVisible;
this.alarmReliabilityMessage = snapshot.alarmReliabilityMessage;
this.evenHubPhoneUi = snapshot.evenHubPhoneUi;
this.refreshPadFocusLine();
}));
// Brightness / display mode can change from the glasses' Settings app too.
@@ -773,6 +776,28 @@ export class MainViewModel extends RemoteControlsViewModel {
return this._warningsModalVisible ? "visible" : "collapse";
}
set evenHubPhoneUi(value: PhoneUiButton | null) {
const current = this._evenHubPhoneUi;
if (current?.windowId === value?.windowId && current?.icon === value?.icon) return;
this._evenHubPhoneUi = value;
this.notifyPropertyChange("evenHubPhoneUiIcon", this.evenHubPhoneUiIcon);
this.notifyPropertyChange("evenHubPhoneUiVisibility", this.evenHubPhoneUiVisibility);
}
/** The foreground EvenHub app's icon, which opens its phone UI when tapped. */
get evenHubPhoneUiIcon(): ImageSource | null {
return this._evenHubPhoneUi?.icon ?? null;
}
get evenHubPhoneUiVisibility(): "visible" | "collapse" {
return this._evenHubPhoneUi?.icon ? "visible" : "collapse";
}
onEvenHubPhoneUiTap(): void {
const windowId = this._evenHubPhoneUi?.windowId;
if (windowId) dashboardController.showEvenHubPhoneUi(windowId);
}
onWarningIconTap(): void {
this.setWarningsModalVisible(true);
}