From 8d2616da5856ab7e50a7628d922b1f021ce60f75 Mon Sep 17 00:00:00 2001 From: Martin Boonk Date: Sun, 16 Jul 2023 10:45:22 +0200 Subject: [PATCH 1/4] keytimer - Use matching theme color for time display background --- apps/keytimer/ChangeLog | 3 ++- apps/keytimer/keypad.js | 3 ++- apps/keytimer/metadata.json | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/keytimer/ChangeLog b/apps/keytimer/ChangeLog index 1c3954fc7..789ab85a8 100644 --- a/apps/keytimer/ChangeLog +++ b/apps/keytimer/ChangeLog @@ -1,3 +1,4 @@ 0.01: New app! 0.02: Submitted to the app loader -0.03: Rewrote to use scheduler library \ No newline at end of file +0.03: Rewrote to use scheduler library +0.04: Use correct background color for number display diff --git a/apps/keytimer/keypad.js b/apps/keytimer/keypad.js index 5844c9a63..6b34d19f2 100644 --- a/apps/keytimer/keypad.js +++ b/apps/keytimer/keypad.js @@ -95,7 +95,8 @@ function getFontSize(length) { function updateDisplay() { let displayString = inputStringToDisplayString(common.state.inputString); - g.clearRect(0, 24, 175, 43).setColor(storage.readJSON('setting.json').theme.fg2).setFontAlign(1, -1).setFont("Vector", getFontSize(displayString.length)).drawString(displayString, 176, 24); + let t = storage.readJSON('setting.json').theme; + g.setBgColor(t.bg2).clearRect(0, 24, 175, 43).setColor(t.fg2).setFontAlign(1, -1).setFont("Vector", getFontSize(displayString.length)).drawString(displayString, 176, 24); } exports.show = function (callerCommon) { diff --git a/apps/keytimer/metadata.json b/apps/keytimer/metadata.json index e0e46f92f..43edf9957 100644 --- a/apps/keytimer/metadata.json +++ b/apps/keytimer/metadata.json @@ -1,7 +1,7 @@ { "id": "keytimer", "name": "Keypad Timer", - "version": "0.03", + "version": "0.04", "description": "A timer with a keypad that runs in the background", "icon": "icon.png", "type": "app", From 2fb27c315a61676ddd49b1e3b0d3ca24f253c24f Mon Sep 17 00:00:00 2001 From: Martin Boonk Date: Sun, 16 Jul 2023 11:08:31 +0200 Subject: [PATCH 2/4] keytimer - Center icons on timer view buttons --- apps/keytimer/timerview.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/keytimer/timerview.js b/apps/keytimer/timerview.js index 4910d805f..e3c4de478 100644 --- a/apps/keytimer/timerview.js +++ b/apps/keytimer/timerview.js @@ -17,11 +17,11 @@ function drawButtons() { .drawLine(g.getWidth() / 2, BAR_TOP, g.getWidth() / 2, g.getHeight()) //Draw the buttons - .drawImage(BUTTON_ICONS.reset, g.getWidth() / 4, BAR_TOP); + .drawImage(BUTTON_ICONS.reset, g.getWidth() / 4, BAR_TOP + 12, {rotate:0}); // rotate option centers the image if (common.running()) { - g.drawImage(BUTTON_ICONS.pause, g.getWidth() * 3 / 4, BAR_TOP); + g.drawImage(BUTTON_ICONS.pause, g.getWidth() * 3 / 4, BAR_TOP + 12, {rotate:0}); } else { - g.drawImage(BUTTON_ICONS.play, g.getWidth() * 3 / 4, BAR_TOP); + g.drawImage(BUTTON_ICONS.play, g.getWidth() * 3 / 4, BAR_TOP + 12, {rotate:0}); } } From 903995ca70cf8c0c52db31beaa464ba73d87be88 Mon Sep 17 00:00:00 2001 From: Martin Boonk Date: Sun, 16 Jul 2023 11:29:29 +0200 Subject: [PATCH 3/4] keytimer - Use theme colors on timer display --- apps/keytimer/timerview.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/apps/keytimer/timerview.js b/apps/keytimer/timerview.js index e3c4de478..1b01fec6c 100644 --- a/apps/keytimer/timerview.js +++ b/apps/keytimer/timerview.js @@ -7,21 +7,25 @@ const BUTTON_ICONS = { let common; +let s = require("Storage").readJSON("setting.json"); + function drawButtons() { //Draw the backdrop const BAR_TOP = g.getHeight() - 24; - g.setColor(0, 0, 1).setFontAlign(0, -1) + g.setBgColor(s.theme.bg2).setColor(s.theme.fg2).setFontAlign(0, -1) .clearRect(0, BAR_TOP, g.getWidth(), g.getHeight()) - .fillRect(0, BAR_TOP, g.getWidth(), g.getHeight()) - .setColor(1, 1, 1) + .setColor(s.theme.fg2) .drawLine(g.getWidth() / 2, BAR_TOP, g.getWidth() / 2, g.getHeight()) //Draw the buttons + .setColor(s.theme.fg2) .drawImage(BUTTON_ICONS.reset, g.getWidth() / 4, BAR_TOP + 12, {rotate:0}); // rotate option centers the image if (common.running()) { - g.drawImage(BUTTON_ICONS.pause, g.getWidth() * 3 / 4, BAR_TOP + 12, {rotate:0}); + g.setColor(s.theme.fg2) + .drawImage(BUTTON_ICONS.pause, g.getWidth() * 3 / 4, BAR_TOP + 12, {rotate:0}); } else { - g.drawImage(BUTTON_ICONS.play, g.getWidth() * 3 / 4, BAR_TOP + 12, {rotate:0}); + g.setColor(s.theme.fg2) + .drawImage(BUTTON_ICONS.play, g.getWidth() * 3 / 4, BAR_TOP + 12, {rotate:0}); } } From 38f6ed54ff2bde3b51ab4d1529bd4b23bb97cd97 Mon Sep 17 00:00:00 2001 From: Martin Boonk Date: Sun, 16 Jul 2023 11:35:47 +0200 Subject: [PATCH 4/4] keytimer - Update changelog --- apps/keytimer/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/keytimer/ChangeLog b/apps/keytimer/ChangeLog index 789ab85a8..d2481d44c 100644 --- a/apps/keytimer/ChangeLog +++ b/apps/keytimer/ChangeLog @@ -1,4 +1,4 @@ 0.01: New app! 0.02: Submitted to the app loader 0.03: Rewrote to use scheduler library -0.04: Use correct background color for number display +0.04: Use theme colors