Implement Android Room UI and customizable palette
android-ci / android-arm64 (push) Successful in 17m10s

This commit is contained in:
bit9992 committed 2026-11-15 12:32:59 +03:00
1 parent 057bfae87c
commit 87265a3e75
26 files changed
+825 -135

No files matched your search

+27 -15
View File
@@ -1,6 +1,6 @@
import { ListView, ScrollView } from "std-widgets.slint";
import { Theme } from "theme.slint";
import { ActionButton, TextField, Toggle } from "controls.slint";
import { ActionButton, TextField, Toggle, RoomIconButton } from "controls.slint";
export struct ChatMeasure { width: float, height: float }
export struct ChatRun {
@@ -132,8 +132,8 @@ component RichRowContent inherits Rectangle {
width: max(root.viewport-width, root.visual.content-width * 1px);
background: root.visual.kind == 3 || root.visual.kind == 7 ? Theme.header
: root.visual.kind == 4 ? Theme.deviant : root.visual.kind == 8 ? Theme.bg
: root.visual.kind == 11 ? Theme.header : !root.visual.compact && !root.visual.header && !root.inert ? (root.visual.own ? Theme.contrast : Theme.muted) : transparent;
border-radius: root.visual.kind == 11 ? 10px : 4px;
: root.visual.kind == 11 ? Theme.header : !root.visual.compact && !root.visual.header && !root.inert ? (Theme.android ? (root.visual.own ? Theme.bg : transparent) : (root.visual.own ? Theme.contrast : Theme.muted)) : transparent;
border-radius: Theme.android ? 12px : root.visual.kind == 11 ? 10px : 4px;
row-focus := FocusScope {
accessible-role: text;
accessible-label: root.visual.plain;
@@ -157,7 +157,7 @@ component RichRowContent inherits Rectangle {
Rectangle { x: 12px; y: 6px; width: 10px; height: 10px; border-radius: 5px; background: Theme.muted; }
Rectangle { x: 6px; y: 18px; width: 22px; height: 12px; border-radius: 8px; background: Theme.muted; }
}
Text { text: root.visual.author; color: Theme.high-contrast ? Theme.fg : root.visual.author-color; font-family: Theme.font-family; font-size: 13px; font-weight: 700; overflow: elide; vertical-alignment: center; }
Text { text: root.visual.author; color: Theme.high-contrast || Theme.android ? Theme.fg : root.visual.author-color; font-family: Theme.font-family; font-size: 13px; font-weight: 700; overflow: elide; vertical-alignment: center; }
if !root.visual.compact: Text { text: root.visual.time; color: Theme.muted; font-family: Theme.font-family; font-size: 13px; vertical-alignment: center; horizontal-alignment: right; horizontal-stretch: 1; }
}
for run in root.visual.runs: Rectangle {
@@ -167,7 +167,7 @@ component RichRowContent inherits Rectangle {
if run.image-ready && !run.concealed: Image { source: run.asset; image-fit: contain; }
if !run.image-ready && !run.concealed: Text {
text: run.text;
color: run.use-color && !Theme.high-contrast ? run.foreground : run.action != "" && !root.inert ? Theme.tint : Theme.fg;
color: run.use-color && !Theme.high-contrast ? run.foreground : run.action != "" && !root.inert ? (Theme.android ? Theme.tint-text : Theme.tint) : Theme.fg;
font-family: run.mono ? "monospace" : Theme.font-family;
font-size: run.font-size * 1px; font-weight: run.font-weight; font-italic: run.italic;
vertical-alignment: top;
@@ -255,7 +255,7 @@ export component MarkupPanel inherits Rectangle {
}
export component ChatScreen inherits Rectangle {
background: Theme.shaded;
background: Theme.android ? Theme.header : Theme.shaded;
min-width: 0px; min-height: 0px;
preferred-width: 100%; preferred-height: 100%;
private property <bool> show-tools;
@@ -305,7 +305,7 @@ export component ChatScreen inherits Rectangle {
Path { x: parent.width - 24px; y: (parent.height - 6px) / 2; width: 10px; height: 6px; commands: "M 0 0 L 5 5 L 10 0"; stroke: Theme.fg; stroke-width: 1.5px; }
clicked => { root.show-conversations = true; ChatBridge.mobile-overlay = true; }
}
ActionButton { text: ChatBridge.tr("admin.search"); clicked => { root.show-search = true; ChatBridge.mobile-overlay = true; } }
RoomIconButton { icon: "search"; label: ChatBridge.tr("admin.search"); clicked => { root.show-search = true; ChatBridge.mobile-overlay = true; } }
}
if !Theme.android && root.show-search: HorizontalLayout {
padding-left: 12px; padding-right: 12px; spacing: 8px;
@@ -349,9 +349,9 @@ export component ChatScreen inherits Rectangle {
error-text := Text { width: error-scroll.visible-width; text: ChatBridge.error; color: Theme.error; wrap: word-wrap; font-family: Theme.font-family; font-size: 13px; accessible-role: text; }
}
composer := Rectangle {
background: Theme.bg; border-radius: 8px; border-width: 1px; border-color: input.has-focus ? Theme.tint : Theme.outline;
min-width: 0px; min-height: Theme.android ? 116px : 92px;
max-height: Theme.android ? max(116px, root.allocated-height * 0.5) : max(120px, root.allocated-height * 0.55); vertical-stretch: 0;
background: Theme.bg; border-radius: Theme.android ? 12px : 8px; border-width: Theme.android ? 0px : 1px; border-color: input.has-focus ? Theme.tint : Theme.outline;
min-width: 0px; min-height: Theme.android ? 64px : 92px;
max-height: Theme.android ? max(64px, root.allocated-height * 0.5) : max(120px, root.allocated-height * 0.55); vertical-stretch: 0;
VerticalLayout {
min-width: 0px; preferred-width: 0px;
padding: 8px; spacing: 4px;
@@ -375,6 +375,12 @@ export component ChatScreen inherits Rectangle {
height: min(160px, ChatBridge.completions.length * Theme.touch-target);
for item[index] in ChatBridge.completions: ActionButton { text: item.label; primary: index == ChatBridge.completion-index; clicked => { ChatBridge.complete(index); root.show-emoji = false; } }
}
HorizontalLayout {
spacing: Theme.android ? 8px : 0px; min-width: 0px;
if Theme.android: RoomIconButton {
icon: "plus"; label: ChatBridge.tr("chat.toolbar.more");
clicked => { root.show-tools = true; ChatBridge.mobile-overlay = true; }
}
editor-scroll := ScrollView {
content-width: Theme.android ? self.visible-width : max(self.visible-width, ChatBridge.editor-width * 1px);
horizontal-scrollbar-policy: Theme.android ? always-off : as-needed;
@@ -457,11 +463,16 @@ export component ChatScreen inherits Rectangle {
}
}
}
HorizontalLayout {
spacing: Theme.android ? 8px : 4px;
if Theme.android: ActionButton { text: ChatBridge.tr("chat.toolbar.more"); clicked => { root.show-tools = true; ChatBridge.mobile-overlay = true; } }
ActionButton { text: ChatBridge.tr("chat.emoji.label"); enabled: ChatBridge.enabled && !ChatBridge.composing; clicked => { root.show-emoji = !root.show-emoji; root.show-tools = false; ChatBridge.emoji(""); if Theme.android { ChatBridge.mobile-overlay = true; } } }
if !Theme.android && ChatBridge.can-attach: ActionButton { text: ChatBridge.tr("chat.attachment.label"); enabled: ChatBridge.enabled; clicked => { ChatBridge.attach(); } }
if Theme.android: RoomIconButton {
icon: "send"; label: ChatBridge.tr("ui.send"); primary: true;
enabled: ChatBridge.can-send && !ChatBridge.composing;
clicked => { ChatBridge.send(); }
}
}
if !Theme.android: HorizontalLayout {
spacing: 4px;
ActionButton { text: ChatBridge.tr("chat.emoji.label"); enabled: ChatBridge.enabled && !ChatBridge.composing; clicked => { root.show-emoji = !root.show-emoji; root.show-tools = false; ChatBridge.emoji(""); } }
if ChatBridge.can-attach: ActionButton { text: ChatBridge.tr("chat.attachment.label"); enabled: ChatBridge.enabled; clicked => { ChatBridge.attach(); } }
Rectangle { horizontal-stretch: 1; }
ActionButton { text: ChatBridge.tr("ui.send"); primary: true; enabled: ChatBridge.can-send && !ChatBridge.composing; clicked => { ChatBridge.send(); } }
}
@@ -521,6 +532,7 @@ export component ChatScreen inherits Rectangle {
min-width: 0px; min-height: 0px; horizontal-scrollbar-policy: always-off;
VerticalLayout {
spacing: 8px;
ActionButton { text: ChatBridge.tr("chat.emoji.label"); enabled: ChatBridge.enabled && !ChatBridge.composing; clicked => { root.show-tools = false; root.show-emoji = true; ChatBridge.emoji(""); } }
if ChatBridge.can-attach: ActionButton { text: ChatBridge.tr("chat.attachment.label"); enabled: ChatBridge.enabled && !ChatBridge.composing; clicked => { ChatBridge.mobile-overlay = false; ChatBridge.attach(); } }
for item[index] in ChatBridge.completions: ActionButton { text: item.label; primary: index == ChatBridge.completion-index; clicked => { ChatBridge.complete(index); ChatBridge.mobile-overlay = false; } }
ActionButton { text: ChatBridge.tr("native.chat.conversations"); enabled: ChatBridge.tabs.length > 0; clicked => { root.show-tools = false; root.show-conversations = true; } }