Improved smpltmr clock info to be not specialiset for bw clock.

master
David Peer 2022-10-02 14:30:13 +02:00
parent 3809c91f1f
commit ae84bc9a18
4 changed files with 127 additions and 125 deletions

View File

@ -1,3 +1,4 @@
0.01: Release 0.01: Release
0.02: Rewrite with new interface 0.02: Rewrite with new interface
0.03: Added clock infos to expose timer functionality to clocks. 0.03: Added clock infos to expose timer functionality to clocks.
0.04: Improvements of clock infos.

View File

@ -69,7 +69,7 @@
img: img, img: img,
items: [ items: [
{ {
name: "Timer", name: null,
get: () => ({ text: getAlarmMinutesText() + (isAlarmEnabled() ? " min" : ""), img: null}), get: () => ({ text: getAlarmMinutesText() + (isAlarmEnabled() ? " min" : ""), img: null}),
show: function() { smpltmrItems.items[0].emit("redraw"); }, show: function() { smpltmrItems.items[0].emit("redraw"); },
hide: function () {}, hide: function () {},
@ -78,17 +78,18 @@
] ]
}; };
var offsets = [+1,+5,-1,-5]; var offsets = [+5,-5];
offsets.forEach((o, i) => { offsets.forEach((o, i) => {
smpltmrItems.items = smpltmrItems.items.concat({ smpltmrItems.items = smpltmrItems.items.concat({
name: String(o), name: null,
get: () => ({ text: getAlarmMinutesText() + " (" + (o > 0 ? "+" : "") + o + ")", img: null}), get: () => ({ text: (o > 0 ? "+" : "") + o + " min.", img: null}),
show: function() { smpltmrItems.items[i+1].emit("redraw"); }, show: function() { smpltmrItems.items[i+1].emit("redraw"); },
hide: function () {}, hide: function () {},
run: function() { run: function() {
if(o > 0) increaseAlarm(o); if(o > 0) increaseAlarm(o);
else decreaseAlarm(Math.abs(o)); else decreaseAlarm(Math.abs(o));
this.show(); this.show();
return true;
} }
}); });
}); });

View File

@ -2,7 +2,7 @@
"id": "smpltmr", "id": "smpltmr",
"name": "Simple Timer", "name": "Simple Timer",
"shortName": "Simple Timer", "shortName": "Simple Timer",
"version": "0.03", "version": "0.04",
"description": "A very simple app to start a timer.", "description": "A very simple app to start a timer.",
"icon": "app.png", "icon": "app.png",
"tags": "tool,alarm,timer", "tags": "tool,alarm,timer",