Merge pull request #3196 from nxdefiant/master

widadjust: Add option to hide widget
pull/3198/head
thyttan 2024-02-13 18:47:54 +01:00 committed by GitHub
commit 051bd35f2b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 3 deletions

View File

@ -1,2 +1,3 @@
0.01: New widget
0.02: Use default Bangle formatter for booleans
0.03: Add option to hide widget

View File

@ -2,7 +2,7 @@
"id": "widadjust",
"name": "Adjust Clock",
"icon": "icon.png",
"version": "0.02",
"version": "0.03",
"description": "Adjusts clock continually in the background to counter clock drift",
"type": "widget",
"tags": "widget",

View File

@ -108,6 +108,11 @@
value: settings.debugLog,
onchange: v => settings.debugLog = v,
},
'Hide Widget': {
value: settings.hide || false,
onchange: v => settings.hide = v,
},
};
E.showMenu(mainMenu);

View File

@ -78,13 +78,16 @@
}
function debug(line) {
console.log(line);
//console.log(line);
if (debugLogFile !== null) {
debugLogFile.write(line + '\n');
}
}
function draw() {
if (settings.hide === true) {
return;
}
g.reset().setFont('6x8').setFontAlign(0, 0);
g.clearRect(this.x, this.y, this.x + WIDTH - 1, this.y + 23);
g.drawString(Math.round(clockError), this.x + WIDTH/2, this.y + 9);
@ -208,7 +211,7 @@
let updatedClockError = clockError + (now - lastClockErrorUpdateTime) * ppm / 1000000;
return now - updatedClockError;
},
width: WIDTH,
width: settings.hide === true ? 0 : WIDTH,
};
if (settings.saveState) {