add configuration for text direction

pull/802/head
Weiming Hu 2021-09-13 12:45:24 -04:00
parent 7ad0ca6acb
commit 8bfce14000
6 changed files with 27 additions and 21 deletions

View File

@ -1944,26 +1944,16 @@
"id": "largeclock",
"name": "Large Clock",
"icon": "largeclock.png",
"version": "0.09",
"version": "0.10",
"description": "A readable and informational digital watch, with date, seconds and moon phase",
"readme": "README.md",
"tags": "clock",
"type": "clock",
"allow_emulator": true,
"storage": [
{
"name": "largeclock.app.js",
"url": "largeclock.js"
},
{
"name": "largeclock.img",
"url": "largeclock-icon.js",
"evaluate": true
},
{
"name": "largeclock.settings.js",
"url": "settings.js"
}
{"name": "largeclock.app.js", "url": "largeclock.js"},
{"name": "largeclock.img", "url": "largeclock-icon.js", "evaluate": true},
{"name": "largeclock.settings.js", "url": "settings.js"}
],
"data": [
{"name":"largeclock.json"}

View File

@ -7,3 +7,4 @@
0.07: Don't clear all intervals during initialisation
0.08: Use Bangle.setUI for button/launcher handling
0.09: fix font size for latest firmwares
0.10: Configure the side text direction based on the wrist on which you wear your watch

View File

@ -7,6 +7,7 @@ A readable and informational digital watch, with date, seconds and moon phase an
- Readable
- Informative: hours, minutes, secondsa, date, year and moon phase
- Pairs nicely with any other apps: in setting > large clock any installed app can be assigned to BTN1 and BTN3 in order to open it easily directly from the watch, without the hassle of passing trough the launcher. For example BTN1 can be assigned to alarm and BTN3 to chronometer.
- Configure the text direction on the side depending on the wrist on which you wear your watch.
## How to use it

View File

@ -14,6 +14,9 @@ const settings = require("Storage").readJSON("largeclock.json", 1)||{};
const BTN1app = settings.BTN1 || "";
const BTN3app = settings.BTN3 || "";
const right_hand = (require("Storage").readJSON("largeclock.json",1)||{}).right_hand;
const rotation = right_hand ? 3 : 1;
function drawMoon(d) {
const BLACK = 0,
MOON = 0x41f,
@ -145,9 +148,9 @@ function drawTime(d) {
g.setColor(1, 50, 1);
g.drawString(minutes, 40, 130, true);
g.setFont("Vector", 20);
g.setRotation(3);
g.drawString(`${dow} ${day} ${month}`, 60, 10, true);
g.drawString(year, is12Hour ? 46 : 75, 205, true);
g.setRotation(rotation);
g.drawString(`${dow} ${day} ${month}`, 60, right_hand?10:205, true);
g.drawString(year, is12Hour?(right_hand?56:120):(right_hand?85:115), right_hand?205:10, true);
lastMinutes = minutes;
}
g.setRotation(0);

View File

@ -1,4 +1,5 @@
{
"BTN1": "",
"BTN3": ""
"BTN3": "",
"right_hand": true
}

View File

@ -28,7 +28,8 @@
const settings = s.readJSON("largeclock.json", 1) || {
BTN1: "",
BTN3: ""
BTN3: "",
right_hand: false
};
function showApps(btn) {
@ -67,10 +68,19 @@
}
const mainMenu = {
"": { title: "Large Clock Settings" },
"": { title: "Large Clock" },
"< Back": back,
"BTN1 app": () => showApps("BTN1"),
"BTN3 app": () => showApps("BTN3")
"BTN3 app": () => showApps("BTN3"),
"On right hand": {
value: !!settings.right_hand,
format: v=>v?"Yes":"No",
onchange: v=>{
settings.right_hand = v;
s.writeJSON("largeclock.json", settings);
}
}
};
E.showMenu(mainMenu);
});