Changed setWatch to Bangle.setUI

pull/765/head
Gordon Williams 2021-06-24 15:11:14 +01:00
parent 1d0a618356
commit e54466d7b3
5 changed files with 25 additions and 24 deletions

View File

@ -904,9 +904,9 @@
{ "id": "dclock",
"name": "Dev Clock",
"icon": "clock-dev.png",
"version":"0.09",
"version":"0.10",
"description": "A Digital Clock including timestamp (tst), beats(@), days in current month (dm) and days since new moon (l)",
"tags": "clock",
"tags": "clock,b2",
"type":"clock",
"allow_emulator":true,
"storage": [
@ -1168,9 +1168,9 @@
{ "id": "ctrclk",
"name": "Centerclock",
"icon": "app.png",
"version":"0.02",
"version":"0.03",
"description": "Watch-centered digital 24h clock with date in dd.mm.yyyy format.",
"tags": "clock",
"tags": "clock,nob2",
"type":"clock",
"allow_emulator":true,
"storage": [
@ -3051,7 +3051,7 @@
"version":"0.01",
"description": "Displays RGB565 and RGB888 colors, its name and code in screen.",
"readme": "README.md",
"tags": "Color, input,buttons,touch,UI",
"tags": "Color,input,buttons,touch,UI,nob2",
"storage": [
{"name":"color_catalog.app.js","url":"app.js"},
{"name":"color_catalog.img","url":"app-icon.js","evaluate":true}

View File

@ -1 +1,2 @@
0.02: Modified for use with new bootloader and firmware
0.03: Changed setWatch to Bangle.setUI

View File

@ -46,26 +46,25 @@ function drawSegment (align, base, str) {
point = base + (maxSegmentWidth / 2) -
(g.stringWidth(str) / 2);
}
g.setColor(1, 1, 1);
g.setColor(g.theme.fg);
g.drawString(str, point, middleY - 4, false);
}
function drawDots (center) {
g.setColor(0xFD20);
g.setColor("#FA0");
g.fillCircle(center, middleY + 10, 2);
g.fillCircle(center, middleY + 40, 2);
}
function drawLines () {
g.setColor(0.5, 0.5, 0.5);
g.setColor("#777");
g.drawLine(middleX - lineLength, lineY1, middleX + lineLength, lineY1);
g.drawLine(middleX - lineLength, lineY2, middleX + lineLength, lineY2);
}
function drawDate (str) {
let maxSegmentWidth = 236;
g.setColor(0.5, 0.5, 0.5);
g.setColor(0.5, 0.5, 0.5);
g.setColor("#777");
g.drawString(str, (maxSegmentWidth) - (g.stringWidth(str)), middleY - 22,
false);
}
@ -149,6 +148,9 @@ function start () {
}
start();
// Show launcher when middle button pressed
Bangle.setUI("clock");
Bangle.loadWidgets();
Bangle.drawWidgets();
Bangle.on('lcdPower', function (on) {
@ -158,6 +160,3 @@ Bangle.on('lcdPower', function (on) {
stop();
}
});
// Show launcher when middle button pressed
setWatch(Bangle.showLauncher, BTN2, {repeat:false,edge:"falling"});

View File

@ -7,3 +7,4 @@
0.07: add days in current month (md) and days since new moon (l)
0.08: update icon
0.09: Use localised month and day of the week from locale
0.10: Changed setWatch to Bangle.setUI and allow small screen

View File

@ -1,17 +1,18 @@
var locale = require("locale");
/* jshint esversion: 6 */
const timeFontSize = 4;
const dateFontSize = 3;
const smallFontSize = 2;
const big = g.getWidth()>200;
const timeFontSize = big?4:3;
const dateFontSize = big?3:2;
const smallFontSize = big?2:1;
const font = "6x8";
const xyCenter = g.getWidth() / 2;
const yposTime = 50;
const yposDate = 85;
const yposTst = 115;
const yposDml = 170;
const yposDayMonth = 195;
const yposGMT = 220;
const yposDate = big?85:75;
const yposTst = big?115:95;
const yposDml = big?170:130;
const yposDayMonth = big?195:140;
const yposGMT = big?220:150;
// Check settings for what type our clock should be
var is12Hour = (require("Storage").readJSON("setting.json",1)||{})["12hour"];
@ -99,6 +100,8 @@ Bangle.on('lcdPower', function(on) {
// clean app screen
g.clear();
// Show launcher when button pressed
Bangle.setUI("clock");
Bangle.loadWidgets();
Bangle.drawWidgets();
@ -107,6 +110,3 @@ setInterval(drawSimpleClock, 100);
// draw now
drawSimpleClock();
// Show launcher when middle button pressed
setWatch(Bangle.showLauncher, BTN2, {repeat:false,edge:"falling"});