From 1154474754083197605f80711bbeb678232e8e65 Mon Sep 17 00:00:00 2001 From: James Babcock Date: Tue, 8 Sep 2026 02:36:16 -0700 Subject: [PATCH] Add a phone preview Rotation setting; improve landscape layout --- CHANGELOG | 1 + app/app.css | 21 ++++++++ app/app.ts | 2 + app/native/phone-rotation.ts | 30 +++++++++++ app/phone-ui/main-page.xml | 43 ++++++++-------- app/phone-ui/main-view-model.ts | 48 +++++++++++++----- app/phone-ui/remote-controls.xml | 81 +++++++++++++++--------------- app/ui/dashboard-settings.ts | 11 ++++ app/ui/dashboard/settings-menus.ts | 2 + 9 files changed, 165 insertions(+), 74 deletions(-) create mode 100644 app/native/phone-rotation.ts diff --git a/CHANGELOG b/CHANGELOG index 322a8b8a..8825e13a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,7 @@ * Navigate and terminal app: App-specific screen size/position setting * Transcribe app: Scrolling; automatic reconnection; insert newlines * Notifications: Add notification filters +* Phone screen preview: Add rotation option; improve landscape layout ## 0.6.5 - 2026-09-04 * Changed context menu gestures: — for system, ●— for app context menu. diff --git a/app/app.css b/app/app.css index 1d96f325..faa23972 100644 --- a/app/app.css +++ b/app/app.css @@ -201,6 +201,27 @@ Button.-primary { height: 20; tint-color: #333333; } +/* Landscape uses the full page height and a shared left edge for tabs/pad. */ +.landscape-layout .remote-controls { + margin: 0; +} +.landscape-layout .controls-tab-bar { + margin-bottom: 2; +} +.landscape-layout .tab-button { + margin-left: 1; + margin-right: 1; + min-width: 0; +} +.landscape-layout .tab-button[col="0"] { + margin-left: 0; +} +.landscape-layout .tab-icon-button { + width: 48; +} +.landscape-layout .tab-icon-button[col="4"] { + margin-right: 0; +} .ns-dark .tab-icon { tint-color: #cccccc; } diff --git a/app/app.ts b/app/app.ts index b1f9e59b..7a2f44f9 100644 --- a/app/app.ts +++ b/app/app.ts @@ -7,9 +7,11 @@ purpose of the file is to pass control to the app’s first module. import { Application } from '@nativescript/core' import { registerShareIntentHandler } from './native/share-intents' import { installNativeUserAgent } from './util/http' +import { registerPhoneRotation } from './native/phone-rotation' installNativeUserAgent() registerShareIntentHandler() +registerPhoneRotation() Application.run({ moduleName: 'app-root' }) diff --git a/app/native/phone-rotation.ts b/app/native/phone-rotation.ts new file mode 100644 index 00000000..652a1fd2 --- /dev/null +++ b/app/native/phone-rotation.ts @@ -0,0 +1,30 @@ +import { Application, isAndroid } from "@nativescript/core"; +import { getStringSetting, onSettingsStoreChanged } from "./settings-store"; + +// Shared with phoneRotationSetting; keep startup independent of the glasses UI. +const ROTATION_KEY = "phone.rotation"; + +/** Installed once on the UI thread; also covers navigation and activity recreation. */ +export function registerPhoneRotation(): void { + if (!isAndroid) return; + + const apply = (activity = Application.android.foregroundActivity ?? Application.android.startActivity): void => { + if (!activity) return; + const orientations = android.content.pm.ActivityInfo; + const requested = { + auto: orientations.SCREEN_ORIENTATION_UNSPECIFIED, + portrait: orientations.SCREEN_ORIENTATION_PORTRAIT, + landscape: orientations.SCREEN_ORIENTATION_SENSOR_LANDSCAPE, + }[getStringSetting(ROTATION_KEY, "auto")] ?? orientations.SCREEN_ORIENTATION_UNSPECIFIED; + if (activity.getRequestedOrientation() !== requested) { + activity.setRequestedOrientation(requested); + } + }; + + Application.android.on(Application.android.activityCreatedEvent, (args) => apply(args.activity)); + Application.android.on(Application.android.activityResumedEvent, (args) => apply(args.activity)); + onSettingsStoreChanged((key) => { + if (key === ROTATION_KEY) apply(); + }); + apply(); +} diff --git a/app/phone-ui/main-page.xml b/app/phone-ui/main-page.xml index 2eb80beb..c10ee6a5 100644 --- a/app/phone-ui/main-page.xml +++ b/app/phone-ui/main-page.xml @@ -38,30 +38,31 @@ - - - - + + + + + + - - - + + + +