Files

190 lines
12 KiB
XML

<Page xmlns="http://schemas.nativescript.org/tns.xsd" xmlns:rc="phone-ui" navigatingTo="navigatingTo" loaded="loaded" unloaded="unloaded">
<ActionBar>
<!-- Custom titleView: app title on the left; connection status and
the warning-triangle indicator right-aligned beside the overflow
menu. -->
<GridLayout columns="auto,*,auto,auto" width="100%" verticalAlignment="center">
<Label col="0" text="Faceclaw" class="action-bar-title" />
<Label col="2" text="{{ connectionStatusLabel }}" tap="{{ onConnectionStatusTap }}" class="action-bar-status" />
<Label col="3" text="&#x26A0;&#xFE0F;" tap="{{ onWarningIconTap }}" visibility="{{ warningIconVisibility }}" class="action-bar-warning" />
</GridLayout>
<ActionItem text="{{ buttonLabel }}" tap="{{ onTap }}" isEnabled="{{ connectItemEnabled }}" visibility="{{ glassesMenuItemsVisibility }}" android.position="popup" />
<ActionItem text="Pair glasses" tap="{{ onPairGlassesTap }}" isEnabled="{{ canRun }}" android.position="popup" />
<ActionItem text="Permissions" tap="{{ onPermissionsTap }}" android.position="popup" />
<ActionItem text="Conversations" tap="{{ onConversationsTap }}" android.position="popup" />
<ActionItem text="Take screenshot" tap="{{ onTakeScreenshotTap }}" android.position="popup" />
<ActionItem text="Record screen" tap="{{ onRecordScreenTap }}" android.position="popup" />
<ActionItem text="Check firmware" tap="{{ onCheckFirmwareTap }}" isEnabled="{{ canRun }}" visibility="{{ glassesMenuItemsVisibility }}" android.position="popup" />
<ActionItem text="Uninstall custom firmware" tap="{{ onUninstallFirmwareTap }}" isEnabled="{{ canRun }}" visibility="{{ glassesMenuItemsVisibility }}" android.position="popup" />
</ActionBar>
<GridLayout>
<GridLayout rows="auto,*" visibility="{{ portraitLayoutVisibility }}">
<StackLayout row="0" visibility="{{ displayPreviewVisibility }}">
<Image src="{{ displayPreview }}" stretch="fill" height="{{ displayPreviewHeight }}"
tap="{{ onMirrorTap }}" doubleTap="{{ onMirrorDoubleTap }}" longPress="{{ onMirrorLongPress }}" swipe="{{ onMirrorSwipe }}" />
</StackLayout>
<GridLayout
row="0"
class="display-preview-message"
height="{{ displayPreviewHeight }}"
visibility="{{ displayPreviewMessageVisibility }}">
<Label text="{{ displayPreviewMessage }}" textWrap="true" horizontalAlignment="center" verticalAlignment="center" />
</GridLayout>
<!-- The controls get the whole star row so the touchpad can
center in the leftover height. -->
<GridLayout row="1" rows="*,auto" class="p-20">
<rc:remote-controls row="0" visibility="{{ controlsVisibility }}" />
<Button row="1" text="Stop recording" tap="{{ onStopRecordingTap }}" visibility="{{ stopRecordingButtonVisibility }}" />
</GridLayout>
</GridLayout>
<GridLayout class="landscape-layout" visibility="{{ landscapeLayoutVisibility }}">
<GridLayout rows="*" columns="*,345">
<GridLayout col="0" layoutChanged="{{ onLandscapePreviewLayoutChanged }}">
<StackLayout visibility="{{ displayPreviewVisibility }}" horizontalAlignment="left" verticalAlignment="center">
<Image
src="{{ displayPreview }}"
stretch="fill"
width="{{ landscapeDisplayPreviewWidth }}"
height="{{ landscapeDisplayPreviewHeight }}"
tap="{{ onMirrorTap }}" doubleTap="{{ onMirrorDoubleTap }}" longPress="{{ onMirrorLongPress }}" swipe="{{ onMirrorSwipe }}" />
</StackLayout>
<GridLayout
class="display-preview-message"
horizontalAlignment="left"
verticalAlignment="center"
width="{{ landscapeDisplayPreviewWidth }}"
height="{{ landscapeDisplayPreviewHeight }}"
visibility="{{ displayPreviewMessageVisibility }}">
<Label text="{{ displayPreviewMessage }}" textWrap="true" horizontalAlignment="center" verticalAlignment="center" />
</GridLayout>
</GridLayout>
<GridLayout col="1" rows="*,auto">
<rc:remote-controls row="0" visibility="{{ controlsVisibility }}" />
<Button row="1" text="Stop recording" tap="{{ onStopRecordingTap }}" visibility="{{ stopRecordingButtonVisibility }}" />
</GridLayout>
</GridLayout>
</GridLayout>
<!-- Developer BLE-bandwidth indicator: overlays the bottom edge of the
page in both orientations. -->
<Label
text="{{ bleBandwidthLabel }}"
visibility="{{ bleBandwidthVisibility }}"
class="ble-bandwidth-indicator"
horizontalAlignment="center"
verticalAlignment="bottom" />
<ScrollView
class="warnings-modal"
visibility="{{ warningsModalVisibility }}"
width="{{ warningsModalWidth }}"
horizontalAlignment="center"
verticalAlignment="center">
<StackLayout class="warnings-modal-content">
<Label text="Attention needed" class="h2" />
<StackLayout visibility="{{ evenAppConflictWarningVisibility }}" class="warnings-modal-item">
<Label text="{{ evenAppConflictMessage }}" textWrap="true" />
<Button text="Open Even app settings" tap="{{ onOpenEvenAppSettingsTap }}" class="-primary" />
</StackLayout>
<StackLayout visibility="{{ firmwareWarningVisibility }}" class="warnings-modal-item">
<Label text="{{ firmwareWarningMessage }}" textWrap="true" />
<Button text="Install custom firmware" tap="{{ onInstallFirmwareTap }}" class="-primary" />
</StackLayout>
<StackLayout visibility="{{ batteryOptimizationWarningVisibility }}" class="warnings-modal-item">
<Label text="Android will slow Faceclaw to a crawl when the phone screen is off unless it is exempt from battery optimization." textWrap="true" />
<Button text="Allow unrestricted background usage" tap="{{ onAllowBackgroundUsageTap }}" class="-primary" />
</StackLayout>
<StackLayout visibility="{{ fontsMissingWarningVisibility }}" class="warnings-modal-item">
<Label text="The G2 fonts have not been extracted, so EvenHub apps will render with fallback fonts. Preparing them downloads the official firmware to extract its fonts; your glasses are not reflashed." textWrap="true" />
<Button text="Prepare G2 fonts" tap="{{ onPrepareFontsTap }}" class="-primary" />
</StackLayout>
<StackLayout visibility="{{ alarmReliabilityWarningVisibility }}" class="warnings-modal-item">
<Label text="{{ alarmReliabilityMessage }}" textWrap="true" />
<Button text="Open phone settings" tap="{{ onFixAlarmReliabilityTap }}" class="-primary" />
</StackLayout>
<Button text="Close" tap="{{ onWarningsModalCloseTap }}" />
</StackLayout>
</ScrollView>
<!-- Keyboard-input mode: anchored to the bottom of the (keyboard-
shrunk) page, so it sits in the space below the mirror and only
overlaps the mirror when the open keyboard leaves too little
room. The controls are collapsed while it is up.
NativeScript has no maxHeight, so the transparent outer grid's
fixed height is the cap: it shrinks to the page when the keyboard
leaves less room than that, and the bottom-aligned modal inside
sizes to its content within it. Past the cap the fields scroll
and the buttons stay put.
Any GridLayout in here needs an explicit rows="auto": the implicit
single star row stretches to fill all the height offered (Stack-
and DockLayout offer it AT_MOST the remaining height), which is
what made the form balloon with the keyboard minimized. -->
<GridLayout
height="440"
verticalAlignment="bottom"
isPassThroughParentEnabled="true"
visibility="{{ textSettingEditorVisibility }}">
<DockLayout
class="system-name-modal"
stretchLastChild="true"
horizontalAlignment="stretch"
verticalAlignment="bottom">
<Label dock="top" text="{{ activeTextEditorTitle }}" class="h2" />
<GridLayout dock="bottom" columns="*,*" rows="auto" class="m-t-8">
<Button col="0" text="Cancel" tap="{{ onTextSettingCancelTap }}" />
<Button col="1" text="Submit" tap="{{ onTextSettingSubmitTap }}" class="-primary" />
</GridLayout>
<ScrollView>
<StackLayout>
<!-- Per-field labels only matter with two fields; a single-field
edit's field title is the same string as the editor title. -->
<Label text="{{ activeTextSettingTitle }}" visibility="{{ secondaryTextSettingVisibility }}" />
<TextField
id="settingsTextField"
text="{{ activeTextSettingValue }}"
textChange="{{ onTextSettingTextChange }}"
returnPress="{{ onPrimaryTextSettingReturnPress }}"
autocorrect="false"
autocapitalizationType="none"
keyboardType="{{ activeTextSettingKeyboardType }}"
secure="{{ activeTextSettingSecure }}"
returnKeyType="{{ primaryTextSettingReturnKeyType }}" />
<StackLayout visibility="{{ secondaryTextSettingVisibility }}">
<Label text="{{ secondaryTextSettingTitle }}" />
<TextField
id="secondarySettingsTextField"
text="{{ secondaryTextSettingValue }}"
textChange="{{ onSecondaryTextSettingTextChange }}"
returnPress="{{ onSecondaryTextSettingReturnPress }}"
autocorrect="false"
autocapitalizationType="none"
keyboardType="{{ secondaryTextSettingKeyboardType }}"
secure="{{ secondaryTextSettingSecure }}"
returnKeyType="done" />
</StackLayout>
<GridLayout
columns="*,auto"
rows="auto"
visibility="{{ activeTextEditorToggleVisibility }}"
class="m-t-8">
<Label col="0" text="{{ activeTextEditorToggleLabel }}" verticalAlignment="center" />
<Switch
col="1"
checked="{{ activeTextEditorToggleValue }}"
checkedChange="{{ onTextSettingToggleChange }}" />
</GridLayout>
</StackLayout>
</ScrollView>
</DockLayout>
</GridLayout>
<!-- Keyboard-input panel (the keyboard button under the mirror):
the phone's end of the keyboard dialog on the glasses
(ui/shell/keyboard-input.ts). Same placement and collapsing rules
as the setting editor above. Enter inserts a newline; the send
buttons pick a destination directly. Bound to its own model
(KeyboardInputViewModel, shared with iOS). -->
<rc:keyboard-input-panel bindingContext="{{ keyboardInputModel }}" />
</GridLayout>
</Page>