1
0
Fork 0

app widget tiniy battery

master
MaBecker 2020-03-31 20:22:56 +02:00
parent b6e6530724
commit 706a97a7b6
4 changed files with 30 additions and 0 deletions

View File

@ -888,5 +888,16 @@
{"name":"barclock.app.js","url":"clock-bar.js"},
{"name":"barclock.img","url":"clock-bar-icon.js","evaluate":true}
]
},
{ "id": "widtbat",
"name": "Tiny Battery Widget",
"icon": "widget.png",
"version":"0.01",
"description": "Tiny blueish battery widget, vibs and changes level coler when charging",
"tags": "widget,tool,system",
"type":"widget",
"storage": [
{"name":"widtbat.wid.js","url":"widget.js"}
]
}
]

1
apps/widtbat/ChangeLog Normal file
View File

@ -0,0 +1 @@
001 New widget

18
apps/widtbat/widget.js Normal file
View File

@ -0,0 +1,18 @@
/* jshint esversion: 6 */
(() => {
const CBS = 0x41f, CBC = 0x07E0;
var batS = require("heatshrink").decompress(atob("j0TwIHEv///kD////EfAYPwuEAgPB4EAg/HCgMfzgDBvwOC/IOC84ONDoUcFgc/AYOAHYRDE"));
var xo = 6, xl = 22, yo = 9, h = 17;
function draw() {
g.reset().setColor(CBS).drawImage(batS, this.x + 1, this.y + 4);
g.setColor(0).fillRect(this.x + xo, this.y + yo, this.x + xl, this.y + h);
var cbc = (Bangle.isCharging()) ? CBC : CBS;
g.setColor(cbc).fillRect(this.x + xo, this.y + yo, this.x + (xl - xo) / 100 * E.getBattery() + xo, this.y + h);
}
Bangle.on('charging', function(charging) {
if (charging) Bangle.buzz();
Bangle.drawWidgets();
});
WIDGETS["widtbat"] = { area:"tr", width:32, draw: draw };
})();

BIN
apps/widtbat/widget.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 911 B