mirror of https://github.com/espruino/BangleApps
adding a bottom widget clock
parent
fa344f75f5
commit
55a929e71c
13
apps.json
13
apps.json
|
@ -3443,4 +3443,17 @@
|
||||||
{"name":"app.json"}
|
{"name":"app.json"}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
{ "id": "widclkbttm",
|
||||||
|
"name": "Digital clock (Bottom) widget",
|
||||||
|
"shortName":"Digital clock Bottom Widget",
|
||||||
|
"icon": "widclkbttm.png",
|
||||||
|
"version":"0.03",
|
||||||
|
"description": "Displays time in the bottom area.",
|
||||||
|
"readme": "README.md",
|
||||||
|
"tags": "widget",
|
||||||
|
"type": "widget",
|
||||||
|
"storage": [
|
||||||
|
{"name":"widclkbttm.wid.js","url":"widclkbttm.wid.js"}
|
||||||
|
]
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
0.01: Fork of widclk v0.04 github.com/espruino/BangleApps/tree/master/apps/widclk
|
||||||
|
0.02: Modification for bottom widget area and text color
|
||||||
|
0.03: based in widclk v0.05 compatible at same time, bottom area and color
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
# Digital clock widget (bottom widget area)
|
||||||
|
This very basic widget clock allows to test the unfrequently used widget bottom area.
|
||||||
|
|
||||||
|
forked from
|
||||||
|
https://github.com/espruino/BangleApps/tree/master/apps/widclk
|
||||||
|
|
||||||
|
## Photo
|
||||||
|
|
||||||
|
Example of usage
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Upload the widget file
|
||||||
|
Open an app that supports displaying widgets
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Support
|
||||||
|
|
||||||
|
This app is so basic that probably the easiest is to just edit the code ;)
|
||||||
|
|
||||||
|
Otherwise you can contact me [here](https://github.com/dapgo)
|
Binary file not shown.
After Width: | Height: | Size: 6.2 KiB |
|
@ -0,0 +1,31 @@
|
||||||
|
(function() {
|
||||||
|
// don't show widget if we know we have a clock app running
|
||||||
|
if (Bangle.CLOCK) return;
|
||||||
|
|
||||||
|
let intervalRef = null;
|
||||||
|
var width = 5 * 6*2;
|
||||||
|
var text_color=0x07FF;//cyan
|
||||||
|
|
||||||
|
function draw() {
|
||||||
|
g.reset().setFont("6x8", 2).setFontAlign(-1, 0).setColor(text_color);
|
||||||
|
var time = require("locale").time(new Date(),1);
|
||||||
|
g.drawString(time, this.x, this.y+11, true); // 5 * 6*2 = 60
|
||||||
|
}
|
||||||
|
function clearTimers(){
|
||||||
|
if(intervalRef) {
|
||||||
|
clearInterval(intervalRef);
|
||||||
|
intervalRef = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function startTimers(){
|
||||||
|
intervalRef = setInterval(()=>WIDGETS["wdclkbttm"].draw(), 60*1000);
|
||||||
|
WIDGETS["wdclkbttm"].draw();
|
||||||
|
}
|
||||||
|
Bangle.on('lcdPower', (on) => {
|
||||||
|
clearTimers();
|
||||||
|
if (on) startTimers();
|
||||||
|
});
|
||||||
|
|
||||||
|
WIDGETS["wdclkbttm"]={area:"br",width:width,draw:draw};
|
||||||
|
if (Bangle.isLCDOn) intervalRef = setInterval(()=>WIDGETS["wdclkbttm"].draw(), 60*1000);
|
||||||
|
})()
|
Loading…
Reference in New Issue