set widget sortorder through code for widpa,widpb,widbata,widlock

pull/1325/head
hughbarney 2022-01-19 22:45:16 +00:00
parent 7102061614
commit c4946c7a3c
12 changed files with 12 additions and 8 deletions

View File

@ -1,2 +1,3 @@
0.01: Created
0.02: Set sort order to -10 so always display in right hand corner
0.03: Set sort order from the code

View File

@ -4,7 +4,7 @@
"shortName":"Battery Theme",
"icon": "widbata.png",
"screenshots": [{"url":"screenshot_widbata_1.png"}],
"version":"0.02",
"version":"0.03",
"type": "widget",
"supports": ["BANGLEJS", "BANGLEJS2"],
"readme": "README.md",

View File

@ -2,7 +2,7 @@ setInterval(()=>WIDGETS["bata"].draw(), 60000);
Bangle.on('lcdPower', function(on) {
if (on) WIDGETS["bata"].draw();
});
WIDGETS["bata"]={area:"tr",width:27,draw:function() {
WIDGETS["bata"]={area:"tr",sortorder:-10,width:27,draw:function() {
var s = 26;
var t = 13; // thickness
var x = this.x, y = this.y;

View File

@ -3,3 +3,4 @@
0.03: Don't try to be fancy - just bail out on firmwares without a lock event
0.04: Set sortorder to -1 so that widget always takes up the furthest left position
0.05: Set sortorder to -10 so that others can take -1 etc
0.06: Set sortorder to -10 in widget code

View File

@ -1,7 +1,7 @@
{
"id": "widlock",
"name": "Lock Widget",
"version": "0.05",
"version": "0.06",
"description": "On devices with always-on display (Bangle.js 2) this displays lock icon whenever the display is locked",
"icon": "widget.png",
"type": "widget",

View File

@ -4,7 +4,7 @@
WIDGETS["lock"].width = Bangle.isLocked()?16:0;
Bangle.drawWidgets();
});
WIDGETS["lock"]={area:"tl",width:Bangle.isLocked()?16:0,draw:function(w) {
WIDGETS["lock"]={area:"tl",sortorder:-10,width:Bangle.isLocked()?16:0,draw:function(w) {
if (Bangle.isLocked())
g.reset().drawImage(atob("DhABH+D/wwMMDDAwwMf/v//4f+H/h/8//P/z///f/g=="), w.x+1, w.y+4);
}};

View File

@ -1,3 +1,4 @@
0.01: First release
0.02: Size widget after step count is reset
0.03: set sortorder to -1
0.04: set sortorder through code

View File

@ -4,7 +4,7 @@
"shortName":"Simple Pedometer",
"icon": "screenshot_widpa.png",
"screenshots": [{"url":"screenshot_widpa.png"}],
"version":"0.03",
"version":"0.04",
"type": "widget",
"supports": ["BANGLEJS", "BANGLEJS2"],
"readme": "README.md",

View File

@ -2,7 +2,7 @@ Bangle.on('step', function(s) { WIDGETS["widpa"].draw(); });
Bangle.on('lcdPower', function(on) {
if (on) WIDGETS["widpa"].draw();
});
WIDGETS["widpa"]={area:"tl",width:13,draw:function() {
WIDGETS["widpa"]={area:"tl",sortorder:-1,width:13,draw:function() {
if (!Bangle.isLCDOn()) return; // dont redraw if LCD is off
var steps = Bangle.getHealthStatus("day").steps;
var w = 1 + (steps.toString().length)*12;

View File

@ -2,3 +2,4 @@
0.02: Fixed widget id to wibpb, Size widget after step count is reset
0.03: Fixed widget id in onStep() come on get it right!
0.04: set sortorder to -1
0.05: set sortorder through code

View File

@ -4,7 +4,7 @@
"shortName":"Lato Pedometer",
"icon": "screenshot_widpb.png",
"screenshots": [{"url":"screenshot_widpb.png"}],
"version":"0.04",
"version":"0.05",
"type": "widget",
"supports": ["BANGLEJS", "BANGLEJS2"],
"readme": "README.md",

View File

@ -3,7 +3,7 @@ Bangle.on('step', function(s) { WIDGETS["widpb"].draw(); });
Bangle.on('lcdPower', function(on) {
if (on) WIDGETS["widpb"].draw();
});
WIDGETS["widpb"]={area:"tl",width:13,draw:function() {
WIDGETS["widpb"]={area:"tl",sortorder:-1,width:13,draw:function() {
if (!Bangle.isLCDOn()) return; // dont redraw if LCD is off
var steps = Bangle.getHealthStatus("day").steps;
var w = 1 + (steps.toString().length)*12;