Added optinoal fullscreen mode.

master
David Peer 2022-02-16 17:54:12 +01:00
parent 50c4bfb559
commit d6da125df7
5 changed files with 49 additions and 20 deletions

View File

@ -1 +1,2 @@
0.01: Initial release 0.01: Initial release
0.02: Optional fullscreen mode

View File

@ -4,8 +4,8 @@
|---------------------------------|--------------------------------------| |---------------------------------|--------------------------------------|
| <center>Neon X</center> | <center>Neon IO X</center> | | <center>Neon X</center> | <center>Neon IO X</center> |
This is a clock based on Pebble's Neon X and Neon IO X watchfaces by Sam Jerichow. 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 Can be switched between in the Settings menu, which can be accessed through
the app/widget settings menu of the Bangle.js the app/widget settings menu of the Bangle.js
## Settings ## Settings
@ -18,3 +18,7 @@ The thickness of watch lines, from 1 to 5.
### Date on touch ### Date on touch
Shows the current date as DD MM on touch and reverts back to time after 5 seconds or with another 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.

View File

@ -2,7 +2,7 @@
"id": "neonx", "id": "neonx",
"name": "Neon X & IO X Clock", "name": "Neon X & IO X Clock",
"shortName": "Neon X Clock", "shortName": "Neon X Clock",
"version": "0.01", "version": "0.02",
"description": "Pebble Neon X & Neon IO X for Bangle.js", "description": "Pebble Neon X & Neon IO X for Bangle.js",
"icon": "neonx.png", "icon": "neonx.png",
"type": "clock", "type": "clock",

View File

@ -34,6 +34,7 @@ const colors = {
const is12hour = (require("Storage").readJSON("setting.json",1)||{})["12hour"]||false; const is12hour = (require("Storage").readJSON("setting.json",1)||{})["12hour"]||false;
const screenWidth = g.getWidth(); const screenWidth = g.getWidth();
const screenHeight = g.getHeight();
const halfWidth = screenWidth / 2; const halfWidth = screenWidth / 2;
const scale = screenWidth / 240; const scale = screenWidth / 240;
const REFRESH_RATE = 10E3; const REFRESH_RATE = 10E3;
@ -58,16 +59,19 @@ function drawLine(poly, thickness){
} }
} }
let settings = require('Storage').readJSON('neonx.json', 1); let settings = {
thickness: 4,
if (!settings) { io: 0,
settings = { showDate: 1,
thickness: 4, fullscreen: false,
io: 0, };
showDate: 1 let saved_settings = require('Storage').readJSON('neonx.json', 1) || settings;
}; for (const key in saved_settings) {
settings[key] = saved_settings[key]
} }
function drawClock(num){ function drawClock(num){
let tx, ty; let tx, ty;
@ -79,13 +83,15 @@ function drawClock(num){
g.setColor(colors[settings.io ? 'io' : 'x'][y][x]); g.setColor(colors[settings.io ? 'io' : 'x'][y][x]);
if (!settings.io) { if (!settings.io) {
tx = (x * 100 + 18) * newScale; newScale *= settings.fullscreen ? 1.18 : 1.0;
ty = (y * 100 + 32) * newScale; let dx = settings.fullscreen ? 0 : 18
tx = (x * 100 + dx) * newScale;
ty = (y * 100 + dx*2) * newScale;
} else { } else {
newScale = 0.33 + current * 0.4; newScale = 0.33 + current * (settings.fullscreen ? 0.48 : 0.4);
tx = (halfWidth - 139) * newScale + halfWidth; tx = (halfWidth - 139) * newScale + halfWidth + (settings.fullscreen ? 2 : 0);
ty = (halfWidth - 139) * newScale + halfWidth + 12; ty = (halfWidth - 139) * newScale + halfWidth + (settings.fullscreen ? 1 : 12);
} }
for (let i = 0; i < digits[num[y][x]].length; i++) { for (let i = 0; i < digits[num[y][x]].length; i++) {
@ -116,7 +122,11 @@ function draw(date){
l2 = ('0' + d.getMinutes()).substr(-2); 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]); drawClock([l1, l2]);
} }
@ -150,4 +160,9 @@ Bangle.on('lcdPower', function(on){
}); });
Bangle.loadWidgets(); Bangle.loadWidgets();
Bangle.drawWidgets();
if(settings.fullscreen){
for (let wd of WIDGETS) {wd.draw=()=>{};wd.area="";}
} else {
Bangle.drawWidgets();
}

View File

@ -7,7 +7,8 @@
neonXSettings = { neonXSettings = {
thickness: 4, thickness: 4,
io: 0, io: 0,
showDate: 1 showDate: 1,
fullscreen: false,
}; };
updateSettings(); updateSettings();
@ -48,7 +49,15 @@
neonXSettings.showDate = v; neonXSettings.showDate = v;
updateSettings(); updateSettings();
} }
} },
'Fullscreen': {
value: false | neonXSettings.fullscreen,
format: () => (neonXSettings.fullscreen ? 'Yes' : 'No'),
onchange: () => {
neonXSettings.fullscreen = !neonXSettings.fullscreen;
updateSettings();
},
},
}; };
E.showMenu(menu); E.showMenu(menu);
}) })