forked from FOSS/BangleApps
Optional settings to show a different color for (0,0) whenever the bangle is locked.
parent
ece775bb8e
commit
f8eebb80ec
|
@ -1,2 +1,3 @@
|
|||
0.01: Initial release
|
||||
0.02: Optional fullscreen mode
|
||||
0.02: Optional fullscreen mode
|
||||
0.03: Optional show lock status via color
|
|
@ -21,4 +21,9 @@ Shows the current date as DD MM on touch and reverts back to time after 5 second
|
|||
|
||||
### Fullscreen
|
||||
Shows the watchface in fullscreen mode.
|
||||
Note: In fullscreen mode, widgets are hidden, but still loaded.
|
||||
Note: In fullscreen mode, widgets are hidden, but still loaded.
|
||||
|
||||
### Show lock status
|
||||
In fullscreen mode it can be useful to detect, whether the BangleJs is locked or not.
|
||||
If these settings are enabled, the first digit is shown red if the BangleJs is locked
|
||||
and purple otherwise.
|
|
@ -2,7 +2,7 @@
|
|||
"id": "neonx",
|
||||
"name": "Neon X & IO X Clock",
|
||||
"shortName": "Neon X Clock",
|
||||
"version": "0.02",
|
||||
"version": "0.03",
|
||||
"description": "Pebble Neon X & Neon IO X for Bangle.js",
|
||||
"icon": "neonx.png",
|
||||
"type": "clock",
|
||||
|
|
|
@ -8,6 +8,19 @@
|
|||
* Created: February 2022
|
||||
*/
|
||||
|
||||
let settings = {
|
||||
thickness: 4,
|
||||
io: 0,
|
||||
showDate: 1,
|
||||
fullscreen: false,
|
||||
showLock: false,
|
||||
};
|
||||
let saved_settings = require('Storage').readJSON('neonx.json', 1) || settings;
|
||||
for (const key in saved_settings) {
|
||||
settings[key] = saved_settings[key]
|
||||
}
|
||||
|
||||
|
||||
const digits = {
|
||||
0:[[15,15,85,15,85,85,15,85,15,15]],
|
||||
1:[[85,15,85,85]],
|
||||
|
@ -21,6 +34,7 @@ const digits = {
|
|||
9:[[15,50,15,15,85,15,85,85,15,85]],
|
||||
};
|
||||
|
||||
|
||||
const colors = {
|
||||
x: [
|
||||
["#FF00FF", "#00FFFF"],
|
||||
|
@ -31,17 +45,19 @@ const colors = {
|
|||
["#00FF00", "#00FFFF"]
|
||||
]
|
||||
};
|
||||
const unlockColor = "#FF0000";
|
||||
|
||||
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;
|
||||
const REFRESH_RATE = 60E3;
|
||||
|
||||
let interval = 0;
|
||||
let showingDate = false;
|
||||
|
||||
|
||||
function drawLine(poly, thickness){
|
||||
for (let i = 0; i < poly.length; i = i + 2){
|
||||
if (poly[i + 2] === undefined) {
|
||||
|
@ -59,18 +75,6 @@ function drawLine(poly, thickness){
|
|||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -80,7 +84,11 @@ function drawClock(num){
|
|||
const current = ((y + 1) * 2 + x - 1);
|
||||
let newScale = scale;
|
||||
|
||||
g.setColor(colors[settings.io ? 'io' : 'x'][y][x]);
|
||||
let c = colors[settings.io ? 'io' : 'x'][y][x];
|
||||
if(x == 0 && y == 0 && settings.showLock){
|
||||
c = Bangle.isLocked() ? c : unlockColor;
|
||||
}
|
||||
g.setColor(c);
|
||||
|
||||
if (!settings.io) {
|
||||
newScale *= settings.fullscreen ? 1.18 : 1.0;
|
||||
|
@ -101,6 +109,7 @@ function drawClock(num){
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
function draw(date){
|
||||
let d = new Date();
|
||||
let l1, l2;
|
||||
|
@ -131,6 +140,7 @@ function draw(date){
|
|||
drawClock([l1, l2]);
|
||||
}
|
||||
|
||||
|
||||
function setUpdateInt(set){
|
||||
if (interval) {
|
||||
clearInterval(interval);
|
||||
|
@ -148,15 +158,22 @@ Bangle.setUI("clock");
|
|||
setUpdateInt(1);
|
||||
draw();
|
||||
|
||||
|
||||
if (settings.showDate) {
|
||||
Bangle.on('touch', () => draw(!showingDate));
|
||||
}
|
||||
|
||||
Bangle.on('lcdPower', function(on){
|
||||
if (on){
|
||||
draw();
|
||||
setUpdateInt(1);
|
||||
} else setUpdateInt(0);
|
||||
draw();
|
||||
} else {
|
||||
setUpdateInt(0);
|
||||
}
|
||||
});
|
||||
|
||||
Bangle.on('lock', function(isLocked) {
|
||||
draw();
|
||||
});
|
||||
|
||||
Bangle.loadWidgets();
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
io: 0,
|
||||
showDate: 1,
|
||||
fullscreen: false,
|
||||
showLock: false,
|
||||
};
|
||||
|
||||
updateSettings();
|
||||
|
@ -58,6 +59,14 @@
|
|||
updateSettings();
|
||||
},
|
||||
},
|
||||
'Show lock': {
|
||||
value: false | neonXSettings.showLock,
|
||||
format: () => (neonXSettings.showLock ? 'Yes' : 'No'),
|
||||
onchange: () => {
|
||||
neonXSettings.showLock = !neonXSettings.showLock;
|
||||
updateSettings();
|
||||
},
|
||||
},
|
||||
};
|
||||
E.showMenu(menu);
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue