Add EvenHub icon to phone preview screen

This commit is contained in:
James Babcock committed 2026-10-12 02:33:22 -07:00
1 parent 14d1f7f509
commit ccbf523e9a
8 files changed
+100 -8

No files matched your search

+20 -4
View File
@@ -20,26 +20,37 @@ export function createMainPage(): Page {
root.rows = 'auto,*'
page.content = root
const header = new GridLayout()
header.columns = '*,auto,auto,auto'; header.className = 'main-header'
header.columns = '*,auto,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, 1); header.addChild(state)
GridLayout.setColumn(state, 2); 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, 2); header.addChild(warning)
GridLayout.setColumn(warning, 3); header.addChild(warning)
const overflow = new Button()
overflow.text = '⋮'; overflow.accessibilityLabel = 'More options'; overflow.className = 'overflow-button'
overflow.on('tap', () => openMenu())
GridLayout.setColumn(overflow, 3); header.addChild(overflow); root.addChild(header)
GridLayout.setColumn(overflow, 4); header.addChild(overflow); root.addChild(header)
const body = new GridLayout()
GridLayout.setRow(body, 1); root.addChild(body)
const mirror = new Image()
@@ -76,6 +87,11 @@ export function createMainPage(): Page {
if (session) {
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` : ''
})
async function navigateDevicePage(moduleName: string, context?: object): Promise<void> {
suppressAutoReconnect()