widlock: Handle new firmwares with 'lock' event

master
Gordon Williams 2021-06-17 14:14:09 +01:00
parent d40c64a805
commit ac75110504
3 changed files with 8 additions and 5 deletions

View File

@ -587,7 +587,7 @@
{ "id": "widlock",
"name": "Lock Widget",
"icon": "widget.png",
"version":"0.01",
"version":"0.02",
"description": "On devices with always-on display (Bangle.js 2) this displays lock icon whenever the display is locked",
"tags": "widget,lock",
"type":"widget",

View File

@ -1 +1,2 @@
0.01: First commit
0.02: Handle new firmwares with 'lock' event

View File

@ -1,10 +1,12 @@
(function(){
Bangle.on('lcdPower', function(on) {
WIDGETS["lock"].width = Bangle.isLCDOn()?0:16;
Bangle.on(Bangle.isLocked?'lock':'lcdPower', function(on) {
WIDGETS["lock"].width = Bangle.isLocked()?0:16;
Bangle.drawWidgets();
});
WIDGETS["lock"]={area:"tl",width:Bangle.isLCDOn()?0:16,draw:function(w) {
if (!Bangle.isLCDOn())
if (Bangle.isLocked===undefined)
Bangle.isLocked = Bangle.isLCDOn;
WIDGETS["lock"]={area:"tl",width:Bangle.isLocked()?0:16,draw:function(w) {
if (!Bangle.isLocked())
g.reset().drawImage(atob("DhABH+D/wwMMDDAwwMf/v//4f+H/h/8//P/z///f/g=="), w.x+1, w.y+4);
}};
})()