Add silent-mode and low-battery indicators to Android preview form

This commit is contained in:
James Babcock committed 2026-07-20 12:02:20 -07:00
1 parent bbd3bbcf13
commit a5c6f18795
8 files changed
+216 -3

No files matched your search

+17
View File
@@ -11,6 +11,13 @@
<StackLayout row="0" visibility="{{ displayPreviewVisibility }}">
<Image src="{{ displayPreview }}" stretch="fill" height="{{ displayPreviewHeight }}" />
</StackLayout>
<GridLayout
row="0"
class="display-preview-message"
height="{{ displayPreviewHeight }}"
visibility="{{ displayPreviewMessageVisibility }}">
<Label text="{{ displayPreviewMessage }}" textWrap="true" horizontalAlignment="center" verticalAlignment="center" />
</GridLayout>
<GridLayout row="1" rows="auto,auto,auto,*" class="p-20">
<StackLayout row="0" class="m-b-8">
<StackLayout visibility="{{ evenAppConflictWarningVisibility }}">
@@ -62,6 +69,16 @@
width="{{ landscapeDisplayPreviewWidth }}"
height="{{ landscapeDisplayPreviewHeight }}" />
</StackLayout>
<GridLayout
row="0"
col="0"
class="display-preview-message"
horizontalAlignment="left"
width="{{ landscapeDisplayPreviewWidth }}"
height="{{ landscapeDisplayPreviewHeight }}"
visibility="{{ displayPreviewMessageVisibility }}">
<Label text="{{ displayPreviewMessage }}" textWrap="true" horizontalAlignment="center" verticalAlignment="center" />
</GridLayout>
<StackLayout row="0" col="1" class="m-l-16">
<GridLayout rows="auto,auto,auto" columns="*,*,*">
<Button row="0" col="1" text="Swipe up" tap="{{ onSyntheticUpTap }}" />
+24 -1
View File
@@ -8,6 +8,7 @@ export class MainViewModel extends Observable {
private _status = "Disconnected.";
private _log = "";
private _displayPreview: ImageSource | null = null;
private _displayPreviewMessage = "";
private _layoutOrientation: LayoutOrientation = this.readLayoutOrientation();
private _activeTextSettingId: string | null = null;
private _activeTextSettingTitle = "";
@@ -27,6 +28,7 @@ export class MainViewModel extends Observable {
this.status = snapshot.status;
this.log = snapshot.log;
this.displayPreview = snapshot.displayPreview;
this.displayPreviewMessage = snapshot.displayPreviewMessage;
this.phase = snapshot.phase;
this.activeTextSettingId = snapshot.activeTextSettingId;
this.activeTextSettingTitle = snapshot.activeTextSettingTitle;
@@ -75,12 +77,33 @@ export class MainViewModel extends Observable {
}
}
get displayPreviewMessage(): string {
return this._displayPreviewMessage;
}
set displayPreviewMessage(value: string) {
if (this._displayPreviewMessage !== value) {
this._displayPreviewMessage = value;
this.notifyPropertyChange("displayPreviewMessage", value);
this.notifyPropertyChange("displayPreviewMessageVisibility", this.displayPreviewMessageVisibility);
this.notifyPropertyChange("displayPreviewVisibility", this.displayPreviewVisibility);
}
}
get hasDisplayPreview(): boolean {
return this._displayPreview !== null;
}
/**
* The preview and its stand-in message are mutually exclusive and occupy the
* same box, so the form doesn't reflow when one replaces the other.
*/
get displayPreviewVisibility(): "visible" | "collapse" {
return this.hasDisplayPreview ? "visible" : "collapse";
return this.hasDisplayPreview && !this._displayPreviewMessage ? "visible" : "collapse";
}
get displayPreviewMessageVisibility(): "visible" | "collapse" {
return this._displayPreviewMessage ? "visible" : "collapse";
}
get displayPreviewHeight(): number {