forked from FOSS/BangleApps
fixed and aligned for bangle2
*bugfix* stopwatch broken with v0.03 setUI realigned quick n dirty screen positions help adjusted to fit bangle1 & bangle2 screen-size with widgets fixed bangle2 colors for chrono and last lap highlight added screen for bangle2 and a small READMEmaster
parent
6adb217512
commit
009df38104
|
@ -2095,12 +2095,13 @@
|
||||||
"id": "devstopwatch",
|
"id": "devstopwatch",
|
||||||
"name": "Dev Stopwatch",
|
"name": "Dev Stopwatch",
|
||||||
"shortName": "Dev Stopwatch",
|
"shortName": "Dev Stopwatch",
|
||||||
"version": "0.03",
|
"version": "0.04",
|
||||||
"description": "Stopwatch with 5 laps supported (cyclically replaced)",
|
"description": "Stopwatch with 5 laps supported (cyclically replaced)",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"tags": "stopwatch,chrono,timer,chronometer",
|
"tags": "stopwatch,chrono,timer,chronometer",
|
||||||
"supports": ["BANGLEJS","BANGLEJS2"],
|
"supports": ["BANGLEJS","BANGLEJS2"],
|
||||||
"screenshots": [{"url":"bangle1-dev-stopwatch-screenshot.png"}],
|
"screenshots": [{"url":"bangle1-dev-stopwatch-screenshot.png"},{"url":"bangle2-dev-stopwatch-screenshot.png"}],
|
||||||
|
"readme": "README.md",
|
||||||
"allow_emulator": true,
|
"allow_emulator": true,
|
||||||
"storage": [
|
"storage": [
|
||||||
{"name":"devstopwatch.app.js","url":"app.js"},
|
{"name":"devstopwatch.app.js","url":"app.js"},
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
0.01: App created
|
0.01: App created
|
||||||
0.02: Persist state to storage to enable stopwatch to continue in the background
|
0.02: Persist state to storage to enable stopwatch to continue in the background
|
||||||
0.03: Modified to use setUI, theme and different screens
|
0.03: Modified to use setUI, theme and different screens
|
||||||
|
0.04: *bugfix* stopwatch broken with v0.03 setUI
|
||||||
|
realigned quick n dirty screen positions
|
||||||
|
help adjusted to fit bangle1 & bangle2 screen-size with widgets
|
||||||
|
fixed bangle2 colors for chrono and last lap highlight
|
||||||
|
added screen for bangle2 and a small README
|
|
@ -0,0 +1,16 @@
|
||||||
|
# dev stop watch
|
||||||
|
|
||||||
|
stores state at kill
|
||||||
|
|
||||||
|
Look and control:
|
||||||
|
|
||||||
|

|
||||||
|
BTN1: start/lap
|
||||||
|
BTN2: launcher
|
||||||
|
BTN3: reset
|
||||||
|
|
||||||
|

|
||||||
|
TAP top right: start/lap
|
||||||
|
TAP bottom right: reset
|
||||||
|
Use BTN to get to launcher
|
||||||
|
|
|
@ -3,11 +3,11 @@ const EMPTY_H = '00:00:000';
|
||||||
const MAX_LAPS = 6;
|
const MAX_LAPS = 6;
|
||||||
const XY_CENTER = g.getWidth() / 2;
|
const XY_CENTER = g.getWidth() / 2;
|
||||||
const big = g.getWidth()>200;
|
const big = g.getWidth()>200;
|
||||||
const Y_CHRONO = 40;
|
const Y_CHRONO = big?40:30;
|
||||||
const Y_HEADER = big?80:60;
|
const Y_HEADER = big?95:65;
|
||||||
const Y_LAPS = big?125:90;
|
const Y_LAPS = big?125:80;
|
||||||
const H_LAPS = big?15:8;
|
const H_LAPS = big?15:8;
|
||||||
const Y_BTN3 = big?225:165;
|
const Y_HELP = big?225:135;
|
||||||
const FONT = '6x8';
|
const FONT = '6x8';
|
||||||
const CHRONO = '/* C H R O N O */';
|
const CHRONO = '/* C H R O N O */';
|
||||||
|
|
||||||
|
@ -27,18 +27,17 @@ var state = require("Storage").readJSON("devstopwatch.state.json",1) || {
|
||||||
|
|
||||||
// Show launcher when button pressed
|
// Show launcher when button pressed
|
||||||
Bangle.setUI("clockupdown", btn=>{
|
Bangle.setUI("clockupdown", btn=>{
|
||||||
if (btn==0) {
|
switch (btn) {
|
||||||
reset = false;
|
case -1:
|
||||||
|
if (state.started) {
|
||||||
if (state.started) {
|
changeLap();
|
||||||
changeLap();
|
} else {
|
||||||
} else {
|
chronoInterval = setInterval(chronometer, 10);
|
||||||
if (!reset) {
|
}
|
||||||
chronoInterval = setInterval(chronometer, 10);
|
break;
|
||||||
}
|
case 1: resetChrono(); break;
|
||||||
|
default: Bangle.showLauncher(); break; //launcher handeled by ROM
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (btn==1) resetChrono();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function resetChrono() {
|
function resetChrono() {
|
||||||
|
@ -105,6 +104,7 @@ function printChrono() {
|
||||||
|
|
||||||
var print = '';
|
var print = '';
|
||||||
|
|
||||||
|
g.setColor(g.theme.fg);
|
||||||
g.setFont(FONT, big?2:1);
|
g.setFont(FONT, big?2:1);
|
||||||
print = CHRONO;
|
print = CHRONO;
|
||||||
g.drawString(print, XY_CENTER, Y_CHRONO, true);
|
g.drawString(print, XY_CENTER, Y_CHRONO, true);
|
||||||
|
@ -124,7 +124,8 @@ function printChrono() {
|
||||||
let suffix = ' ';
|
let suffix = ' ';
|
||||||
if (state.currentLapIndex === i) {
|
if (state.currentLapIndex === i) {
|
||||||
let suffix = '*';
|
let suffix = '*';
|
||||||
g.setColor("#f70");
|
if (process.env.HWVERSION==2) g.setColor("#0ee");
|
||||||
|
else g.setColor("#f70");
|
||||||
}
|
}
|
||||||
|
|
||||||
const lapLine = `L${i - 1} ${state.laps[i]} ${suffix}\n`;
|
const lapLine = `L${i - 1} ${state.laps[i]} ${suffix}\n`;
|
||||||
|
@ -133,8 +134,17 @@ function printChrono() {
|
||||||
|
|
||||||
g.setColor(g.theme.fg);
|
g.setColor(g.theme.fg);
|
||||||
g.setFont(FONT, 1);
|
g.setFont(FONT, 1);
|
||||||
print = 'Press 3 to reset';
|
//help for model 2 or 1
|
||||||
g.drawString(print, XY_CENTER, Y_BTN3, true);
|
if (process.env.HWVERSION==2) {
|
||||||
|
print = /*LANG*/'TAP right top/bottom';
|
||||||
|
g.drawString(print, XY_CENTER, Y_HELP, true);
|
||||||
|
print = /*LANG*/'start&lap/reset, BTN1: EXIT';
|
||||||
|
g.drawString(print, XY_CENTER, Y_HELP+10, true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
print = /*LANG*/'BTNs 1:startlap 2:exit 3:reset';
|
||||||
|
g.drawString(print, XY_CENTER, Y_HELP, true);
|
||||||
|
}
|
||||||
|
|
||||||
g.flip();
|
g.flip();
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 2.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
Loading…
Reference in New Issue