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

pull/1754/head
Gordon Williams 2022-04-26 10:27:29 +01:00
commit a65e268a53
21 changed files with 216 additions and 27 deletions

View File

@ -1 +1,2 @@
0.01: New App!
0.02: Fix the settings bug and some tweaking

View File

@ -15,7 +15,7 @@ function drawAlert(){
});
Bangle.buzz(400);
setTimeout(load, 10000);
setTimeout(load, 20000);
}
function run(){

View File

@ -6,17 +6,17 @@ exports.loadSettings = function() {
maxInnactivityMin: 30,
dismissDelayMin: 15,
minSteps: 50
}, require("Storage").readJSON("ar.settings.json", true) || {});
}, require("Storage").readJSON("activityreminder.s.json", true) || {});
};
exports.writeSettings = function(settings){
require("Storage").writeJSON("ar.settings.json", settings);
require("Storage").writeJSON("activityreminder.s.json", settings);
};
exports.saveStepsArray = function(stepsArray) {
require("Storage").writeJSON("ar.stepsarray.json", stepsArray);
require("Storage").writeJSON("activityreminder.sa.json", stepsArray);
};
exports.loadStepsArray = function(){
return require("Storage").readJSON("ar.stepsarray.json") || [];
return require("Storage").readJSON("activityreminder.sa.json") || [];
};

View File

@ -3,7 +3,7 @@
"name": "Activity Reminder",
"shortName":"Activity Reminder",
"description": "A reminder to take short walks for the ones with a sedentary lifestyle",
"version":"0.01",
"version":"0.02",
"icon": "app.png",
"type": "app",
"tags": "tool,activity",
@ -17,6 +17,7 @@
{"name": "activityreminder.img", "url": "app-icon.js", "evaluate": true}
],
"data": [
{"name": "ar.settings.json", "name": "ar.stepsarray.json"}
{"name": "activityreminder.s.json"},
{"name": "activityreminder.sa.json"}
]
}

View File

