Add ability to hide icon when GPS is disabled

pull/2084/head
Stanislav Khromov 2022-08-10 23:39:43 +02:00
parent 17fde110a2
commit a7257129ee
5 changed files with 15 additions and 6 deletions

View File

@ -14,6 +14,7 @@ There are two icons which can be used to visualize the GPS/GNSS status:
- Shows in green when the GPS is on and has a fix
2. Different place markers depending on GPS/GNSS status
You can also choose to hide the icon when the GPS is off in the settings.
Written by: [Hugh Barney](https://github.com/hughbarney) For support
and discussion please post in the [Bangle JS
@ -21,4 +22,6 @@ Forum](http://forum.espruino.com/microcosms/1424/)
Extended by Marco ([myxor](https://github.com/myxor))
Extended by khromov ([myxor](https://github.com/khromov))
Place marker icons from [icons8.com](https://icons8.com/icon/set/maps/material-outlined).

View File

@ -1 +1 @@
{"crossIcon": "true"}
{"crossIcon": true, "hideWhenGpsOff": false}

View File

@ -1,7 +1,7 @@
{
"id": "widgps",
"name": "GPS Widget",
"version": "0.07",
"version": "0.08",
"description": "Tiny widget to show the power and fix status of the GPS/GNSS",
"icon": "widget.png",
"type": "widget",

View File

@ -23,6 +23,10 @@ var mainmenu = {
value : !!settings.crossIcon ,
onchange : v => { writeSettings("crossIcon", v); }
},
"Hide icon when GPS off" : {
value : !!settings.hideWhenGpsOff ,
onchange : v => { writeSettings("hideWhenGpsOff", v); }
},
};
E.showMenu(mainmenu);
});

View File

@ -1,6 +1,6 @@
(function() {
let settings =
require("Storage").readJSON("widgps.json", 1) || {crossIcon : true};
require("Storage").readJSON("widgps.json", 1) || {crossIcon: true, hideWhenGpsOff: false};
var interval;
@ -59,9 +59,11 @@ WIDGETS.gps = {
}
} else {
// GNSS off
g.drawImage(
atob("GBiBAAAAAAAAAAB+ABj/ABxDgA4AwAcAwAeMYAfEYAbgYAZwYAM4wAMcQAOOAAGHAAHDgADDwABm4AB+cAA8OAAYGAAAAAAAAAAAAA=="),
this.x, 2 + this.y);
if(!settings.hideWhenGpsOff) {
g.drawImage(
atob("GBiBAAAAAAAAAAB+ABj/ABxDgA4AwAcAwAeMYAfEYAbgYAZwYAM4wAMcQAOOAAGHAAHDgADDwABm4AB+cAA8OAAYGAAAAAAAAAAAAA=="),
this.x, 2 + this.y);
}
}
}
}