mirror of https://github.com/espruino/BangleApps
0.15: Added option to hide widget when connected
parent
371dd94a03
commit
d0a33541a5
|
@ -11,3 +11,4 @@
|
|||
0.12: Prevent repeated execution of `draw()` from the current app.
|
||||
0.13: Added "connection restored" notification. Fixed restoring of the watchface.
|
||||
0.14: Added configuration option
|
||||
0.15: Added option to hide widget when connected
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "widbt_notify",
|
||||
"name": "Bluetooth Widget with Notification",
|
||||
"version": "0.14",
|
||||
"version": "0.15",
|
||||
"description": "Show the current Bluetooth connection status in the top right of the clock and vibrate when disconnected.",
|
||||
"icon": "widget.png",
|
||||
"type": "widget",
|
||||
|
|
|
@ -54,6 +54,13 @@
|
|||
settings.buzzOnLoss = v;
|
||||
writeSettings();
|
||||
}
|
||||
},
|
||||
"Hide connected": {
|
||||
value: (settings.hideConnected !== undefined ? settings.hideConnected : false),
|
||||
onchange: v => {
|
||||
settings.hideConnected = v;
|
||||
writeSettings();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -30,18 +30,32 @@ WIDGETS.bluetooth_notify = {
|
|||
buzzOnLoss = def(settings.buzzOnLoss, true);
|
||||
return buzzOnLoss;
|
||||
},
|
||||
|
||||
readHideConnected: function() {
|
||||
var hideConnected;
|
||||
const SETTINGSFILE = "widbt_notify.json";
|
||||
function def (value, def) {return value !== undefined ? value : def;}
|
||||
var settings = require('Storage').readJSON(SETTINGSFILE, true) || {};
|
||||
hideConnected = def(settings.hideConnected, true);
|
||||
return hideConnected;
|
||||
},
|
||||
|
||||
|
||||
// ------------ Settings --------
|
||||
|
||||
draw: function() {
|
||||
if (WIDGETS.bluetooth_notify.readshowWidget()){
|
||||
g.reset();
|
||||
if (NRF.getSecurityStatus().connected) {
|
||||
g.setColor((g.getBPP() > 8) ? "#07f" : (g.theme.dark ? "#0ff" : "#00f"));
|
||||
if (!WIDGETS.bluetooth_notify.readHideConnected()) {
|
||||
g.setColor((g.getBPP() > 8) ? "#07f" : (g.theme.dark ? "#0ff" : "#00f"));
|
||||
g.drawImage(atob("CxQBBgDgFgJgR4jZMawfAcA4D4NYybEYIwTAsBwDAA=="), 2 + this.x, 2 + this.y);
|
||||
}
|
||||
} else {
|
||||
// g.setColor(g.theme.dark ? "#666" : "#999");
|
||||
g.setColor("#f00"); // red is easier to distinguish from blue
|
||||
g.drawImage(atob("CxQBBgDgFgJgR4jZMawfAcA4D4NYybEYIwTAsBwDAA=="), 2 + this.x, 2 + this.y);
|
||||
}
|
||||
g.drawImage(atob("CxQBBgDgFgJgR4jZMawfAcA4D4NYybEYIwTAsBwDAA=="), 2 + this.x, 2 + this.y);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue