Merge pull request #2884 from halemmerich/keytimer

keytimer - Visual tweaks
pull/2879/head^2
Gordon Williams 2023-07-17 08:48:14 +01:00 committed by GitHub
commit a25ad46efe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 9 deletions

View File

@ -1,3 +1,4 @@
0.01: New app!
0.02: Submitted to the app loader
0.03: Rewrote to use scheduler library
0.03: Rewrote to use scheduler library
0.04: Use theme colors

View File

@ -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) {

View File

@ -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",

View File

@ -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
.drawImage(BUTTON_ICONS.reset, g.getWidth() / 4, BAR_TOP);
.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);
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);
g.setColor(s.theme.fg2)
.drawImage(BUTTON_ICONS.play, g.getWidth() * 3 / 4, BAR_TOP + 12, {rotate:0});
}
}