@ -7,7 +7,7 @@
"" : { "title" : "Activity Reminder" },
"< Back" : () => back(),
'Enable': {
value: !!settings.enabled,
value: settings.enabled,
format: v => v?"Yes":"No",
onchange: v => {
settings.enabled = v;
@ -15,7 +15,7 @@
}
},
'Start hour': {
value: 9|settings.startHour,
value: settings.startHour,
min: 0, max: 24,
onchange: v => {
settings.startHour = v;
@ -23,7 +23,7 @@
}
},
'End hour': {
value: 20|settings.endHour,
value: settings.endHour,
min: 0, max: 24,
onchange: v => {
settings.endHour = v;
@ -31,15 +31,15 @@
}
},
'Max innactivity': {
value: 30|settings.maxInnactivityMin,
min: 15, max: 60,
value: settings.maxInnactivityMin,
min: 15, max: 120,
onchange: v => {
settings.maxInnactivityMin = v;
require("activityreminder").writeSettings(settings);
}
},
'Dismiss delay': {
value: 10|settings.dismissDelayMin,
value: settings.dismissDelayMin,
min: 5, max: 15,
onchange: v => {
settings.dismissDelayMin = v;
@ -47,7 +47,7 @@
}
},
'Min steps': {
value: 50|settings.minSteps,
value: settings.minSteps,
min: 10, max: 500,
onchange: v => {
settings.minSteps = v;

View File

@ -1,3 +1,3 @@
0.01: Initial upload
0.2: Added scrollable calendar and swipe gestures
0.3: Configurable drag gestures
0.02: Added scrollable calendar and swipe gestures
0.03: Configurable drag gestures

View File

@ -1,7 +1,7 @@
{
"id": "clockcal",
"name": "Clock & Calendar",
"version": "0.3",
"version": "0.03",
"description": "Clock with Calendar",
"readme":"README.md",
"icon": "app.png",

View File

@ -1 +1 @@
1.0: Initial release.
0.01: Initial release.

View File

@ -1,7 +1,7 @@
{
"id": "heartzone",
"name": "HeartZone",
"version": "1.0",
"version": "0.01",
"description": "Exercise app for keeping your heart rate in the aerobic zone. Buzzes the watch at configurable intervals when your heart rate is outside of configured limits.",
"readme":"README.md",
"screenshots": [

View File

@ -1 +1 @@
1.0: Initial release on the app repository for Bangle.js 1 and 2
0.01: Initial release on the app repository for Bangle.js 1 and 2

View File

@ -3,7 +3,7 @@
"name":"Stardate Clock",
"shortName":"Stardate Clock",
"description": "A clock displaying a stardate along with a 'standard' digital/analog clock in LCARS design",
"version":"1.0",
"version":"0.01",
"icon": "app.png",
"type":"clock",
"tags": "clock",

1
apps/tapkb/ChangeLog Normal file
View File

@ -0,0 +1 @@
0.01: Initial version

7
apps/tapkb/README.md Normal file
View File

@ -0,0 +1,7 @@
# Tap Keyboard
This was originally designed for the Noteify app. With the new keyboard system in place, it has become its own keyboard app.
## Usage
* Swipe left or right to cycle between the alphabet, numerals, and symbols.
* Hitting "caps" once will capitalize one character only. Hitting "caps" twice activates caps lock, and all subsequent characters will be capitalized until you hit "caps" again.
* "New line" is represented by a pilcrow (¶). When you hit the back button, these symbols will be converted into newline.

1
apps/tapkb/app-icon.js Normal file
View File

@ -0,0 +1 @@
atob("MDCBAf////////////////AAAAAAD8AAAAAAA4AAAAAAAYAAAAAAAQf/////4A//////8A//////8A//////8A//////8A//////8A///8P/8A///8P/8A///8P/8A///8P/8A///8P/8A///8P/8A///8P//w///8P//w///8MP/w///8MP/w///8MMPw///8MMPw///8AMMA///8AAMA///8AAAA///8AAAA///8OAAA///8P+AA//wcP/8Af/AEP/8IA+AAP/8IA+AAP/8MA+DAP/8PA+BgP/8P//B4P/8P//g8P/8P//wfP/8P//4Pv/8P//8H//8P//8D//8P//+D//8P///B//4P///gAAAf///wAAAf///4AAA////8AADw==")

BIN
apps/tapkb/app.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 678 B

162
apps/tapkb/lib.js Normal file
View File

@ -0,0 +1,162 @@
exports.input = function(options) {
options = options||{};
var text = options.text;
if ("string"!=typeof text) text="";
var layer = 0;
var caps = 0;
class keyPad {
constructor(x1, y1, x2, y2, func) {
this.x1 = x1;
this.y1 = y1;
this.x2 = x2;
this.y2 = y2;
this.func = !func ? "" : func;
}
draw() {
g.setColor(g.theme.fg).drawRect(this.x1, this.y1, this.x2, this.y2).clearRect(this.x1+1, this.y1+1, this.x2-1, this.y2-1).setFont("6x8",2).setFontAlign(0, 0, 0).drawString(this.func, (((this.x2-this.x1)/2)+this.x1), (((this.y2-this.y1)/2)+this.y1));
}
onTouch(xy) {
if (this.func == "space") text += " ";
else if (this.func == "<-") text = text.slice(0, -1);
else if (this.func == "new\nline") text += String.fromCharCode(182);
else if (this.func == "caps") {
caps = 1;
renderKeys();
}
else if (this.func == "Caps") {
caps = 2;
renderKeys();
}
else if (this.func == "CAPS") {
caps = 0;
renderKeys();
}
else {
text += this.func;
if (caps == 1) caps = 0;
}
g.clearRect(25, 0, g.getWidth(), 25).setFontAlign(-1, -1).drawString(text.substring(text.length-12, text.length)+"_", 25, 7);
}
}
function renderKeys() {
var a;
var i;
if (layer == 0) {
if (caps == 0) {
a = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "caps", "space", "<-"];
}
else a = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "Caps", "space", "<-"];
if (caps == 2) a[9] = "CAPS";
for (i = 0; i < a.length; i++) {
pad[i].func = a[i];
}
}
else if (layer == 1) {
if (caps == 0) {
a = ["j", "k", "l", "m", "n", "o", "p", "q", "r", "caps", "space", "<-"];
}
else a = ["J", "K", "L", "M", "N", "O", "P", "Q", "R", "Caps", "space", "<-"];
if (caps == 2) a[9] = "CAPS";
for (i = 0; i < a.length; i++) {
pad[i].func = a[i];
}
}
else if (layer == 2) {
if (caps == 0) {
a = ["s", "t", "u", "v", "w", "x", "y", "z", "0", "caps", "space", "<-"];
}
else a = ["S", "T", "U", "V", "W", "X", "Y", "Z", "0", "Caps", "space", "<-"];
if (caps == 2) a[9] = "CAPS";
for (i = 0; i < a.length; i++) {
pad[i].func = a[i];
}
}
else if (layer == 3) {
if (caps == 0) {
a = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "caps", "space", "<-"];
}
else a = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "Caps", "space", "<-"];
if (caps == 2) a[9] = "CAPS";
for (i = 0; i < a.length; i++) {
pad[i].func = a[i];
}
}
else if (layer == 4) {
if (caps == 0) {
a = [".", ",", "?", "!", "(", ")", "-", "\'", "new\nline", "caps", "space", "<-"];
}
else a = ["-", "+", "/", "*", ":", "#", "$", "%", "new\nline", "Caps", "space", "<-"];
if (caps == 2) a[9] = "CAPS";
for (i = 0; i < a.length; i++) {
pad[i].func = a[i];
}
}
for (var j = 0; j < pad.length; j++) {
pad[j].draw();
}
}
var pad = [];
pad[0] = new keyPad(0, 29, 57, 64);
pad[1] = new keyPad(59, 29, 116, 64);
pad[2] = new keyPad(118, 29, 175, 64);
pad[3] = new keyPad(0, 66, 57, 101);
pad[4] = new keyPad(59, 66, 116, 101);
pad[5] = new keyPad(118, 66, 175, 101);
pad[6] = new keyPad(0, 103, 57, 138);
pad[7] = new keyPad(59, 103, 116, 138);
pad[8] = new keyPad(118, 103, 175, 138);
pad[9] = new keyPad(0, 140, 57, 175);
pad[10] = new keyPad(59, 140, 116, 175);
pad[11] = new keyPad(118, 140, 175, 175);
g.clear();
renderKeys();
var drag;
var e;
return new Promise((resolve,reject) => {
Bangle.setUI({mode:"custom", drag:e=>{
if (!drag) { // start dragging
drag = {x: e.x, y: e.y};
}
else if (!e.b) { // released
const dx = e.x-drag.x, dy = e.y-drag.y;
drag = null;
//horizontal swipes
if (Math.abs(dx)>Math.abs(dy)+10) {
//swipe left
if (dx<0) layer == 4 ? layer = 0 : layer++;
//swipe right
if (dx>0) layer == 0 ? layer = 4 : layer--;
}
}
renderKeys();
},touch:(button, xy)=>{
for (var i = 0; i < pad.length; i++) {
if ((xy.x >= pad[i].x1) && (xy.x <= pad[i].x2) && (xy.y >= pad[i].y1) && (xy.y <= pad[i].y2)) {
pad[i].onTouch(xy);
i = pad.length;
}
}
},back:()=>{
Bangle.setUI();
g.clear();
resolve(text.replace(new RegExp(String.fromCharCode(182), 'g'), '\n'));
}});
g.clearRect(25, 0, g.getWidth(), 25).setColor(g.theme.fg).setFont("6x8", 2);
if (text == "") g.setFontAlign(0, -1).drawString("<-Swipe->", g.getWidth()/2, 7);
else {
text = text.replace(/\n/g, String.fromCharCode(182));
g.setFontAlign(-1, -1).drawString(text.substring(text.length-12, text.length)+"_", 25, 7);
}
});
};

15
apps/tapkb/metadata.json Normal file
View File

@ -0,0 +1,15 @@
{
"id": "tapkb",
"name": "Tap keyboard",
"version":"0.01",
"description": "An onscreen tap keyboard.",
"icon": "app.png",
"type":"textinput",
"tags": "keyboard",
"supports" : ["BANGLEJS2"],
"readme": "README.md",
"screenshots": [{"url":"screenshot.png"}],
"storage": [
{"name":"textinput","url":"lib.js"}
]
}

BIN
apps/tapkb/screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -1,3 +1,4 @@
0.01: New App!
0.02: Rename "Activity" in "Motion" and display the true values for it
0.03: Add Banglejs 1 compatibility
0.04: Fix settings bug

View File

@ -3,7 +3,7 @@
"name": "Terminal Clock",
"shortName":"Terminal Clock",
"description": "A terminal cli like clock displaying multiple sensor data",
"version":"0.03",
"version":"0.04",
"icon": "app.png",
"type": "clock",
"tags": "clock",

View File

@ -18,7 +18,7 @@
"" : { "title" : "Terminal Clock" },
"< Back" : () => back(),
'HR confidence': {
value: 50|settings.HRMinConfidence, // 0| converts undefined to 0
value: settings.HRMinConfidence,
min: 0, max: 100,
onchange: v => {
settings.HRMinConfidence = v;
@ -26,7 +26,7 @@
}
},
'Show date': {
value: !!settings.showDate,
value: settings.showDate,
format: v => v?"Yes":"No",
onchange: v => {
settings.showDate = v;
@ -34,7 +34,7 @@
}
},
'Show HRM': {
value: !!settings.showHRM,
value: settings.showHRM,
format: v => v?"Yes":"No",
onchange: v => {
settings.showHRM = v;
@ -42,7 +42,7 @@
}
},
'Show Activity': {
value: !!settings.showActivity,
value: settings.showActivity,
format: v => v?"Yes":"No",
onchange: v => {
settings.showActivity = v;
@ -50,7 +50,7 @@
}
},
'Show Steps': {
value: !!settings.showStepCount,
value: settings.showStepCount,
format: v => v?"Yes":"No",
onchange: v => {
settings.showStepCount = v;