Minimal Bluetooth Widget

pull/2030/head
Leon Matthes 2022-07-07 12:52:35 +02:00
parent e097da43dd
commit 2a1eb5ade2
4 changed files with 29 additions and 0 deletions

1
apps/widminbt/ChangeLog Normal file
View File

@ -0,0 +1 @@
0.01: Initial Release

View File

@ -0,0 +1,13 @@
{
"id": "widminbt",
"name": "Minimal Bluetooth Widget",
"version": "0.01",
"description": "Appears whenever bluetooth is disconnected",
"icon": "widget.png",
"type": "widget",
"tags": "widget,bluetooth,minimal",
"supports": ["BANGLEJS","BANGLEJS2"],
"storage": [
{"name":"widminbt.wid.js","url":"widget.js"}
]
}

15
apps/widminbt/widget.js Normal file
View File

@ -0,0 +1,15 @@
(()=> {
WIDGETS.minbt={area:"tr",width:NRF.getSecurityStatus().connected?0:15,draw:function() {
if(this.width<15)return;
g.reset();
g.setColor((g.getBPP()>8) ? "#07f" : (g.theme.dark ? "#0ff" : "#00f"));
g.drawImage(atob("CxQBBgDgFgJgR4jZMawfAcA4D4NYybEYIwTAsBwDAA=="),2+this.x,2+this.y);
g.setColor("#f00");
g.drawImage(atob("CxSBAMA8DYG4YwxzBmD4DwHAGAeA8DcGYY4wzB2B4DA="), 2+this.x, 2+this.y);
},changed:function(){
WIDGETS.minbt.width=NRF.getSecurityStatus().connected?0:15;
Bangle.drawWidgets();
}};
NRF.on('connect',WIDGETS.minbt.changed);
NRF.on('disconnect',WIDGETS.minbt.changed);
})();

BIN
apps/widminbt/widget.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 792 B