widget hand wash timer

pull/180/head
MaBecker 2020-04-01 22:23:33 +02:00
parent 6b775da0c1
commit 22d93ef884
4 changed files with 34 additions and 0 deletions

View File

@ -951,5 +951,16 @@
{"name":"chrono.app.js","url":"chrono.js"},
{"name":"chrono.img","url":"chrono-icon.js","evaluate":true}
]
},
{ "id": "widhwt",
"name": "Hand Wash Timer",
"icon": "widget.png",
"version":"0.01",
"description": "Any swip will start your personal Bangle.js hand wash timer for 35 sec. Start washing after the short buzz and stop after the long buzz.",
"tags": "widget,tool",
"type":"widget",
"storage": [
{"name":"widhwt.wid.js","url":"widget.js"}
]
}
]

1
apps/widhwt/ChangeLog Normal file
View File

@ -0,0 +1 @@
0.01: New Widget!

22
apps/widhwt/widget.js Normal file
View File

@ -0,0 +1,22 @@
/* jshint esversion: 6 */
(() => {
var icon = require("heatshrink").decompress(atob("jEYwIKHgwCBhwCBh4CEggPCkACBmAXDBwVZ+EB+F4gEsjl8EgMP+EChk/gEMh+ehkA+YIBxwxBnF/4HggH/wEAj0AA=="));
var color = 0x4A69;
function draw() {
g.reset().setColor(color).drawImage(icon, this.x + 1, 0);
}
WIDGETS["widhwt"] = { area: "tr", width: 26, draw: draw };
Bangle.on('swipe', function() {
color = 0x41f;
Bangle.buzz();
Bangle.drawWidgets();
setTimeout(() => {
color = 0x4A69;
Bangle.buzz(1E3, 1);
Bangle.drawWidgets();
}, 35E3);
});
})();

BIN
apps/widhwt/widget.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB