mirror of https://github.com/espruino/BangleApps
commit
3ab56c7616
14
apps.json
14
apps.json
|
@ -418,6 +418,20 @@
|
|||
{"name":"*sclock","url":"clock-simple-icon.js","evaluate":true}
|
||||
]
|
||||
},
|
||||
{ "id": "stclck",
|
||||
"name": "Simple 12H Clock",
|
||||
"icon": "clock-simple.png",
|
||||
"version":"0.01",
|
||||
"description": "Simple Digital 12-Hour Clock",
|
||||
"tags": "clock",
|
||||
"type":"clock",
|
||||
"allow_emulator":true,
|
||||
"storage": [
|
||||
{"name":"+sclock","url":"clock-simple.json"},
|
||||
{"name":"-sclock","url":"clock-simple.js"},
|
||||
{"name":"*sclock","url":"clock-simple-icon.js","evaluate":true}
|
||||
]
|
||||
},
|
||||
{ "id": "gesture",
|
||||
"name": "Gesture Test",
|
||||
"icon": "gesture.png",
|
||||
|
|
|
@ -23,8 +23,16 @@
|
|||
|
||||
// draw time
|
||||
var time = da[4].substr(0, 5);
|
||||
var [hours, minutes] = time.split(":");
|
||||
var meridian = "AM";
|
||||
if (Number(hours) > 12) {
|
||||
hours -= String(Number(hours) - 12);
|
||||
meridian = "PM";
|
||||
}
|
||||
g.setFont(font, timeFontSize);
|
||||
g.drawString(time, xyCenter, yposTime, true);
|
||||
g.drawString(`${hours}:${minutes}`, xyCenter, yposTime, true);
|
||||
g.setFont(font, gmtFontSize);
|
||||
g.drawString(meridian, xyCenter + 100, yposTime + 10, true);
|
||||
|
||||
// draw Day, name of month, Date
|
||||
var date = [da[0], da[1], da[2]].join(" ");
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
require("heatshrink").decompress(atob("mEwxH+AH4A/AH4ATiwAGFdYzlFp4xeFyYwZD49kxGt2fX6+z1uIsgxcDQtAxArCAA+zxFAGDAYFxAsJAAuIGCxcF1ouPAAOsGCouERRSUKSYguoGARgRCIiMSAAutGCDqUABNkF5yNEFzKRQLzwABxAvRdgYFBDgYFFBphgEF5lkEJwNOYIaORF7KQMBYetEJoDHAo+sF56+DF7TAMBYaBQBpwv/R97vvxCPdxAvLGAdkF7tkFxbAIF7C+MSBQAXRxovEoAvboAvNMD69DFxYvEi2sFy+sDwgvLGAryDACTsEFxrCGGCmzXh5gJSSaMFF6AwGshiPdQguSGA8WxAxK2eIRYguUGBBjBxGsGYWz1mILYwuWGJQANFq4wWFzQxSFrozNFcYA/AH4Av"))
|
|
@ -0,0 +1,68 @@
|
|||
/* jshint esversion: 6 */
|
||||
(function() {
|
||||
const timeFontSize = 6;
|
||||
const dateFontSize = 3;
|
||||
const gmtFontSize = 2;
|
||||
const font = "6x8";
|
||||
|
||||
const xyCenter = g.getWidth() / 2;
|
||||
const yposTime = 75;
|
||||
const yposDate = 130;
|
||||
const yposYear = 175;
|
||||
const yposGMT = 220;
|
||||
|
||||
function drawSimpleClock() {
|
||||
// get date
|
||||
var d = new Date();
|
||||
var da = d.toString().split(" ");
|
||||
|
||||
// drawSting centered
|
||||
g.setFontAlign(0, 0);
|
||||
|
||||
// draw time
|
||||
var time = da[4].substr(0, 5).split(":");
|
||||
var hours = time[0],
|
||||
minutes = time[1];
|
||||
var meridian = "AM";
|
||||
if (Number(hours) > 12) {
|
||||
hours -= String(Number(hours) - 12);
|
||||
meridian = "PM";
|
||||
}
|
||||
g.setFont(font, timeFontSize);
|
||||
g.drawString(`${hours}:${minutes}`, xyCenter, yposTime, true);
|
||||
g.setFont(font, gmtFontSize);
|
||||
g.drawString(meridian, xyCenter + 102, yposTime + 10, true);
|
||||
|
||||
// draw Day, name of month, Date
|
||||
var date = [da[0], da[1], da[2]].join(" ");
|
||||
g.setFont(font, dateFontSize);
|
||||
|
||||
g.drawString(date, xyCenter, yposDate, true);
|
||||
|
||||
// draw year
|
||||
g.setFont(font, dateFontSize);
|
||||
g.drawString(d.getFullYear(), xyCenter, yposYear, true);
|
||||
|
||||
// draw gmt
|
||||
var gmt = da[5];
|
||||
g.setFont(font, gmtFontSize);
|
||||
g.drawString(gmt, xyCenter, yposGMT, true);
|
||||
}
|
||||
|
||||
// handle switch display on by pressing BTN1
|
||||
Bangle.on("lcdPower", function(on) {
|
||||
if (on) {
|
||||
drawWidgets();
|
||||
drawSimpleClock();
|
||||
}
|
||||
});
|
||||
|
||||
// clean app screen
|
||||
g.clear();
|
||||
|
||||
// refesh every 15 sec
|
||||
setInterval(drawSimpleClock, 15e3);
|
||||
|
||||
// draw now
|
||||
drawSimpleClock();
|
||||
})();
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"name": "Simple 12H Clock",
|
||||
"type": "clock",
|
||||
"icon": "*sclock",
|
||||
"src": "-sclock",
|
||||
"sortorder": -10
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 590 B |
Loading…
Reference in New Issue