mirror of https://github.com/espruino/BangleApps
widget_utils for widviztime
parent
a8acf224f5
commit
d6eca2322d
|
@ -1 +1,2 @@
|
|||
0.01: New Widget, forked from widviz
|
||||
0.02: Use widget_utils.
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue