Add files via upload

pull/1998/head
CarlR9 2022-06-25 20:05:45 +12:00 committed by GitHub
parent 19daee6b71
commit 1986522a75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1 @@
25/Jun/2022: Added to depository.

View File

@ -0,0 +1,14 @@
{ "id": "widscrlock",
"name": "Screenlock Widget",
"shortName":"Screenlock",
"version":"1.0",
"description": "A widget to lock a Bangle 2 screen with a tap.",
"icon": "widget.png",
"type": "widget",
"tags": "widget, screenlock",
"supports" : ["BANGLEJS2"],
"readme": "README.md",
"storage": [
{"name:"widscrlock.wid.js","url":"widget.js"}
]
}

36
apps/widscrlock/widget.js Normal file
View File

@ -0,0 +1,36 @@
// Screenlock Widget
(() => {
var widX = 0;
var widY = 0;
function draw() {
// Draw icon.
g.reset();
widX = this.x;
widY = this.y;
g.drawImage(atob("GBiDAkkkkiSSSUkkkkkkiSSSSSUkkkkiSSSSSSSUkkkSSSSSSSSSkkiSSSf/ySSSUkiSSf///ySAUkSSSfwAPyQASkSST+AAB+AACiSST+AAB2AACSSST+AAA2AAASSST+AAA2AAASSSf//+22wAASSSf//222wAASSSf/+A22wAASSSf/wAG2wAASSSf+wAG2wACUSST2wAG2AACkSSS22A22AASkiSQG222wAAUkiSAAG2wAACUkkSAAAAAAASkkkiSAAAAASUkkkkiSAAASUkkkkkkiSSSUkkkg=="),widX,widY);
}
// add widget.
WIDGETS.widscrlock={
area:"tr",
width: 24,
draw:draw // Draw widget.
};
setInterval(()=>WIDGETS.widscrlock.draw(), 60000);
function restoreTimeout(){
// Restore LCDTimeout settings.
Bangle.setLCDTimeout(options.lockTimeout / 1000);
}
var options = [];
Bangle.on('touch', function(button, xy) {
if(xy.x>=widX && xy.x<=widX+23 && xy.y>=widY && xy.y<=widY+23) {
options = Bangle.getOptions(); // Store current Timeout settings.
Bangle.setLCDTimeout(0.1); // Lock screen.
setTimeout(restoreTimeout, 1000);
}
});
})();

BIN
apps/widscrlock/widget.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 B