widget_utils for widviztime

pull/2492/head
thyttan 2023-01-11 20:27:31 +01:00
parent a8acf224f5
commit d6eca2322d
3 changed files with 5 additions and 14 deletions

View File

@ -1 +1,2 @@
0.01: New Widget, forked from widviz
0.02: Use widget_utils.

View File

@ -2,7 +2,7 @@
"id": "widviztime",
"name": "Widget Autohide Widget",
"shortName": "Viz Time Widget",
"version": "0.01",
"version": "0.02",
"description": "The widgets will be shown for four seconds after the device is unlocked.",
"icon": "eye.png",
"type": "widget",

View File

@ -1,4 +1,5 @@
(() => {
let widget_utils = require('widget_utils');
var saved = null;
@ -6,25 +7,14 @@
function hide() {
if (!Bangle.isLCDOn() || saved) return;
saved = [];
for (var wd of WIDGETS) {
saved.push({
d: wd.draw,
a: wd.area
});
wd.draw = () => {};
wd.area = "";
}
widget_utils.hide();
g.setColor(0, 0, 0);
g.fillRect(0, 0, g.getWidth(), 23);
}
function reveal() {
if (!Bangle.isLCDOn() || !saved) return;
for (var wd of WIDGETS) {
var o = saved.shift();
wd.draw = o.d;
wd.area = o.a;
}
widget_utils.show();
Bangle.drawWidgets();
saved = null;
}