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.01: New Widget, forked from widviz
|
||||||
|
0.02: Use widget_utils.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"id": "widviztime",
|
"id": "widviztime",
|
||||||
"name": "Widget Autohide Widget",
|
"name": "Widget Autohide Widget",
|
||||||
"shortName": "Viz Time 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.",
|
"description": "The widgets will be shown for four seconds after the device is unlocked.",
|
||||||
"icon": "eye.png",
|
"icon": "eye.png",
|
||||||
"type": "widget",
|
"type": "widget",
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
(() => {
|
(() => {
|
||||||
|
let widget_utils = require('widget_utils');
|
||||||
|
|
||||||
var saved = null;
|
var saved = null;
|
||||||
|
|
||||||
|
@ -6,25 +7,14 @@
|
||||||
function hide() {
|
function hide() {
|
||||||
if (!Bangle.isLCDOn() || saved) return;
|
if (!Bangle.isLCDOn() || saved) return;
|
||||||
saved = [];
|
saved = [];
|
||||||
for (var wd of WIDGETS) {
|
widget_utils.hide();
|
||||||
saved.push({
|
|
||||||
d: wd.draw,
|
|
||||||
a: wd.area
|
|
||||||
});
|
|
||||||
wd.draw = () => {};
|
|
||||||
wd.area = "";
|
|
||||||
}
|
|
||||||
g.setColor(0, 0, 0);
|
g.setColor(0, 0, 0);
|
||||||
g.fillRect(0, 0, g.getWidth(), 23);
|
g.fillRect(0, 0, g.getWidth(), 23);
|
||||||
}
|
}
|
||||||
|
|
||||||
function reveal() {
|
function reveal() {
|
||||||
if (!Bangle.isLCDOn() || !saved) return;
|
if (!Bangle.isLCDOn() || !saved) return;
|
||||||
for (var wd of WIDGETS) {
|
widget_utils.show();
|
||||||
var o = saved.shift();
|
|
||||||
wd.draw = o.d;
|
|
||||||
wd.area = o.a;
|
|
||||||
}
|
|
||||||
Bangle.drawWidgets();
|
Bangle.drawWidgets();
|
||||||
saved = null;
|
saved = null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue