From d6da125df7927dec535c9c8c7c3dea5e145d88c8 Mon Sep 17 00:00:00 2001 From: David Peer Date: Wed, 16 Feb 2022 17:54:12 +0100 Subject: [PATCH] Added optinoal fullscreen mode. --- apps/neonx/ChangeLog | 1 + apps/neonx/README.md | 8 +++++-- apps/neonx/metadata.json | 2 +- apps/neonx/neonx.app.js | 45 ++++++++++++++++++++++++------------ apps/neonx/neonx.settings.js | 13 +++++++++-- 5 files changed, 49 insertions(+), 20 deletions(-) diff --git a/apps/neonx/ChangeLog b/apps/neonx/ChangeLog index af7f83942..7ac033fe8 100644 --- a/apps/neonx/ChangeLog +++ b/apps/neonx/ChangeLog @@ -1 +1,2 @@ 0.01: Initial release +0.02: Optional fullscreen mode \ No newline at end of file diff --git a/apps/neonx/README.md b/apps/neonx/README.md index d836dfab3..c3926c4b6 100644 --- a/apps/neonx/README.md +++ b/apps/neonx/README.md @@ -4,8 +4,8 @@ |---------------------------------|--------------------------------------| |
Neon X
|
Neon IO X
| -This is a clock based on Pebble's Neon X and Neon IO X watchfaces by Sam Jerichow. -Can be switched between in the Settings menu, which can be accessed through +This is a clock based on Pebble's Neon X and Neon IO X watchfaces by Sam Jerichow. +Can be switched between in the Settings menu, which can be accessed through the app/widget settings menu of the Bangle.js ## Settings @@ -18,3 +18,7 @@ The thickness of watch lines, from 1 to 5. ### Date on touch Shows the current date as DD MM on touch and reverts back to time after 5 seconds or with another touch. + +### Fullscreen +Shows the watchface in fullscreen mode. +Note: In fullscreen mode, widgets are hidden, but still loaded. \ No newline at end of file diff --git a/apps/neonx/metadata.json b/apps/neonx/metadata.json index 41b16d11b..ffa4d1b8e 100644 --- a/apps/neonx/metadata.json +++ b/apps/neonx/metadata.json @@ -2,7 +2,7 @@ "id": "neonx", "name": "Neon X & IO X Clock", "shortName": "Neon X Clock", - "version": "0.01", + "version": "0.02", "description": "Pebble Neon X & Neon IO X for Bangle.js", "icon": "neonx.png", "type": "clock", diff --git a/apps/neonx/neonx.app.js b/apps/neonx/neonx.app.js index 967fc8582..d3521b1db 100644 --- a/apps/neonx/neonx.app.js +++ b/apps/neonx/neonx.app.js @@ -34,6 +34,7 @@ const colors = { const is12hour = (require("Storage").readJSON("setting.json",1)||{})["12hour"]||false; const screenWidth = g.getWidth(); +const screenHeight = g.getHeight(); const halfWidth = screenWidth / 2; const scale = screenWidth / 240; const REFRESH_RATE = 10E3; @@ -58,16 +59,19 @@ function drawLine(poly, thickness){ } } -let settings = require('Storage').readJSON('neonx.json', 1); - -if (!settings) { - settings = { - thickness: 4, - io: 0, - showDate: 1 - }; +let settings = { + thickness: 4, + io: 0, + showDate: 1, + fullscreen: false, +}; +let saved_settings = require('Storage').readJSON('neonx.json', 1) || settings; +for (const key in saved_settings) { + settings[key] = saved_settings[key] } + + function drawClock(num){ let tx, ty; @@ -79,13 +83,15 @@ function drawClock(num){ g.setColor(colors[settings.io ? 'io' : 'x'][y][x]); if (!settings.io) { - tx = (x * 100 + 18) * newScale; - ty = (y * 100 + 32) * newScale; + newScale *= settings.fullscreen ? 1.18 : 1.0; + let dx = settings.fullscreen ? 0 : 18 + tx = (x * 100 + dx) * newScale; + ty = (y * 100 + dx*2) * newScale; } else { - newScale = 0.33 + current * 0.4; + newScale = 0.33 + current * (settings.fullscreen ? 0.48 : 0.4); - tx = (halfWidth - 139) * newScale + halfWidth; - ty = (halfWidth - 139) * newScale + halfWidth + 12; + tx = (halfWidth - 139) * newScale + halfWidth + (settings.fullscreen ? 2 : 0); + ty = (halfWidth - 139) * newScale + halfWidth + (settings.fullscreen ? 1 : 12); } for (let i = 0; i < digits[num[y][x]].length; i++) { @@ -116,7 +122,11 @@ function draw(date){ l2 = ('0' + d.getMinutes()).substr(-2); } - g.clearRect(0,24,240,240); + if(settings.fullscreen){ + g.clearRect(0,0,screenWidth,screenHeight); + } else { + g.clearRect(0,24,240,240); + } drawClock([l1, l2]); } @@ -150,4 +160,9 @@ Bangle.on('lcdPower', function(on){ }); Bangle.loadWidgets(); -Bangle.drawWidgets(); + +if(settings.fullscreen){ + for (let wd of WIDGETS) {wd.draw=()=>{};wd.area="";} +} else { + Bangle.drawWidgets(); +} \ No newline at end of file diff --git a/apps/neonx/neonx.settings.js b/apps/neonx/neonx.settings.js index 0e205e03b..b4b481baf 100644 --- a/apps/neonx/neonx.settings.js +++ b/apps/neonx/neonx.settings.js @@ -7,7 +7,8 @@ neonXSettings = { thickness: 4, io: 0, - showDate: 1 + showDate: 1, + fullscreen: false, }; updateSettings(); @@ -48,7 +49,15 @@ neonXSettings.showDate = v; updateSettings(); } - } + }, + 'Fullscreen': { + value: false | neonXSettings.fullscreen, + format: () => (neonXSettings.fullscreen ? 'Yes' : 'No'), + onchange: () => { + neonXSettings.fullscreen = !neonXSettings.fullscreen; + updateSettings(); + }, + }, }; E.showMenu(menu); })