Merge branch 'master' of github.com:espruino/BangleApps

pull/532/head
Gordon Williams 2020-07-17 08:10:34 +01:00
commit 5983566782
7 changed files with 49 additions and 4 deletions

View File

@ -93,7 +93,7 @@
"name": "Fullscreen Notifications",
"shortName":"Notifications",
"icon": "notify.png",
"version":"0.02",
"version":"0.03",
"description": "A handler for displaying notifications that displays them fullscreen. This may not fully restore the screen after on some apps. See `Notifications (default)` for more information about the notifications library.",
"tags": "widget",
"type": "notify",
@ -1582,8 +1582,7 @@
{"name": "ballmaze.json"}
]
},
{
"id": "calendar",
{ "id": "calendar",
"name": "Calendar",
"icon": "calendar.png",
"version": "0.01",
@ -2100,5 +2099,17 @@
{"name":"osgridref.app.js","url":"app.js"},
{"name":"osgridref.img","url":"app-icon.js","evaluate":true}
]
},
{"id": "counter",
"name": "Counter",
"icon": "counter_icon.png",
"version": "0.01",
"description": "Simple counter",
"tags": "tool",
"allow_emulator": true,
"storage": [
{"name": "counter.app.js", "url": "counter.js"},
{"name": "counter.img", "url": "counter-icon.js", "evaluate": true}
]
}
]

1
apps/counter/ChangeLog Normal file
View File

@ -0,0 +1 @@
0.01: New App!

View File

@ -0,0 +1 @@
require("heatshrink").decompress(atob("mEwwhC/ACcRiAWViURCycBj//+IwTgMv//yC63zC5sBiIAEI4QIFDo8SmYADmURmcRkYJEkIuGBooOBSAIIFmYwFgINGABIwFEo4XqmUiABJtCC46KBABYYBC48xF5gPBC48ikIPCiQDCkIIBAwMhC5ESdQIABkYDCmXx/8v+MxC7URbQQXEmYXCAYIXHgJ9BC4vxkUvkfyAYMy+X/BQIXCkMjmIXGB4MjAYUy+cRF4kxl4XOMYQXESgIXl+cSI4oMBO50/O4siL4ynH+cjU5rXHC4zXJC4y/BC4oADC4J9BkQABiQDCLAQGBkIXIkMyCYQAHkYPCC40yMwIAKkYXIDAIvLBwIXIABwXdgIJCIhEyC5RRBmJzHiUhicTC4LUCJCYuFGASmMAAIuGAH4A/AHo"))

31
apps/counter/counter.js Normal file
View File

@ -0,0 +1,31 @@
var counter = 0;
g.setColor(0xFFFF);
function updateScreen() {
g.clearRect(0, 50, 250, 150);
g.setFont("Vector",40).setFontAlign(0,0);
g.drawString(Math.floor(counter), g.getWidth()/2, 100);
}
// add a count by using BTN1
setWatch(() => {
counter += 1;
updateScreen();
}, BTN1, {repeat:true});
setWatch(() => {
counter = 0;
updateScreen();
}, BTN3, {repeat:true});
g.clear(1).setFont("6x8");
g.drawString('Use BTN1 to increase\nthe counter by one.\nUse BTN3 to reset counter.', 25, 200);
Bangle.loadWidgets();
Bangle.drawWidgets();
// TODO: Enable saving counts to file
// Does not work if widgets are not visible
// Add small watch

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -1,2 +1,3 @@
0.01: New Library!
0.02: Add notification ID option
0.03: Fix custom render callback

View File

@ -68,7 +68,7 @@ exports.show = function(options) {
g.setColor(-1).setFont("6x8", 2).setFontAlign(-1, -1, 0).drawString(body, x-4, y+4);
}
if (options.render) options.render(320 - h);
if (options.render) options.render(120-h/2);
if (options.on) Bangle.setLCDPower(1); // light up
Bangle.on("touch", exports.hide);