Implement Android Room UI and customizable palette
android-ci / android-arm64 (push) Successful in 17m10s
android-ci / android-arm64 (push) Successful in 17m10s
This commit is contained in:
1 parent
057bfae87c
commit
87265a3e75
26 files changed
+825
-135
No files matched your search
+30
-6
@@ -1,4 +1,4 @@
|
||||
import { ScrollView, TextEdit } from "std-widgets.slint";
|
||||
import { ScrollView, TextEdit, Slider } from "std-widgets.slint";
|
||||
import { Theme } from "theme.slint";
|
||||
import { ActionButton, TextField, Choice, Toggle } from "controls.slint";
|
||||
import { ShellBridge, ShellCommand } from "shell.slint";
|
||||
@@ -31,16 +31,21 @@ export global DialogBridge {
|
||||
// Android forms share a bounded viewport: context and decisions stay on screen while
|
||||
// every field, auxiliary action and confirmation remains scrollable above the IME.
|
||||
component AndroidDialog inherits Rectangle {
|
||||
background: Theme.contrast;
|
||||
background: Theme.bg;
|
||||
border-radius: DialogBridge.onboarding || Theme.ime-inset > 0px ? 0px : 20px;
|
||||
accessible-role: form;
|
||||
accessible-label: DialogBridge.title;
|
||||
property <bool> advanced: false;
|
||||
property <length> focused-y: -1px;
|
||||
property <string> focused-field;
|
||||
property <bool> short: root.height < 400px;
|
||||
property <bool> stack-actions: root.width < 480px && !root.short;
|
||||
property <bool> stack-actions: root.width < 360px && Theme.font-size > 17px && !root.short;
|
||||
VerticalLayout {
|
||||
padding: 12px; spacing: 8px;
|
||||
padding: 20px; spacing: 12px;
|
||||
if !DialogBridge.onboarding && !root.short && Theme.ime-inset == 0px: HorizontalLayout {
|
||||
alignment: center; vertical-stretch: 0;
|
||||
Rectangle { width: 32px; height: 3px; border-radius: 2px; background: Theme.muted; }
|
||||
}
|
||||
Text {
|
||||
text: DialogBridge.title; color: Theme.fg;
|
||||
font-family: Theme.font-family; font-size: Theme.font-size * 1.25; font-weight: 700;
|
||||
@@ -74,7 +79,7 @@ component AndroidDialog inherits Rectangle {
|
||||
text: field.label; color: Theme.fg; wrap: word-wrap;
|
||||
font-family: Theme.font-family; font-size: Theme.font-size;
|
||||
}
|
||||
if field.kind == 0 || field.kind == 1 || field.kind == 3 || field.kind == 4: TextField {
|
||||
if field.kind == 0 || field.kind == 1 || field.kind == 3 || (field.kind == 4 && field.id != "db" && field.id != "volume"): TextField {
|
||||
text: field.value; placeholder: field.label; secret: field.kind == 1;
|
||||
enabled: field.enabled && !DialogBridge.busy; min-width: 0px;
|
||||
edited(value) => { DialogBridge.edit(field.id, value); }
|
||||
@@ -90,6 +95,21 @@ component AndroidDialog inherits Rectangle {
|
||||
}
|
||||
}
|
||||
}
|
||||
if field.kind == 4 && (field.id == "db" || field.id == "volume"): VerticalLayout {
|
||||
spacing: 8px;
|
||||
Text {
|
||||
text: field.id == "db" ? "\{round(field.value.to-float() * 10) / 10} dB" : "\{round(field.value.to-float() * 100)}%";
|
||||
color: Theme.tint-text; font-family: Theme.font-family; font-size: Theme.font-size;
|
||||
horizontal-alignment: right;
|
||||
}
|
||||
Slider {
|
||||
min-height: 48px; minimum: field.id == "db" ? -200 : 0;
|
||||
maximum: field.id == "db" ? 10 : 2; value: field.value.to-float();
|
||||
enabled: field.enabled && !DialogBridge.busy;
|
||||
accessible-label: field.label;
|
||||
changed(value) => { DialogBridge.edit(field.id, "\{round(value * 100) / 100}"); }
|
||||
}
|
||||
}
|
||||
if field.kind == 2: TextEdit {
|
||||
text: field.value; enabled: field.enabled && !DialogBridge.busy; wrap: word-wrap;
|
||||
height: max(96px, Theme.font-size * 4); min-width: 0px;
|
||||
@@ -217,7 +237,11 @@ export component ShellDialog inherits Rectangle {
|
||||
property <bool> phone: Theme.android;
|
||||
// An overlay blocks background pointer input without turning Cancel into a submit.
|
||||
TouchArea { }
|
||||
if root.phone: AndroidDialog { width: root.width; height: root.height; }
|
||||
if root.phone: AndroidDialog {
|
||||
width: min(root.width, 640px); x: (root.width - self.width) / 2;
|
||||
height: DialogBridge.onboarding || Theme.ime-inset > 0px || root.height < 480px ? root.height : min(root.height - 24px, 660px);
|
||||
y: root.height - self.height;
|
||||
}
|
||||
if !root.phone: dialog := Rectangle {
|
||||
width: min(parent.width - 24px, 640px);
|
||||
height: min(parent.height - 24px, layout.preferred-height);
|
||||
|
||||
Reference in new issue
Block a user