diff --git a/apps.json b/apps.json index 560d6505b..72480be4c 100644 --- a/apps.json +++ b/apps.json @@ -3443,4 +3443,17 @@ {"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"} + ] + }, ] diff --git a/apps/widclkbttm/Changelog b/apps/widclkbttm/Changelog new file mode 100644 index 000000000..326169af5 --- /dev/null +++ b/apps/widclkbttm/Changelog @@ -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 + diff --git a/apps/widclkbttm/README.md b/apps/widclkbttm/README.md new file mode 100644 index 000000000..5e386a757 --- /dev/null +++ b/apps/widclkbttm/README.md @@ -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 + +![](widTextBottom_ss1.jpg) + + + + +## 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) \ No newline at end of file diff --git a/apps/widclkbttm/widTextBottom_ss1.jpg b/apps/widclkbttm/widTextBottom_ss1.jpg new file mode 100644 index 000000000..cc1afe522 Binary files /dev/null and b/apps/widclkbttm/widTextBottom_ss1.jpg differ diff --git a/apps/widclkbttm/widclkbttm.wid.js b/apps/widclkbttm/widclkbttm.wid.js new file mode 100644 index 000000000..c27906786 --- /dev/null +++ b/apps/widclkbttm/widclkbttm.wid.js @@ -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); +})()