Adapt complete Android phone UI and fix idle audio and microphone test gates
android-ci / android-arm64 (push) Successful in 17m35s

This commit is contained in:
bit9992 committed 2026-11-12 18:33:57 +03:00
1 parent cec86d8e3d
commit 5e2a82b1bb
20 files changed
+976 -201

No files matched your search

+240 -46
View File
@@ -1,10 +1,10 @@
import { ScrollView, ListView, Slider } from "std-widgets.slint";
import { Theme } from "theme.slint";
import { ActionButton, TextField } from "controls.slint";
import { ActionButton, TextField, Choice } from "controls.slint";
import { ChatScreen } from "chat.slint";
import { SettingsScreen } from "settings.slint";
import { SettingsScreen, SettingsBridge } from "settings.slint";
export struct ShellRow { id: string, title: string, subtitle: string, depth: int, selected: bool, expanded: bool, expandable: bool, talking: bool, muted: bool, unread: string }
export struct ShellRow { id: string, title: string, subtitle: string, depth: int, selected: bool, expanded: bool, expandable: bool, talking: bool, muted: bool, unread: string, disclosure: string }
export struct ShellTab { id: string, title: string, selected: bool, microphone-owner: bool, connected: bool, unread: string }
export struct ShellCommand { id: string, label: string, enabled: bool, reason: string, destructive: bool }
export struct ShellInfo { label: string, value: string }
@@ -21,6 +21,9 @@ export global ShellBridge {
in-out property <[ShellCommand]> menu-actions;
in-out property <[ShellStream]> streams;
in-out property <[string]> destinations;
in-out property <[string]> connection-names;
in-out property <int> selected-connection: -1;
in-out property <ShellCommand> primary-action;
in-out property <int> destination;
in-out property <int> depth;
in-out property <int> stage;
@@ -128,7 +131,7 @@ component EntryRow inherits Rectangle {
component CommandList inherits VerticalLayout {
in property <[ShellCommand]> commands;
spacing: 4px;
spacing: Theme.android ? 8px : 4px;
for command in root.commands: VerticalLayout {
ActionButton { text: command.label; enabled: command.enabled; destructive: command.destructive; clicked => { ShellBridge.invoke(command.id); } }
if command.reason != "": Text { text: command.reason; color: Theme.muted; wrap: word-wrap; }
@@ -137,25 +140,212 @@ component CommandList inherits VerticalLayout {
component StreamTile inherits Rectangle {
in property <ShellStream> item;
min-height: 230px;
min-height: Theme.android ? stream-content.preferred-height : 230px;
vertical-stretch: Theme.android ? 0 : 1;
background: Theme.contrast;
border-radius: 8px;
border-width: 2px;
border-color: Theme.bg;
VerticalLayout {
stream-content := VerticalLayout {
padding: 8px; spacing: 4px;
Text { text: root.item.title; color: Theme.fg; overflow: elide; }
Text { text: root.item.title; color: Theme.fg; overflow: Theme.android ? clip : elide; wrap: Theme.android ? word-wrap : no-wrap; }
Rectangle {
min-height: 150px;
min-height: Theme.android ? max(100px,root.width * 0.5625) : 150px;
if root.item.has-frame: Image { source: root.item.frame; image-fit: contain; }
if !root.item.has-frame: Text { text: root.item.status != "" ? root.item.status : ShellBridge.label-stream-waiting; color: Theme.muted; horizontal-alignment: center; vertical-alignment: center; wrap: word-wrap; }
}
Text { text: root.item.status; color: Theme.muted; overflow: elide; }
Slider { minimum: 0; maximum: 2; value: root.item.volume; accessible-label: ShellBridge.label-volume; changed(value) => { ShellBridge.stream-volume(root.item.id,value); } }
Text { text: root.item.status; color: Theme.muted; overflow: Theme.android ? clip : elide; wrap: Theme.android ? word-wrap : no-wrap; }
Slider { min-height: Theme.android ? 48px : 0px; minimum: 0; maximum: 2; value: root.item.volume; accessible-label: ShellBridge.label-volume; changed(value) => { ShellBridge.stream-volume(root.item.id,value); } }
CommandList { commands: root.item.actions; }
}
}
// Touch navigation is structurally separate from the desktop's three fixed slots.
component PhoneIconAction inherits Rectangle {
in property <int> kind;
in property <string> label;
in property <bool> enabled: true;
callback clicked();
width: 48px; min-height: 48px; vertical-stretch: 0;
background: icon-touch.has-hover || icon-focus.has-focus ? Theme.bg : transparent;
border-radius: 8px; border-width: icon-focus.has-focus ? 2px : 0px; border-color: Theme.outline;
opacity: enabled ? 1 : 0.45;
accessible-role: button; accessible-label: label; accessible-enabled: enabled;
accessible-action-default => { if root.enabled { root.clicked(); } }
if root.kind == 0: HorizontalLayout { padding: 15px; spacing: 3px; for dot in 3: Rectangle { width: 4px; height: 4px; border-radius: 2px; background: Theme.fg; } }
if root.kind == 1: Path { x: 12px; y: (parent.height - 24px)/2; width: 24px; height: 24px; commands: "M 15 4 L 7 12 L 15 20 M 7 12 L 22 12"; fill: transparent; stroke: Theme.fg; stroke-width: 2px; }
if root.kind == 2: Path { x: 12px; y: (parent.height - 24px)/2; width: 24px; height: 24px; commands: "M 8 4 L 16 12 L 8 20"; fill: transparent; stroke: Theme.fg; stroke-width: 2px; }
if root.kind == 3: Path { x: 12px; y: (parent.height - 24px)/2; width: 24px; height: 24px; commands: "M 4 8 L 12 16 L 20 8"; fill: transparent; stroke: Theme.fg; stroke-width: 2px; }
icon-focus := FocusScope { enabled: root.enabled; key-pressed(e) => { if e.text == "\n" || e.text == " " { root.clicked(); return accept; } return reject; } }
icon-touch := TouchArea { enabled: root.enabled; clicked => { icon-focus.focus(); root.clicked(); } }
}
component PhoneEntryRow inherits Rectangle {
in property <ShellRow> item;
min-width: 0px;
property <length> indent: min(item.depth * 12px, 48px);
min-height: max(48px, row-content.preferred-height); preferred-height: self.min-height; vertical-stretch: 0;
background: item.selected ? Theme.contrast : transparent;
border-radius: 9px; border-width: item.selected || row-focus.has-focus ? 1.5px : 0px; border-color: Theme.tint;
accessible-role: list-item; accessible-label: item.title + ". " + item.subtitle;
accessible-item-selectable: true; accessible-item-selected: item.selected;
accessible-expandable: item.expandable; accessible-expanded: item.expanded;
accessible-action-default => { ShellBridge.select(root.item.id); }
accessible-action-expand => { if root.item.expandable { ShellBridge.expand(root.item.id); } }
row-content := HorizontalLayout { padding-left: root.indent; spacing: 8px;
if root.item.expandable: PhoneIconAction { kind: root.item.expanded ? 3 : 2; label: root.item.disclosure; clicked => { ShellBridge.expand(root.item.id); } }
Rectangle { width: 6px; height: 6px; border-radius: 3px; background: root.item.talking ? Theme.success : (root.item.muted ? Theme.error : Theme.muted); }
VerticalLayout { padding-top: 8px; padding-bottom: 8px; spacing: 2px; alignment: center; horizontal-stretch: 1;
Text { min-width: 0px; text: root.item.title; color: Theme.fg; font-size: Theme.font-size; wrap: word-wrap; }
if root.item.subtitle != "": Text { min-width: 0px; text: root.item.subtitle; color: Theme.muted; font-size: Theme.font-size * 0.86; wrap: word-wrap; }
}
if root.item.unread != "": Text { text: root.item.unread; color: Theme.tint; vertical-alignment: center; }
PhoneIconAction { kind: 0; label: ShellBridge.label-more + ": " + root.item.title; clicked => { ShellBridge.context(root.item.id); } }
}
row-focus := FocusScope { key-pressed(e) => { if e.text == "\n" { ShellBridge.select(root.item.id); return accept; } if e.text == Key.F10 && e.modifiers.shift { ShellBridge.context(root.item.id); return accept; } return reject; } }
TouchArea {
x: root.indent + (root.item.expandable ? 56px : 0px); width: max(0px,parent.width - self.x - 56px);
clicked => { row-focus.focus(); ShellBridge.select(root.item.id); }
pointer-event(e) => {
if e.button == PointerEventButton.right && e.kind == PointerEventKind.down { ShellBridge.context(root.item.id); }
if e.button == PointerEventButton.left && e.kind == PointerEventKind.down { ShellBridge.row-press(root.item.id,true); }
if e.kind == PointerEventKind.up || e.kind == PointerEventKind.cancel { ShellBridge.row-press(root.item.id,false); }
if e.kind == PointerEventKind.move && (abs((self.mouse-x - self.pressed-x)/1px)>8 || abs((self.mouse-y - self.pressed-y)/1px)>8) { ShellBridge.row-press(root.item.id,false); }
}
}
}
component PhoneServerList inherits Rectangle {
property <bool> saved-open;
background: Theme.bg; min-width: 0px; min-height: 0px;
VerticalLayout { spacing: 8px; padding: 8px;
if ShellBridge.primary-action.id != "": ActionButton { text: ShellBridge.primary-action.label; primary: true; enabled: ShellBridge.primary-action.enabled; clicked => { ShellBridge.invoke(ShellBridge.primary-action.id); } }
if ShellBridge.tabs.length > 0: HorizontalLayout { spacing: 8px; vertical-stretch: 0;
Choice { horizontal-stretch: 1; values: ShellBridge.connection-names; current-index: ShellBridge.selected-connection; label: ShellBridge.destinations[0]; selected(index) => { if index >= 0 && index < ShellBridge.tabs.length { ShellBridge.select(ShellBridge.tabs[index].id); } } }
PhoneIconAction { kind: 0; label: ShellBridge.label-more; enabled: ShellBridge.selected-connection >= 0; clicked => { ShellBridge.context(ShellBridge.tabs[ShellBridge.selected-connection].id); } }
}
if ShellBridge.bookmarks.length > 0 && ShellBridge.tree.length > 0: ActionButton { text: root.saved-open ? ShellBridge.destinations[0] : ShellBridge.label-bookmarks; clicked => { root.saved-open = !root.saved-open; } }
if ShellBridge.tree.length > 0 && !root.saved-open: ListView { min-height: 0px; vertical-stretch: 1; for item in ShellBridge.tree: PhoneEntryRow { item: item; } }
if ShellBridge.tree.length == 0 || root.saved-open: ScrollView { min-height: 0px; vertical-stretch: 1;
VerticalLayout { spacing: 8px;
if ShellBridge.tree.length == 0: Text { text: ShellBridge.label-tree-empty; color: Theme.muted; wrap: word-wrap; }
if ShellBridge.bookmarks.length > 0: Text { text: ShellBridge.label-bookmarks; color: Theme.fg; font-weight: 600; wrap: word-wrap; }
for item in ShellBridge.bookmarks: PhoneEntryRow { item: item; }
}
}
}
}
component PhoneDetail inherits Rectangle {
in property <bool> typing;
preferred-width: 0px; horizontal-stretch: 1;
min-width: 0px; min-height: 0px; background: Theme.shaded;
VerticalLayout { spacing: 4px;
if !root.typing && ShellBridge.destination != 1: HorizontalLayout { spacing: 8px; padding-left: 8px; padding-right: 8px; vertical-stretch: 0;
for name[index] in ShellBridge.stages: ActionButton { min-width: 48px; horizontal-stretch: 1; text: name; primary: ShellBridge.stage == index; clicked => { ShellBridge.stage = index; } }
}
if ShellBridge.stage == 1 || ShellBridge.destination == 1: ChatScreen { min-height: 0px; }
if ShellBridge.stage == 2 && ShellBridge.destination != 1: ScrollView { min-height: 0px; vertical-stretch: 1;
VerticalLayout { padding: 8px; spacing: 12px;
if ShellBridge.streams.length == 0: Text { text: ShellBridge.label-stream-empty; color: Theme.muted; wrap: word-wrap; }
for stream in ShellBridge.streams: StreamTile { item: stream; }
CommandList { commands: ShellBridge.detail-actions; }
}
}
if ShellBridge.stage == 0 && ShellBridge.destination != 1: VerticalLayout { spacing: 8px;
if ShellBridge.searchable: TextField { text: ShellBridge.search; placeholder: ShellBridge.label-search; edited(value) => { ShellBridge.search-edited(value); } }
ScrollView { min-height: 0px; vertical-stretch: 1;
VerticalLayout { padding: 8px; spacing: 12px;
if ShellBridge.detail-loading: Text { text: ShellBridge.label-loading; color: Theme.muted; wrap: word-wrap; }
if ShellBridge.detail-error != "": Text { text: ShellBridge.detail-error; color: Theme.error; wrap: word-wrap; }
if ShellBridge.subtitle != "": Text { text: ShellBridge.subtitle; color: Theme.muted; wrap: word-wrap; }
if ShellBridge.description != "": Text { text: ShellBridge.description; color: Theme.fg; wrap: word-wrap; }
for row in ShellBridge.info: VerticalLayout { spacing: 4px; Text { text: row.label; color: Theme.muted; wrap: word-wrap; } Text { text: row.value; color: Theme.fg; wrap: word-wrap; } }
CommandList { commands: ShellBridge.detail-actions; }
for item in ShellBridge.entries: PhoneEntryRow { item: item; }
if ShellBridge.has-previous || ShellBridge.has-next: HorizontalLayout { spacing: 8px;
ActionButton { min-width: 48px; horizontal-stretch: 1; text: ShellBridge.label-previous; enabled: ShellBridge.has-previous; clicked => { ShellBridge.page(false); } }
ActionButton { min-width: 48px; horizontal-stretch: 1; text: ShellBridge.label-next; enabled: ShellBridge.has-next; clicked => { ShellBridge.page(true); } }
}
}
}
}
}
}
component PhoneVoice inherits Rectangle {
in property <bool> typing;
background: Theme.contrast; min-height: voice-content.preferred-height; preferred-height: self.min-height; vertical-stretch: 0;
voice-content := VerticalLayout { padding: 4px; spacing: 4px;
if !root.typing: Text { text: ShellBridge.voice-title + " · " + ShellBridge.voice-status; color: ShellBridge.transmitting ? Theme.success : Theme.fg; overflow: elide; }
HorizontalLayout { spacing: 8px;
ActionButton { min-width: 48px; horizontal-stretch: 1; text: ShellBridge.label-mute; primary: ShellBridge.muted; destructive: ShellBridge.muted; clicked => { ShellBridge.voice(0); } }
ActionButton { min-width: 48px; horizontal-stretch: 1; text: ShellBridge.label-deafen; primary: ShellBridge.deafened; destructive: ShellBridge.deafened; clicked => { ShellBridge.voice(1); } }
if ShellBridge.ptt-enabled: Rectangle {
min-width: 48px; horizontal-stretch: 1; min-height: max(48px,hold-label.preferred-height + 16px);
background: hold.pressed ? Theme.tint : Theme.bg; border-radius: 4px;
accessible-role: button; accessible-label: ShellBridge.label-ptt;
border-width: hold-focus.has-focus ? 2px : 0px; border-color: Theme.outline;
hold-label := Text { text: ShellBridge.label-ptt; color: Theme.fg; vertical-alignment: center; horizontal-alignment: center; wrap: word-wrap; }
hold-focus := FocusScope {
changed has-focus => { if !self.has-focus { ShellBridge.held(false); } }
key-pressed(e) => { if e.text == " " || e.text == Key.Return { ShellBridge.held(true); return accept; } return reject; }
key-released(e) => { if e.text == " " || e.text == Key.Return { ShellBridge.held(false); return accept; } return reject; }
}
hold := TouchArea {
pointer-event(e) => { if e.button == PointerEventButton.left && e.kind == PointerEventKind.down { hold-focus.focus(); ShellBridge.held(true); } else if e.kind == PointerEventKind.up || e.kind == PointerEventKind.cancel { ShellBridge.held(false); } }
moved => { if self.pressed && (self.mouse-x < 0px || self.mouse-y < 0px || self.mouse-x > self.width || self.mouse-y > self.height) { ShellBridge.held(false); } }
}
}
}
}
}
component AndroidShell inherits Rectangle {
property <bool> compact: self.width < 600px;
property <bool> split: self.width >= 840px && !typing;
property <bool> typing: Theme.ime-inset > 0px;
property <length> content-width: max(0px, self.width - (!compact && !typing ? 112px : 0px));
property <string> header: ShellBridge.destination == 3 ? (SettingsBridge.panel-open ? SettingsBridge.title : ShellBridge.destinations[3]) : (((ShellBridge.destination == 0 || ShellBridge.destination == 2) && ShellBridge.depth > 0 && ShellBridge.title != "") ? ShellBridge.title : ShellBridge.destinations[ShellBridge.destination]);
VerticalLayout { spacing: 0px;
if !root.typing: Rectangle { background: Theme.header; min-height: app-bar.preferred-height; preferred-height: self.min-height; vertical-stretch: 0;
app-bar := HorizontalLayout { padding-left: 8px; padding-right: 8px; spacing: 8px;
if ShellBridge.depth > 0 || ShellBridge.destination != 0: PhoneIconAction { kind: 1; label: ShellBridge.label-back; clicked => { ShellBridge.back(); } }
Text { min-width: 0px; text: root.header; color: Theme.fg; font-size: Theme.font-size * 1.2; font-weight: 600; overflow: elide; horizontal-stretch: 1; vertical-alignment: center; }
PhoneIconAction { kind: 0; label: ShellBridge.label-more; clicked => { ShellBridge.menu(); } }
}
}
if ShellBridge.error != "": Text { text: ShellBridge.error; color: Theme.error; wrap: word-wrap; }
if ShellBridge.loading: Text { text: ShellBridge.label-loading; color: Theme.muted; }
HorizontalLayout { spacing: 0px; min-height: 0px; vertical-stretch: 1;
if !root.compact && !root.typing: Rectangle { width: 112px; background: Theme.header;
ScrollView { VerticalLayout { padding: 8px; spacing: 8px;
for label[index] in ShellBridge.destinations: ActionButton { text: label; min-width: 48px; primary: ShellBridge.destination == index; clicked => { ShellBridge.navigate(index); } }
} }
}
if ShellBridge.destination == 3: SettingsScreen { min-width: 0px; min-height: 0px; }
if ShellBridge.destination == 2 && (root.split || ShellBridge.depth == 0): ScrollView { min-height: 0px; width: root.split ? root.content-width * 0.35 : root.content-width;
VerticalLayout { padding: 8px; spacing: 8px;
if ShellBridge.contacts.length == 0: Text { text: ShellBridge.label-empty; color: Theme.muted; wrap: word-wrap; }
for item in ShellBridge.contacts: PhoneEntryRow { item: item; }
}
}
if ShellBridge.destination == 2 && ShellBridge.depth > 0: PhoneDetail { typing: root.typing; }
if ShellBridge.destination == 1: PhoneDetail { typing: root.typing; }
if ShellBridge.destination == 0: HorizontalLayout { spacing: 0px; min-width: 0px; preferred-width: 0px; horizontal-stretch: 1;
if !root.typing && (root.split || ShellBridge.depth == 0): PhoneServerList { width: root.split ? root.content-width * 0.4 : root.content-width; }
if root.split: Rectangle { width: 1px; background: Theme.outline; }
if root.split || ShellBridge.depth > 0 || root.typing: PhoneDetail { typing: root.typing; }
}
}
if ShellBridge.has-voice: PhoneVoice { typing: root.typing; }
if ShellBridge.status != "" && !root.typing: Text { text: ShellBridge.status; color: Theme.muted; overflow: elide; }
if root.compact && !root.typing: HorizontalLayout { spacing: 8px; padding: 4px; vertical-stretch: 0;
for label[index] in ShellBridge.destinations: ActionButton { min-width: 48px; horizontal-stretch: 1; text: label; primary: ShellBridge.destination == index; clicked => { ShellBridge.navigate(index); } }
}
}
}
export component ShellScreen inherits Rectangle {
background: Theme.shaded;
min-width: 0px; min-height: 0px;
@@ -169,7 +359,7 @@ export component ShellScreen inherits Rectangle {
property <length> actual-server: desktop ? min(server-width,max(220px,self.width - actual-sidebar - 295px)) : min(300px,self.width * 0.4);
property <length> main-width: max(0px, self.width - actual-sidebar - (desktop ? 4px : 0px));
property <length> detail-width: max(0px, main-width - (ShellBridge.destination == 0 && !compact ? actual-server + (desktop ? 4px : 0px) : 0px));
VerticalLayout {
if !Theme.android: VerticalLayout {
spacing: 0px;
Rectangle {
height: max(44px, Theme.touch-target); background: Theme.header;
@@ -216,18 +406,13 @@ export component ShellScreen inherits Rectangle {
background: Theme.bg;
VerticalLayout {
spacing: 0px;
if !Theme.android: ScrollView { height: Theme.touch-target; HorizontalLayout { for tab in ShellBridge.tabs: ActionButton {
ScrollView { height: Theme.touch-target; HorizontalLayout { for tab in ShellBridge.tabs: ActionButton {
text: tab.title + (tab.microphone-owner ? " · " + ShellBridge.label-mute : "") + (tab.unread != "" ? " (" + tab.unread + ")" : ""); primary: tab.selected; clicked => { ShellBridge.select(tab.id); }
} } }
if Theme.android: ScrollView { height: Theme.touch-target; HorizontalLayout { for tab in ShellBridge.tabs: HorizontalLayout {
ActionButton { text: tab.title + (tab.microphone-owner ? " · " + ShellBridge.label-mute : "") + (tab.unread != "" ? " (" + tab.unread + ")" : ""); primary: tab.selected; clicked => { ShellBridge.select(tab.id); } }
ActionButton { text: ShellBridge.label-more; clicked => { ShellBridge.context(tab.id); } }
} } }
if root.compact && (ShellBridge.tabs.length == 0 || Theme.android) && ShellBridge.bookmarks.length > 0: ListView { max-height: Theme.android && ShellBridge.tabs.length > 0 ? root.height * 0.25 : root.height; for item in ShellBridge.bookmarks: EntryRow { item: item; } }
if root.compact && ShellBridge.tabs.length == 0 && ShellBridge.bookmarks.length > 0: ListView { max-height: root.height; for item in ShellBridge.bookmarks: EntryRow { item: item; } }
ListView { for item in ShellBridge.tree: EntryRow { item: item; } }
if ShellBridge.tree.length == 0: Text { text: ShellBridge.label-tree-empty; color: Theme.muted; wrap: word-wrap; }
if !root.desktop && !Theme.android: CommandList { commands: ShellBridge.actions; }
if !root.desktop && Theme.android: ScrollView { height: min(Theme.touch-target * 2, root.height * 0.22); CommandList { commands: ShellBridge.actions; } }
if !root.desktop: CommandList { commands: ShellBridge.actions; }
}
}
if root.desktop && ShellBridge.destination == 0: Rectangle {
@@ -239,11 +424,10 @@ export component ShellScreen inherits Rectangle {
background: Theme.shaded;
VerticalLayout {
spacing: 4px;
if !Theme.android || !root.compact || (ShellBridge.stage != 1 && ShellBridge.destination != 1): Rectangle { min-height: 71px; background: Theme.shaded;
Rectangle { min-height: 71px; background: Theme.shaded;
VerticalLayout { padding: 12px; Text { text: ShellBridge.title; color: Theme.fg; font-size: Theme.font-size * 1.6; font-weight: 700; overflow: elide; } Text { text: ShellBridge.subtitle; color: Theme.muted; overflow: elide; } }
}
if !Theme.android: HorizontalLayout { for name[index] in ShellBridge.stages: ActionButton { text: name; primary: ShellBridge.stage == index; clicked => { ShellBridge.stage = index; } } }
if Theme.android && !root.typing: ScrollView { height: Theme.touch-target; vertical-stretch: 0; HorizontalLayout { for name[index] in ShellBridge.stages: ActionButton { text: name; primary: ShellBridge.stage == index; clicked => { ShellBridge.stage = index; } } } }
HorizontalLayout { for name[index] in ShellBridge.stages: ActionButton { text: name; primary: ShellBridge.stage == index; clicked => { ShellBridge.stage = index; } } }
if ShellBridge.stage == 1 || ShellBridge.destination == 1: ChatScreen { width: root.detail-width; }
if ShellBridge.stage == 2 && ShellBridge.destination != 1: ScrollView {
VerticalLayout { padding: 10px; spacing: 10px;
@@ -261,7 +445,7 @@ export component ShellScreen inherits Rectangle {
for row in ShellBridge.info: VerticalLayout { Text { text: row.label; color: Theme.muted; } Text { text: row.value; color: Theme.fg; wrap: word-wrap; } }
CommandList { commands: ShellBridge.detail-actions; }
} }
if !Theme.android || ShellBridge.entries.length > 0: ListView { for item in ShellBridge.entries: EntryRow { item: item; } }
ListView { for item in ShellBridge.entries: EntryRow { item: item; } }
if ShellBridge.has-previous || ShellBridge.has-next: HorizontalLayout {
ActionButton { text: ShellBridge.label-previous; enabled: ShellBridge.has-previous; clicked => { ShellBridge.page(false); } }
ActionButton { text: ShellBridge.label-next; enabled: ShellBridge.has-next; clicked => { ShellBridge.page(true); } }
@@ -277,49 +461,59 @@ export component ShellScreen inherits Rectangle {
if !root.typing: Text { text: ShellBridge.voice-title + " · " + ShellBridge.voice-status; color: ShellBridge.transmitting ? Theme.success : Theme.fg; overflow: elide; }
HorizontalLayout {
spacing: 4px;
ActionButton { min-width: Theme.android ? 48px : 0px; horizontal-stretch: 1; text: ShellBridge.label-mute; primary: Theme.android && ShellBridge.muted; destructive: ShellBridge.muted; clicked => { ShellBridge.voice(0); } }
ActionButton { min-width: Theme.android ? 48px : 0px; horizontal-stretch: 1; text: ShellBridge.label-deafen; primary: Theme.android && ShellBridge.deafened; destructive: ShellBridge.deafened; clicked => { ShellBridge.voice(1); } }
if !Theme.android: Rectangle { min-height: Theme.touch-target; background: desktop-ptt.pressed ? Theme.tint : Theme.bg; border-radius: 4px; accessible-role: button; accessible-label: ShellBridge.label-ptt;
ActionButton { min-width: 0px; horizontal-stretch: 1; text: ShellBridge.label-mute; destructive: ShellBridge.muted; clicked => { ShellBridge.voice(0); } }
ActionButton { min-width: 0px; horizontal-stretch: 1; text: ShellBridge.label-deafen; destructive: ShellBridge.deafened; clicked => { ShellBridge.voice(1); } }
Rectangle { min-height: Theme.touch-target; background: desktop-ptt.pressed ? Theme.tint : Theme.bg; border-radius: 4px; accessible-role: button; accessible-label: ShellBridge.label-ptt;
Text { text: ShellBridge.label-ptt; color: Theme.fg; vertical-alignment: center; horizontal-alignment: center; wrap: word-wrap; }
desktop-ptt := TouchArea { enabled: ShellBridge.ptt-enabled; pointer-event(e) => { if e.kind == PointerEventKind.down { ShellBridge.held(true); } else if e.kind == PointerEventKind.up || e.kind == PointerEventKind.cancel { ShellBridge.held(false); } } }
}
if Theme.android: Rectangle { min-width: 48px; horizontal-stretch: 1; min-height: Theme.touch-target; background: ptt.pressed ? Theme.tint : Theme.bg; border-radius: 4px; opacity: ShellBridge.ptt-enabled ? 1 : 0.45;
accessible-role: button; accessible-label: ShellBridge.label-ptt; accessible-enabled: ShellBridge.ptt-enabled;
border-width: ptt-focus.has-focus ? 2px : 0px; border-color: Theme.outline;
Text { text: ShellBridge.label-ptt; color: Theme.fg; vertical-alignment: center; horizontal-alignment: center; wrap: word-wrap; }
ptt-focus := FocusScope {
enabled: ShellBridge.ptt-enabled;
changed has-focus => { if !self.has-focus { ShellBridge.held(false); } }
key-pressed(e) => { if e.text == " " || e.text == Key.Return { ShellBridge.held(true); return accept; } return reject; }
key-released(e) => { if e.text == " " || e.text == Key.Return { ShellBridge.held(false); return accept; } return reject; }
}
ptt := TouchArea {
enabled: ShellBridge.ptt-enabled;
pointer-event(e) => { if e.button == PointerEventButton.left && e.kind == PointerEventKind.down { ptt-focus.focus(); ShellBridge.held(true); } else if e.kind == PointerEventKind.up || e.kind == PointerEventKind.cancel { ShellBridge.held(false); } }
moved => { if self.pressed && (self.mouse-x < 0px || self.mouse-y < 0px || self.mouse-x > self.width || self.mouse-y > self.height) { ShellBridge.held(false); } }
}
}
}
}
}
if ShellBridge.status != "": Text { text: ShellBridge.status; color: Theme.muted; overflow: elide; }
if root.compact && !root.typing: HorizontalLayout { for label[index] in ShellBridge.destinations: ActionButton { min-width: Theme.android ? 48px : 0px; horizontal-stretch: 1; text: label; primary: ShellBridge.destination == index; clicked => { ShellBridge.navigate(index); } } }
if root.compact: HorizontalLayout { for label[index] in ShellBridge.destinations: ActionButton { min-width: 0px; horizontal-stretch: 1; text: label; primary: ShellBridge.destination == index; clicked => { ShellBridge.navigate(index); } } }
}
if ShellBridge.fullscreen-stream != "": Rectangle {
if Theme.android: AndroidShell { }
if !Theme.android && ShellBridge.fullscreen-stream != "": Rectangle {
background: Theme.contrast;
VerticalLayout {
ActionButton { text: ShellBridge.label-close; clicked => { ShellBridge.fullscreen-stream = ""; } }
for stream in ShellBridge.streams: StreamTile { visible: stream.id == ShellBridge.fullscreen-stream; height: self.visible ? parent.height - Theme.touch-target : 0px; item: stream; }
}
}
if ShellBridge.menu-visible: Rectangle {
if !Theme.android && ShellBridge.menu-visible: Rectangle {
background: Theme.contrast.with-alpha(0.7);
TouchArea { clicked => { ShellBridge.close-menu(); } }
Rectangle {
width: min(parent.width - 24px,360px); height: min(parent.height - 24px, menu.preferred-height);
x: parent.width - self.width - 12px; y: root.compact ? parent.height - self.height - 12px : 12px;
background: Theme.header; border-radius: 8px; border-width: 1px; border-color: Theme.outline;
menu := VerticalLayout { padding: 12px; spacing: 8px; Text { text: ShellBridge.menu-title; color: Theme.fg; font-weight: 600; wrap: word-wrap; } ScrollView { min-height: Theme.android ? min(Theme.touch-target * 3, max(0px, root.height - 160px)) : 0px; CommandList { commands: ShellBridge.menu-actions; } } ActionButton { text: ShellBridge.label-close; clicked => { ShellBridge.close-menu(); } } }
menu := VerticalLayout { padding: 12px; spacing: 8px; Text { text: ShellBridge.menu-title; color: Theme.fg; font-weight: 600; wrap: word-wrap; } ScrollView { min-height: 0px; CommandList { commands: ShellBridge.menu-actions; } } ActionButton { text: ShellBridge.label-close; clicked => { ShellBridge.close-menu(); } } }
}
}
if Theme.android && ShellBridge.fullscreen-stream != "": Rectangle {
background: Theme.contrast;
VerticalLayout {
ActionButton { text: ShellBridge.label-close; clicked => { ShellBridge.fullscreen-stream = ""; } }
ScrollView { min-height: 0px; vertical-stretch: 1;
VerticalLayout { padding: 8px; for stream in ShellBridge.streams: VerticalLayout { if stream.id == ShellBridge.fullscreen-stream: StreamTile { item: stream; } } }
}
}
}
if Theme.android && ShellBridge.menu-visible: Rectangle {
background: Theme.contrast.with-alpha(0.7);
TouchArea { clicked => { ShellBridge.close-menu(); } }
Rectangle {
width: min(parent.width - 16px,480px); height: min(parent.height - 16px,phone-menu.preferred-height);
x: (parent.width - self.width)/2; y: parent.height - self.height - 8px;
background: Theme.header; border-radius: 8px; border-width: 1px; border-color: Theme.outline;
phone-menu := VerticalLayout { padding: 12px; spacing: 8px;
menu-title := Text { text: ShellBridge.menu-title; color: Theme.fg; font-weight: 600; wrap: word-wrap; max-height: root.height * 0.2; overflow: elide; }
ScrollView { height: min(phone-commands.preferred-height,max(0px,root.height - menu-title.preferred-height - menu-close.preferred-height - 64px));
phone-commands := CommandList { commands: ShellBridge.menu-actions; }
}
menu-close := ActionButton { text: ShellBridge.label-close; clicked => { ShellBridge.close-menu(); } }
}
}
}
}