add example clock app
parent
a9d135f616
commit
d5360755bd
|
|
@ -1 +1 @@
|
||||||
0.01: New Widget!
|
0.01: New Clock Info!
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
0.01: New Clock!
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
# Clock Name
|
||||||
|
|
||||||
|
More info on making Clock Faces: https://www.espruino.com/Bangle.js+Clock
|
||||||
|
|
||||||
|
Describe the Clock...
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Describe how to use it
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
Name the function
|
||||||
|
|
||||||
|
## Controls
|
||||||
|
|
||||||
|
Name the buttons and what they are used for
|
||||||
|
|
||||||
|
## Requests
|
||||||
|
|
||||||
|
Name who should be contacted for support/update requests
|
||||||
|
|
||||||
|
## Creator
|
||||||
|
|
||||||
|
Your name
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
require("heatshrink").decompress(atob("mEwwJC/AH4A/AH4AgA=="))
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
// timeout used to update every minute
|
||||||
|
var drawTimeout;
|
||||||
|
|
||||||
|
// schedule a draw for the next minute
|
||||||
|
function queueDraw() {
|
||||||
|
if (drawTimeout) clearTimeout(drawTimeout);
|
||||||
|
drawTimeout = setTimeout(function() {
|
||||||
|
drawTimeout = undefined;
|
||||||
|
draw();
|
||||||
|
}, 60000 - (Date.now() % 60000));
|
||||||
|
}
|
||||||
|
|
||||||
|
function draw() {
|
||||||
|
// queue next draw in one minute
|
||||||
|
queueDraw();
|
||||||
|
// Work out where to draw...
|
||||||
|
var x = g.getWidth()/2;
|
||||||
|
var y = g.getHeight()/2;
|
||||||
|
g.reset();
|
||||||
|
// work out locale-friendly date/time
|
||||||
|
var date = new Date();
|
||||||
|
var timeStr = require("locale").time(date,1);
|
||||||
|
var dateStr = require("locale").date(date);
|
||||||
|
// draw time
|
||||||
|
g.setFontAlign(0,0).setFont("Vector",48);
|
||||||
|
g.clearRect(0,y-15,g.getWidth(),y+25); // clear the background
|
||||||
|
g.drawString(timeStr,x,y);
|
||||||
|
// draw date
|
||||||
|
y += 35;
|
||||||
|
g.setFontAlign(0,0).setFont("6x8");
|
||||||
|
g.clearRect(0,y-4,g.getWidth(),y+4); // clear the background
|
||||||
|
g.drawString(dateStr,x,y);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear the screen once, at startup
|
||||||
|
g.clear();
|
||||||
|
// draw immediately at first, queue update
|
||||||
|
draw();
|
||||||
|
|
||||||
|
// Show launcher when middle button pressed
|
||||||
|
Bangle.setUI("clock");
|
||||||
|
// Load widgets
|
||||||
|
Bangle.loadWidgets();
|
||||||
|
Bangle.drawWidgets();
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
|
|
@ -0,0 +1,15 @@
|
||||||
|
{ "id": "7chname",
|
||||||
|
"name": "My clock human readable name",
|
||||||
|
"shortName":"Short Name",
|
||||||
|
"version":"0.01",
|
||||||
|
"description": "A detailed description of my clock",
|
||||||
|
"icon": "icon.png",
|
||||||
|
"type": "clock",
|
||||||
|
"tags": "clock",
|
||||||
|
"supports" : ["BANGLEJS2"],
|
||||||
|
"readme": "README.md",
|
||||||
|
"storage": [
|
||||||
|
{"name":"7chname.app.js","url":"app.js"},
|
||||||
|
{"name":"7chname.img","url":"app-icon.js","evaluate":true}
|
||||||
|
]
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue