Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lcdclock/lcdclockplus: fix special characters in clockinfo menus #3592

Merged
merged 7 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/lcdclock/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
0.04: clock_info is loaded before widgets to match other clocks
0.05: fix alignment of clock items caused by 0.04 (fix #2970)
0.06: Minor code improvements
0.07: fix special characters in clockinfo menus
4 changes: 2 additions & 2 deletions apps/lcdclock/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ let clockInfoDraw = (itm, info, options) => {

if (info.img) g.drawImage(info.img, options.x+2, options.y+2);
var title = clockInfoItems[options.menuA].name;
var text = info.text.toString().toUpperCase();
var text = info.text.toString().toUpperCase().replace(/[^A-Z0-9]/g, "");
if (title!="Bangle") g.setFontAlign(1,0).drawString(title.toUpperCase(), options.x+options.w-2, options.y+14);
if (g.setFont("7Seg:2").stringWidth(text)+8>options.w) g.setFont("7Seg");
g.setFontAlign(0,0).drawString(text, options.x+options.w/2, options.y+40);
Expand Down Expand Up @@ -82,4 +82,4 @@ Bangle.drawWidgets();
let clockInfoItems = require("clock_info").load();
let clockInfoMenu = require("clock_info").addInteractive(clockInfoItems, { app:"lcdclock", x:R.x, y:R.y, w:midX-2, h:barY-R.y-2, draw : clockInfoDraw});
let clockInfoMenu2 = require("clock_info").addInteractive(clockInfoItems, { app:"lcdclock", x:midX+2, y:R.y, w:midX-3, h:barY-R.y-2, draw : clockInfoDraw});
}
}
2 changes: 1 addition & 1 deletion apps/lcdclock/metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ "id": "lcdclock",
"name": "LCD Clock",
"version": "0.06",
"version": "0.07",
"description": "A Casio-style clock, with ClockInfo areas at the top and bottom. Tap them and swipe up/down to toggle between different information",
"icon": "app.png",
"screenshots": [{"url":"screenshot.png"}],
Expand Down
1 change: 1 addition & 0 deletions apps/lcdclockplus/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
0.01: New App!
0.02: Minor code improvements
0.03: fix special characters in clockinfo menus
2 changes: 1 addition & 1 deletion apps/lcdclockplus/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ let clockInfoDraw = (itm, info, options) => {
if (info.img) {
g.drawImage(info.img, options.x+1,options.y+2);
}
var text = info.text.toString().toUpperCase();
var text = info.text.toString().toUpperCase().replace(/[^A-Z0-9]/g, "");
if (g.setFont("7Seg:2").stringWidth(text)+24-2>options.w) g.setFont("7Seg");
g.setFontAlign(0,-1).drawString(text, options.x+options.w/2+13, options.y+6);
};
Expand Down
2 changes: 1 addition & 1 deletion apps/lcdclockplus/metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ "id": "lcdclockplus",
"name": "LCD Clock Plus",
"version": "0.02",
"version": "0.03",
"description": "A Casio-style clock, with four ClockInfo areas at the top and bottom. Tap them and swipe up/down and left/right to toggle between different information.",
"icon": "app.png",
"screenshots": [{"url":"screenshot.png"},{"url":"screenshot2.png"}],
Expand Down
Loading