forked from Blendman974/faceclaw
Add a proper app icon, remove g2-kit dependency, add ACKNOWLEDGEMENTS file
This commit is contained in:
1 parent
3ac080aea5
commit
3aa3bcba63
19 files changed
+63
-35
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { EventSourceType, EventSourceTypeName, OsEventTypeList, OsEventTypeName, } from "g2-kit/lite";
|
||||
import { ImageSource } from "@nativescript/core";
|
||||
import { EventSourceType, EventSourceTypeName, OsEventTypeList, OsEventTypeName } from "./events";
|
||||
import { loadDeviceAddresses } from "./device-addresses";
|
||||
import { ensureBlePermissions } from "./android-permissions";
|
||||
import { FaceclawCommunicatorBridge, type FrameMetrics, type RawInputEvent } from "../native/faceclaw-communicator";
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
getDashboardNightscoutSettings,
|
||||
getDashboardSystemCardName,
|
||||
receiveInput,
|
||||
resetDashboardSleepTimerAndWake,
|
||||
setDashboardBatteryLevels,
|
||||
setDashboardActions,
|
||||
setDashboardNightscoutApiToken,
|
||||
@@ -238,6 +239,7 @@ class DashboardController {
|
||||
this.log = "";
|
||||
this.lastInput = "waiting...";
|
||||
this.lastSys = "none yet";
|
||||
resetDashboardSleepTimerAndWake();
|
||||
this.refreshEvenAppStatus();
|
||||
this.setPhase("connecting");
|
||||
this.setStatus("Connecting to the glasses...");
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
export const EventSourceType = {
|
||||
TOUCH_EVENT_FORM_DUMMY_NULL: 0,
|
||||
TOUCH_EVENT_FROM_GLASSES_R: 1,
|
||||
TOUCH_EVENT_FROM_RING: 2,
|
||||
TOUCH_EVENT_FROM_GLASSES_L: 3,
|
||||
} as const;
|
||||
|
||||
export const EventSourceTypeName: Record<number, string> = {
|
||||
0: "TOUCH_EVENT_FORM_DUMMY_NULL",
|
||||
1: "TOUCH_EVENT_FROM_GLASSES_R",
|
||||
2: "TOUCH_EVENT_FROM_RING",
|
||||
3: "TOUCH_EVENT_FROM_GLASSES_L",
|
||||
};
|
||||
|
||||
export const OsEventTypeList = {
|
||||
CLICK_EVENT: 0,
|
||||
SCROLL_TOP_EVENT: 1,
|
||||
SCROLL_BOTTOM_EVENT: 2,
|
||||
DOUBLE_CLICK_EVENT: 3,
|
||||
FOREGROUND_ENTER_EVENT: 4,
|
||||
FOREGROUND_EXIT_EVENT: 5,
|
||||
ABNORMAL_EXIT_EVENT: 6,
|
||||
SYSTEM_EXIT_EVENT: 7,
|
||||
IMU_DATA_REPORT: 8,
|
||||
} as const;
|
||||
|
||||
export const OsEventTypeName: Record<number, string> = {
|
||||
0: "CLICK_EVENT",
|
||||
1: "SCROLL_TOP_EVENT",
|
||||
2: "SCROLL_BOTTOM_EVENT",
|
||||
3: "DOUBLE_CLICK_EVENT",
|
||||
4: "FOREGROUND_ENTER_EVENT",
|
||||
5: "FOREGROUND_EXIT_EVENT",
|
||||
6: "ABNORMAL_EXIT_EVENT",
|
||||
7: "SYSTEM_EXIT_EVENT",
|
||||
8: "IMU_DATA_REPORT",
|
||||
};
|
||||
+17
-11
@@ -8,7 +8,7 @@ import { nightscoutBridge } from "../native/nightscout";
|
||||
import { readActiveNotificationIcons } from "../native/notification-icons";
|
||||
import { readPhoneBatteryState } from "../native/phone-battery";
|
||||
import { readSystemStatusIcons } from "../native/system-status-icons";
|
||||
import { OsEventTypeList, EventSourceType } from "g2-kit/lite";
|
||||
import { EventSourceType, OsEventTypeList } from "../g2/events";
|
||||
import {
|
||||
getDashboardPlugin,
|
||||
isBlankDashboardPlugin,
|
||||
@@ -219,6 +219,17 @@ export function applyDashboardScreenTimeout(nowMs = Date.now()): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function resetDashboardSleepTimerAndWake(nowMs = Date.now()): boolean {
|
||||
dashboardState.lastInputAtMs = nowMs;
|
||||
if (dashboardState.screenOn) return false;
|
||||
|
||||
dashboardState.screenOn = true;
|
||||
dashboardState.tiledWakePaintPending = dashboardState.wakeMode === "tiled";
|
||||
dashboardLayers.clearToBase();
|
||||
dashboardLayers.push(createRootMenuLayer());
|
||||
return true;
|
||||
}
|
||||
|
||||
export function setDashboardBatteryLevels(levels: Partial<DashboardBatteryLevels>): void {
|
||||
dashboardState.battery = {
|
||||
...dashboardState.battery,
|
||||
@@ -411,12 +422,12 @@ function createRootMenuLayer(): MenuLayer {
|
||||
return new RootMenuLayer(
|
||||
"Menu",
|
||||
[
|
||||
{
|
||||
/*{
|
||||
label: "Apps",
|
||||
onSelect: (ctx) => {
|
||||
ctx.stack.push(createAppsMenuLayer());
|
||||
},
|
||||
},
|
||||
},*/
|
||||
{
|
||||
label: "Settings",
|
||||
onSelect: (ctx) => {
|
||||
@@ -720,7 +731,6 @@ class AboutLayer implements Layer {
|
||||
paint(): GrayImage {
|
||||
const image = new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0);
|
||||
const logo = getDashboardLogo();
|
||||
image.drawRect(12, 12, G2_LENS_WIDTH - 24, G2_LENS_HEIGHT - 24, 52);
|
||||
image.drawText(dashboardFont, 22, 16, "About Faceclaw", 220);
|
||||
if (logo) {
|
||||
image.bitBlt(logo, 22, 42);
|
||||
@@ -729,17 +739,13 @@ class AboutLayer implements Layer {
|
||||
image.drawText(dashboardFont, 108, 64, "Dashboard prototype", 180);
|
||||
|
||||
const aboutLines = [
|
||||
"A lobster on top of a smiley face.",
|
||||
"Perching on the faces of giants.",
|
||||
"",
|
||||
"The menu opens dashboard cards.",
|
||||
"Settings configure card slots.",
|
||||
"Double-click backs out of menus.",
|
||||
"By James Babcock. Distributed under the GNU General Public License, version 3.",
|
||||
"Version 0.1.0. Too much of an early janky development prototype to have",
|
||||
"proper numbered releases."
|
||||
];
|
||||
for (let index = 0; index < aboutLines.length; index++) {
|
||||
image.drawText(dashboardFont, 22, 128 + index * 14, aboutLines[index]!, 180);
|
||||
}
|
||||
image.drawText(dashboardFont, 22, 252, "Double-click to go back", 110);
|
||||
return image;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user