1
0
Fork 0

Merge remote-tracking branch 'upstream/master'

master
hughbarney 2022-02-23 23:21:22 +00:00
commit 309818e20f
42 changed files with 294 additions and 158 deletions

View File

@ -5,7 +5,7 @@ by Peter Kuppelwieser
*/
let settings = Object.assign({ swupApp: "",swdownApp: "", swleftApp: "", swrightApp: ""}, require("Storage").readJSON("7x7dotsclock.json", true) || {});
let settings = Object.assign({ swupApp: "",swdownApp: "", swleftApp: "", swrightApp: "", ColorMinutes: ""}, require("Storage").readJSON("7x7dotsclock.json", true) || {});
// position on screen
var Xs = 0, Ys = 30,Xe = 175, Ye=175;
@ -13,9 +13,33 @@ var Xs = 0, Ys = 30,Xe = 175, Ye=175;
var SegH = (Ye-Ys)/2,SegW = (Xe-Xs)/2;
var Dx = SegW/14, Dy = SegH/16;
const hColor = [1,1,1];
const mColor = [0.3,0.3,1];
const bColor = [0.2,0.2,0.2];
switch(settings.ColorMinutes) {
case "blue":
var mColor = [0.3,0.3,1];
var sColor = [0,0,1];
var sbColor = [1,1,1];
break;
case "pink":
var mColor = [1,0.3,1];
var sColor = [1,0,1];
var sbColor = [1,1,1];
break;
case "green":
var mColor = [0.3,1,0.3];
var sColor = [0,1,0];
var sbColor = [1,1,1];
break;
case "yellow":
var mColor = [1,1,0.3];
var sColor = [1,1,0];
var sbColor = [0,0,0];
break;
default:
var sColor = [0,0,1];
var mColor = [0.3,0.3,1];
var sbColor = [1,1,1];
}
const bColor = [0.3,0.3,0.3];
const Font = [
[
@ -114,16 +138,22 @@ const Font = [
var dho = -1, eho = -1, dmo = -1, emo = -1;
function drawHSeg(x1,y1,x2,y2,Num,dColor,Size) {
g.setColor(0,0,0);
function drawHSeg(x1,y1,x2,y2,Num,Color,Size) {
g.setColor(g.theme.bg);
g.fillRect(x1, y1, x2, y2);
for (let i = 1; i < 8; i++) {
for (let j = 1; j < 8; j++) {
if (Font[Num][j-1][i-1] == 1) {
g.setColor(dColor[0],dColor[1],dColor[2]);
if (Color == "fg") {
g.setColor(g.theme.fg);
} else {
g.setColor(mColor[0],mColor[1],mColor[2]);
}
g.fillCircle(x1+Dx+(i-1)*(x2-x1)/7,y1+Dy+(j-1)*(y2-y1)/7,Size);
} else {
g.setColor(bColor[0],bColor[1],bColor[2]);
g.setColor(bColor[0],bColor[1],bColor[2]);
g.fillCircle(x1+Dx+(i-1)*(x2-x1)/7,y1+Dy+(j-1)*(y2-y1)/7,1);
}
}
@ -131,11 +161,16 @@ function drawHSeg(x1,y1,x2,y2,Num,dColor,Size) {
}
function drawSSeg(x1,y1,x2,y2,Num,dColor,Size) {
function drawSSeg(x1,y1,x2,y2,Num,Color,Size) {
for (let i = 1; i < 8; i++) {
for (let j = 1; j < 8; j++) {
if (Font[Num][j-1][i-1] == 1) {
g.setColor(dColor[0],dColor[1],dColor[2]);
if (Color == "fg") {
g.setColor(sColor[0],sColor[1],sColor[2]);
} else {
g.setColor(g.theme.fg);
//g.setColor(0.7,0.7,0.7);
}
g.fillCircle(x1+(i-1)*(x2-x1)/7,y1+(j-1)*(y2-y1)/7,Size);
}
}
@ -143,25 +178,27 @@ function drawSSeg(x1,y1,x2,y2,Num,dColor,Size) {
}
function ShowSecons() {
g.setColor(1,1,1);
g.fillRect((Xe-Xs) / 2 - 14 + Xs -3,
(Ye-Ys) / 2 - 7 + Ys -3,
(Xe-Xs) / 2 + 14 + Xs +1,
(Ye-Ys) / 2 + 7 + Ys +1);
function ShowSeconds() {
g.setColor(sbColor[0],sbColor[1],sbColor[2]);
g.fillRect((Xe-Xs) / 2 - 14 + Xs -4,
(Ye-Ys) / 2 - 7 + Ys -4,
(Xe-Xs) / 2 + 14 + Xs +4,
(Ye-Ys) / 2 + 7 + Ys +4);
drawSSeg( (Xe-Xs) / 2 - 14 + Xs -1,
(Ye-Ys) / 2 - 7 + Ys ,
(Ye-Ys) / 2 - 7 + Ys +1,
(Xe-Xs) / 2 + Xs -1,
(Ye-Ys) / 2 + 7 + Ys,
ds,mColor,1);
(Ye-Ys) / 2 + 7 + Ys +1,
ds,"fg",1);
drawSSeg( (Xe-Xs) / 2 + Xs +1,
(Ye-Ys) / 2 - 7 + Ys,
(Xe-Xs) / 2 + 14 + Xs +1,
(Ye-Ys) / 2 + 7 + Ys,
es,mColor,1);
drawSSeg( (Xe-Xs) / 2 + Xs +2,
(Ye-Ys) / 2 - 7 + Ys +1,
(Xe-Xs) / 2 + 14 + Xs +2,
(Ye-Ys) / 2 + 7 + Ys +1,
es,"fg",1);
}
@ -185,29 +222,29 @@ function draw() {
g.reset();
if (dh != dho) {
g.setColor(1,1,1);
drawHSeg(Xs, Ys, Xs+SegW, Ys+SegH,dh,hColor,4);
drawHSeg(Xs, Ys, Xs+SegW, Ys+SegH,dh,"fg",4);
dho = dh;
}
if (eh != eho) {
g.setColor(1,1,1);
drawHSeg(Xs+SegW+Dx, Ys, Xs+SegW*2, Ys+SegH,eh,hColor,4);
drawHSeg(Xs+SegW+Dx, Ys, Xs+SegW*2, Ys+SegH,eh,"fg",4);
eho = eh;
}
if (dm != dmo) {
g.setColor(0.3,0.3,1);
drawHSeg(Xs, Ys+SegH+Dy, Xs+SegW, Ys+SegH*2,dm,mColor,4);
drawHSeg(Xs, Ys+SegH+Dy, Xs+SegW, Ys+SegH*2,dm,"",4);
dmo = dm;
}
if (em != emo) {
g.setColor(0.3,0.3,1);
drawHSeg(Xs+SegW+Dx, Ys+SegH+Dy, Xs+SegW*2, Ys+SegH*2,em,mColor,4);
drawHSeg(Xs+SegW+Dx, Ys+SegH+Dy, Xs+SegW*2, Ys+SegH*2,em,"",4);
emo = em;
}
if (!Bangle.isLocked()) ShowSecons();
if (!Bangle.isLocked()) ShowSeconds();
}
@ -278,7 +315,7 @@ function drawWidgeds() {
var x1M = 100;
var y1M = y1B;
var x2M = x1M + 30;
var x2M = x1M + 25;
var y2M = y2B;
if (messages.some(m=>m.new)) {
@ -295,6 +332,7 @@ function drawWidgeds() {
print(strDow[dow] + ' ' + day + '.' + month + ' ' + year);
g.setColor(g.theme.fg);
g.setFontAlign(-1, -1,0);
g.setFont("Vector", 20);
g.drawString(strDow[dow] + ' ' + day, 0, 0, true);

View File

@ -1,21 +1,8 @@
(function(back) {
let settings = Object.assign({ swupApp: "",swdownApp: "", swleftApp: "", swrightApp: ""}, require("Storage").readJSON("7x7dotsclock.json", true) || {});
let settings = Object.assign({ swupApp: "",swdownApp: "", swleftApp: "", swrightApp: "",ColorMinutes: ""}, require("Storage").readJSON("7x7dotsclock.json", true) || {});
function showMainMenu() {
const mainMenu = {
"": {"title": "7x7 Dots Clock Settings"},
"< Back": ()=>load(),
"sw-up": ()=>showSelAppMenu("swupApp"),
"sw-down": ()=>showSelAppMenu("swdownApp"),
"sw-left": ()=>showSelAppMenu("swleftApp"),
"sw-right": ()=>showSelAppMenu("swrightApp")
};
E.showMenu(mainMenu);
}
function setSetting(key,value) {
print("call " + key + " = " + value);
@ -26,6 +13,42 @@ function setSetting(key,value) {
}
// Helper method which uses int-based menu item for set of string values
function stringItems(key, startvalue, values) {
return {
value: (startvalue === undefined ? 0 : values.indexOf(startvalue)),
format: v => values[v],
min: 0,
max: values.length - 1,
wrap: true,
step: 1,
onchange: v => {
setSetting(key,values[v]);
}
};
}
// Helper method which breaks string set settings down to local settings object
function stringInSettings(name, values) {
return stringItems(name,settings[name], values);
}
function showMainMenu() {
const mainMenu = {
"": {"title": "7x7 Dots Clock Settings"},
"< Back": ()=>load(),
"Minutes": stringInSettings("ColorMinutes", ["blue","pink","green","yellow"]),
"swipe-up": ()=>showSelAppMenu("swupApp"),
"swipe-down": ()=>showSelAppMenu("swdownApp"),
"swipe-left": ()=>showSelAppMenu("swleftApp"),
"swipe-right": ()=>showSelAppMenu("swrightApp")
};
E.showMenu(mainMenu);
}
function showSelAppMenu(key) {
var Apps = require("Storage").list(/\.info$/)
.map(app => {var a=storage.readJSON(app, 1);return (

View File

@ -1 +1,2 @@
0.01: Initial version for upload
0.02: better theme support, configurable colors, small improvements

View File

@ -2,16 +2,14 @@
![](dotsfontclock.png)
looks best with dark theme so far
* A Clock with big numbers made of 7x7 dots
* system widgeds ar not (yet) supported
* when screen is locked it shows hours and minutes in full screen mode
* adjustable color for minutes and seconds
![](dotsfontclock-scr1.png)
* when screen is unlocked it shows additional info: bluetooth, battery, new message, date and seconds
* you can configure a app per swipe direction
* when swiping the configured apps are launced
* when screen is unlocked it shows additional info: bluetooth, battery, new message state, date and seconds
* you can configure an app per swipe direction
* when swiping the configured apps are launched
* button press opens launcher

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -1,17 +1,19 @@
{ "id": "7x7dotsclock",
"name": "7x7 Dots Clock",
"shortName":"7x7 Dots Clock",
"version":"0.01",
"version":"0.02",
"description": "A clock with a big 7x7 dots Font",
"icon": "dotsfontclock.png",
"tags": "clock",
"type": "clock",
"supports" : ["BANGLEJS2"],
"supports" : ["BANGLEJS2"],
"allow_emulator": true,
"readme": "README.md",
"storage": [
{"name":"7x7dotsclock.app.js","url":"7x7dotsclock.app.js"},
{"name":"7x7dotsclock.settings.js","url":"7x7dotsclock.settings.js"},
{"name":"7x7dotsclock.img","url":"7x7dotsclock.img.js","evaluate":true}
],
"data": [{"name":"7x7dotsclock.json"}]
"data": [{"name":"7x7dotsclock.json"}],
"screenshots": [{"url":"dotsfontclock.png"},{"url":"dotsfontclock-scr1.png"},{"url":"dotsfontclock-scr2.png"}]
}

View File

@ -13,3 +13,4 @@
Widgets now shown on Alarm screen
0.13: Alarm widget state now updates when setting/resetting an alarm
0.14: Order of 'back' menu item
0.15: Fix hour/minute wrapping code for new menu system

View File

@ -73,12 +73,12 @@ function editAlarm(alarmIndex) {
'': { 'title': /*LANG*/'Alarm' },
/*LANG*/'< Back' : showMainMenu,
/*LANG*/'Hours': {
value: hrs,
onchange: function(v){if (v<0)v=23;if (v>23)v=0;hrs=v;this.value=v;} // no arrow fn -> preserve 'this'
value: hrs, min : 0, max : 23, wrap : true,
onchange: v => hrs=v
},
/*LANG*/'Minutes': {
value: mins,
onchange: function(v){if (v<0)v=59;if (v>59)v=0;mins=v;this.value=v;} // no arrow fn -> preserve 'this'
value: mins, min : 0, max : 59, wrap : true,
onchange: v => mins=v
},
/*LANG*/'Enabled': {
value: en,
@ -138,12 +138,12 @@ function editTimer(alarmIndex) {
const menu = {
'': { 'title': /*LANG*/'Timer' },
/*LANG*/'Hours': {
value: hrs,
onchange: function(v){if (v<0)v=23;if (v>23)v=0;hrs=v;this.value=v;} // no arrow fn -> preserve 'this'
value: hrs, min : 0, max : 23, wrap : true,
onchange: v => hrs=v
},
/*LANG*/'Minutes': {
value: mins,
onchange: function(v){if (v<0)v=59;if (v>59)v=0;mins=v;this.value=v;} // no arrow fn -> preserve 'this'
value: mins, min : 0, max : 59, wrap : true,
onchange: v => mins=v
},
/*LANG*/'Enabled': {
value: en,

View File

@ -2,7 +2,7 @@
"id": "alarm",
"name": "Default Alarm & Timer",
"shortName": "Alarms",
"version": "0.14",
"version": "0.15",
"description": "Set and respond to alarms and timers",
"icon": "app.png",
"tags": "tool,alarm,widget",

View File

@ -1 +1,2 @@
0.01: New App!
0.02: Removed "wake LCD on face-up"-feature: A watch-face should not set things like "wake LCD on face-up".

View File

@ -133,15 +133,6 @@ Bangle.on('lcdPower', (on) => {
clearTimers();
}
});
Bangle.on('faceUp',function(up){
//console.log("faceUp: " + up + " LCD: " + Bangle.isLCDOn());
if (up && !Bangle.isLCDOn()) {
//console.log("faceUp and LCD off");
clearTimers();
Bangle.setLCDPower(true);
}
});
g.clear();

View File

@ -1,7 +1,7 @@
{
"id": "crowclk",
"name": "Crow Clock",
"version": "0.01",
"version": "0.02",
"description": "A simple clock based on Bold Clock that has MST3K's Crow T. Robot for a face",
"icon": "crow_clock.png",
"screenshots": [{"url":"screenshot_crow.png"}],

View File

@ -1,2 +1,3 @@
0.01: Add a number to match to turn off alarm
0.02: Respect Quiet Mode
0.03: Fix hour/minute wrapping code for new menu system

View File

@ -56,25 +56,25 @@ function editAlarm(alarmIndex) {
}
const menu = {
'': { 'title': 'Alarms' },
'Hours': {
value: hrs,
onchange: function(v){if (v<0)v=23;if (v>23)v=0;hrs=v;this.value=v;} // no arrow fn -> preserve 'this'
/*LANG*/'Hours': {
value: hrs, min : 0, max : 23, wrap : true,
onchange: v => hrs=v
},
'Minutes': {
value: mins,
onchange: function(v){if (v<0)v=59;if (v>59)v=0;mins=v;this.value=v;} // no arrow fn -> preserve 'this'
/*LANG*/'Minutes': {
value: mins, min : 0, max : 59, wrap : true,
onchange: v => mins=v
},
'Enabled': {
/*LANG*/'Enabled': {
value: en,
format: v=>v?"On":"Off",
onchange: v=>en=v
},
'Repeat': {
/*LANG*/'Repeat': {
value: en,
format: v=>v?"Yes":"No",
onchange: v=>repeat=v
},
'Auto snooze': {
/*LANG*/'Auto snooze': {
value: as,
format: v=>v?"Yes":"No",
onchange: v=>as=v

View File

@ -2,7 +2,7 @@
"id": "hardalarm",
"name": "Hard Alarm",
"shortName": "HardAlarm",
"version": "0.02",
"version": "0.03",
"description": "Make sure you wake up! Count to the right number to turn off the alarm",
"icon": "app.png",
"tags": "tool,alarm,widget",

1
apps/intclock/ChangeLog Normal file
View File

@ -0,0 +1 @@
0.01: Initial commit

4
apps/intclock/README.md Normal file
View File

@ -0,0 +1,4 @@
# Analogue Clock
![](screenshot_analog.png)

View File

@ -0,0 +1 @@
require("heatshrink").decompress(atob("mEwgP/AH4Aq+GEkPh4E/BZMAh4LGw/h8MPBZHggIXJ/EB4ALI//h/4LHwk/BagA/ACY="))

60
apps/intclock/app.js Normal file
View File

@ -0,0 +1,60 @@
Graphics.prototype.setFontUndo = function(scale) {
// Actual height 19 (20 - 2)
this.setFontCustom(atob("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKqKAqooCqigKqKAAAACgAAKAAAoAACgAAAAAAAAACgAAKAAAoAACgAAAAAAKCgAoKAKqqAqqoCqqgKqqAKCgAoKAKqqAqqo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AAoAACgAAKAAAoCqqgKqqAqqgCqqAAAAAqqACqoAKqoAqqgAAKgAAqAACoAAKgKqoAqqgCqoAKqgAAAACqqgKqqAqqoCqqgACoAAKgACoAAKgAAKgAAqAKqqAqqoCqqgKqqAAAACoKgKgqAqqoCqqgAqgACqAAKoAAqgAqqoCqqgKgqAqCoAAAAKoAAqgACqgAKqAAAqoACqgAKqAAqoCqgAKqAAqgACqAAAAAAoCoCgKgKCqAoKoCiqgKKqAqooCqigKoKAqgoCoCgKgKAAAACqqgKqqAqqoCqqgKAKAoAoAAAAKAAAoAACoAAKgAAKgAAqAAAqAACoAACoAAKgAAKgAAqAAAqAACoAACgAAKAAAACgCgKAKAqqoCqqgKqqAqqoAAA"), 32, atob("DQULDw0RDQUHBw0NBQ0FEQ0FDQ0NDQ0NDQ0FBQsNCw0RDQ0NDQ0NDQ0NDQ0NDw0NDQ0NDQ0NDQ8NDQ0HEQc="), 22+(scale<<8)+(1<<16));
return this;
}
// timeout used to update every minute
var drawTimeout;
// schedule a draw for the next minute
function queueDraw() {
if (drawTimeout) clearTimeout(drawTimeout);
drawTimeout = setTimeout(function() {
drawTimeout = undefined;
draw();
}, 60000 - (Date.now() % 60000));
}
function draw() {
var x = g.getWidth()/2;
var y = g.getHeight()/2 - 10;
g.reset();
// work out locale-friendly date/time
var date = new Date();
var timeStr = require("locale").time(date,1).trim();
var dateStr = require("locale").date(date).toUpperCase();
// draw time
g.setFontAlign(0,0).setFont("Undo:3");
g.clearRect(0,y-30,g.getWidth(),y+30); // clear the background
g.drawString(timeStr,x,y);
// draw date
y += 40;
g.setFontAlign(0,0).setFont("Undo");
g.clearRect(0,y-10,g.getWidth(),y+20); // clear the background
g.drawString(dateStr,x,y);
// queue draw in one minute
queueDraw();
}
// Clear the screen once, at startup
g.clear();
// draw immediately at first, queue update
draw();
// Stop updates when LCD is off, restart when on
Bangle.on('lcdPower',on=>{
if (on) {
draw(); // draw immediately, queue redraw
} else { // stop draw timer
if (drawTimeout) clearTimeout(drawTimeout);
drawTimeout = undefined;
}
});
// Show launcher when middle button pressed
Bangle.setUI("clock");
// Load widgets
Bangle.loadWidgets();
Bangle.drawWidgets();

BIN
apps/intclock/app.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -0,0 +1,16 @@
{
"id": "intclock",
"name": "Interlaced Clock",
"version": "0.01",
"description": "A lightweight digital clock using an 'interlaced' font",
"icon": "app.png",
"screenshots": [{"url":"screenshot.png"}],
"type": "clock",
"tags": "clock",
"supports": ["BANGLEJS","BANGLEJS2"],
"allow_emulator": true,
"storage": [
{"name":"intclock.app.js","url":"app.js"},
{"name":"intclock.img","url":"app-icon.js","evaluate":true}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -1,3 +1,4 @@
0.01: Initial Release
0.02: Support for Bangle 2
0.03: Keep the date from being overwritten, use correct colour from theme for clearing
0.04: Removed "wake LCD on face-up"-feature: A watch-face should not set things like "wake LCD on face-up".

View File

@ -239,15 +239,6 @@ Bangle.on('lcdPower', (on) => {
}
});
Bangle.on('faceUp',function(up){
//console.log("faceUp: " + up + " LCD: " + Bangle.isLCDOn());
if (up && !Bangle.isLCDOn()) {
//console.log("faceUp and LCD off");
clearTimers();
Bangle.setLCDPower(true);
}
});
g.clear();
Bangle.loadWidgets();
Bangle.drawWidgets();

View File

@ -1,7 +1,7 @@
{
"id": "matrixclock",
"name": "Matrix Clock",
"version": "0.03",
"version": "0.04",
"description": "inspired by The Matrix, a clock of the same style",
"icon": "matrixclock.png",
"screenshots": [{"url":"screenshot_matrix.png"}],

View File

@ -32,5 +32,7 @@
0.20: Allow tapping on the body to show a scrollable view of the message and title in a bigger font (fix #1405, #1031)
0.21: Improve list readability on dark theme
0.22: Add Home Assistant icon
0.22: Allow repeat to be switched Off, so there is no buzzing repetition.
Also gave the widget a pixel more room to the right
Allow repeat to be switched Off, so there is no buzzing repetition.
Also gave the widget a pixel more room to the right
0.23: Change message colors to match current theme instead of using green
Now attempt to use Large/Big/Medium fonts, and allow minimum font size to be configured

View File

@ -16,6 +16,9 @@ and `Messages`:
* `Unread Timer` - when a new message is received we go into the Messages app.
If there is no user input for this amount of time then the app will exit and return
to the clock where a ringing bell will be shown in the Widget bar.
* `Min Font` - the minimum font size used when displaying messages on the screen. A bigger font
is chosen if there isn't much message text, but this specifies the smallest the font should get before
it starts getting clipped.
## New Messages

View File

@ -21,13 +21,11 @@
*/
var Layout = require("Layout");
var settings = require('Storage').readJSON("messages.settings.json", true) || {};
var fontSmall = "6x8";
var fontMedium = g.getFonts().includes("6x15")?"6x15":"6x8:2";
var fontBig = g.getFonts().includes("12x20")?"12x20":"6x8:2";
var fontLarge = g.getFonts().includes("6x15")?"6x15:2":"6x8:4";
var colBg = g.theme.dark ? "#141":"#4f4";
var colSBg1 = g.theme.dark ? "#121":"#cFc";
var colSBg2 = g.theme.dark ? "#000":"#9F9";
// hack for 2v10 firmware's lack of ':size' font handling
try {
g.setFont("6x8:2");
@ -143,8 +141,8 @@ function showMapMessage(msg) {
eta = m[2];
} else target=msg.body;
layout = new Layout({ type:"v", c: [
{type:"txt", font:fontMedium, label:target, bgCol:colBg, fillx:1, pad:2 },
{type:"h", bgCol:colBg, fillx:1, c: [
{type:"txt", font:fontMedium, label:target, bgCol:g.theme.bg2, col: g.theme.fg2, fillx:1, pad:2 },
{type:"h", bgCol:g.theme.bg2, col: g.theme.fg2, fillx:1, c: [
{type:"txt", font:"6x8", label:"Towards" },
{type:"txt", font:fontLarge, label:street }
]},
@ -181,7 +179,7 @@ function showMusicMessage(msg) {
checkMessages({clockIfNoMsg:1,clockIfAllRead:1,showMsgIfUnread:1});
}
layout = new Layout({ type:"v", c: [
{type:"h", fillx:1, bgCol:colBg, c: [
{type:"h", fillx:1, bgCol:g.theme.bg2, col: g.theme.fg2, c: [
{ type:"btn", src:getBackImage, cb:back },
{ type:"v", fillx:1, c: [
{ type:"txt", font:fontMedium, label:msg.artist, pad:2 },
@ -214,7 +212,9 @@ function showMessageScroller(msg) {
// a function to draw a menu item
draw : function(idx, r) {
// FIXME: in 2v13 onwards, clearRect(r) will work fine. There's a bug in 2v12
g.setBgColor(idx<titleCnt ? colBg : g.theme.bg).clearRect(r.x,r.y,r.x+r.w, r.y+r.h);
g.setBgColor(idx<titleCnt ? g.theme.bg2 : g.theme.bg).
setColor(idx<titleCnt ? g.theme.fg2 : g.theme.fg).
clearRect(r.x,r.y,r.x+r.w, r.y+r.h);
g.setFont(bodyFont).drawString(lines[idx], r.x, r.y);
}, select : function(idx) {
if (idx>=lines.length-2)
@ -270,13 +270,31 @@ function showMessage(msgid) {
var title=msg.title, titleFont = fontLarge, lines;
if (title) {
var w = g.getWidth()-48;
if (g.setFont(titleFont).stringWidth(title) > w)
titleFont = fontMedium;
if (g.setFont(titleFont).stringWidth(title) > w) {
titleFont = fontBig;
if (settings.fontSize!=1 && g.setFont(titleFont).stringWidth(title) > w)
titleFont = fontMedium;
}
if (g.setFont(titleFont).stringWidth(title) > w) {
lines = g.wrapString(title, w);
title = (lines.length>2) ? lines.slice(0,2).join("\n")+"..." : lines.join("\n");
}
}
// If body of message is only two lines long w/ large font, use large font.
var body=msg.body, bodyFont = fontLarge;
if (body) {
var w = g.getWidth()-10;
if (g.setFont(bodyFont).stringWidth(body) > w * 2) {
bodyFont = fontBig;
if (settings.fontSize!=1 && g.setFont(bodyFont).stringWidth(body) > w * 3)
bodyFont = fontMedium;
}
if (g.setFont(bodyFont).stringWidth(body) > w) {
lines = g.setFont(bodyFont).wrapString(msg.body, w);
var maxLines = Math.floor((g.getHeight()-110) / g.getFontHeight());
body = (lines.length>maxLines) ? lines.slice(0,maxLines).join("\n")+"..." : lines.join("\n");
}
}
function goBack() {
msg.new = false; saveMessages(); // read mail
cancelReloadTimeout(); // don't auto-reload to clock now
@ -303,27 +321,17 @@ function showMessage(msgid) {
checkMessages({clockIfNoMsg:1,clockIfAllRead:1,showMsgIfUnread:1});
}});
}
// If body of message is only two lines long w/ large font, use large font.
var body=msg.body, bodyFont = fontLarge, lines;
if (body) {
var w = g.getWidth()-48;
if (g.setFont(bodyFont).stringWidth(body) > w * 2)
bodyFont = fontMedium;
if (g.setFont(bodyFont).stringWidth(body) > w) {
lines = g.setFont(bodyFont).wrapString(msg.body, g.getWidth()-10);
body = (lines.length>4) ? lines.slice(0,4).join("\n")+"..." : lines.join("\n");
}
}
layout = new Layout({ type:"v", c: [
{type:"h", fillx:1, bgCol:colBg, c: [
{type:"h", fillx:1, bgCol:g.theme.bg2, col: g.theme.fg2, c: [
{ type:"btn", src:getMessageImage(msg), col:getMessageImageCol(msg), pad: 3, cb:()=>{
cancelReloadTimeout(); // don't auto-reload to clock now
showMessageSettings(msg);
}},
{ type:"v", fillx:1, c: [
{type:"txt", font:fontSmall, label:msg.src||/*LANG*/"Message", bgCol:colBg, fillx:1, pad:2, halign:1 },
title?{type:"txt", font:titleFont, label:title, bgCol:colBg, fillx:1, pad:2 }:{},
{type:"txt", font:fontSmall, label:msg.src||/*LANG*/"Message", bgCol:g.theme.bg2, col: g.theme.fg2, fillx:1, pad:2, halign:1 },
title?{type:"txt", font:titleFont, label:title, bgCol:g.theme.bg2, col: g.theme.fg2, fillx:1, pad:2 }:{},
]},
]},
{type:"txt", font:bodyFont, label:body, fillx:1, filly:1, pad:2, cb:()=>{
@ -374,9 +382,8 @@ function checkMessages(options) {
c : Math.max(MESSAGES.length+1,3), // workaround for 2v10.219 firmware (min 3 not needed for 2v11)
draw : function(idx, r) {"ram"
var msg = MESSAGES[idx-1];
if (msg && msg.new) g.setBgColor(colBg);
else g.setBgColor((idx&1) ? colSBg1 : colSBg2);
g.clearRect(r.x,r.y,r.x+r.w-1,r.y+r.h-1).setColor(g.theme.fg);
if (msg && msg.new) g.setBgColor(g.theme.bgH).setColor(g.theme.fgH);
else g.setColor(g.theme.fg);
if (idx==0) msg = {id:"back", title:"< Back"};
if (!msg) return;
var x = r.x+2, title = msg.title, body = msg.body;
@ -391,18 +398,20 @@ function checkMessages(options) {
.setColor(fg); // only color the icon
x += 50;
}
var m = msg.title+"\n"+msg.body;
if (msg.src) g.setFontAlign(1,1).setFont("6x8").drawString(msg.src, r.x+r.w-2, r.y+r.h-2);
var m = msg.title+"\n"+msg.body, longBody=false;
if (title) g.setFontAlign(-1,-1).setFont(fontBig).drawString(title, x,r.y+2);
if (body) {
g.setFontAlign(-1,-1).setFont("6x8");
var l = g.wrapString(body, r.w-14);
var l = g.wrapString(body, r.w-(x+14));
if (l.length>3) {
l = l.slice(0,3);
l[l.length-1]+="...";
}
longBody = l.length>2;
g.drawString(l.join("\n"), x+10,r.y+20);
}
if (!longBody && msg.src) g.setFontAlign(1,1).setFont("6x8").drawString(msg.src, r.x+r.w-2, r.y+r.h-2);
g.setColor("#888").fillRect(r.x,r.y+r.h-1,r.x+r.w-1,r.y+r.h-1); // dividing line between items
},
select : idx => {
if (idx==0) load();
@ -422,7 +431,7 @@ g.clear();
Bangle.loadWidgets();
Bangle.drawWidgets();
setTimeout(() => {
var unreadTimeoutSecs = (require('Storage').readJSON("messages.settings.json", true) || {}).unreadTimeout;
var unreadTimeoutSecs = settings.unreadTimeout;
if (unreadTimeoutSecs===undefined) unreadTimeoutSecs=60;
if (unreadTimeoutSecs)
unreadTimeout = setTimeout(function() {

View File

@ -1,7 +1,7 @@
{
"id": "messages",
"name": "Messages",
"version": "0.22",
"version": "0.23",
"description": "App to display notifications from iOS and Gadgetbridge/Android",
"icon": "app.png",
"type": "app",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -37,6 +37,12 @@
format: v => v?v+"s":/*LANG*/"Off",
onchange: v => updateSetting("unreadTimeout", v)
},
/*LANG*/'Min Font': {
value: 0|settings().fontSize,
min: 0, max: 1,
format: v => [/*LANG*/"Small",/*LANG*/"Medium"][v],
onchange: v => updateSetting("fontSize", v)
},
};
E.showMenu(mainmenu);
})

View File

@ -226,7 +226,7 @@ function showThemeMenu() {
/*LANG*/'Dark BW': ()=>{
upd({
fg:cl("#fff"), bg:cl("#000"),
fg2:cl("#0ff"), bg2:cl("#000"),
fg2:cl("#fff"), bg2:cl("#004"),
fgH:cl("#fff"), bgH:cl("#00f"),
dark:true
});

View File

@ -5,3 +5,4 @@
0.05: BUGFIX: pedometer widget interfered with the clock Font Alignment
0.06: Use Bangle.setUI for button/launcher handling
0.07: Support for Bangle.js 2 and themes
0.08: Removed "wake LCD on face-up"-feature: A watch-face should not set things like "wake LCD on face-up".

View File

@ -1,7 +1,7 @@
{
"id": "slidingtext",
"name": "Sliding Clock",
"version": "0.07",
"version": "0.08",
"description": "Inspired by the Pebble sliding clock, old times are scrolled off the screen and new times on. You are also able to change language on the fly so you can see the time written in other languages using button 1. Currently English, French, Japanese, Spanish and German are supported",
"icon": "slidingtext.png",
"type": "clock",

View File

@ -623,15 +623,6 @@ Bangle.on('lcdPower', (on) => {
}
});
Bangle.on('faceUp',function(up){
//console.log("faceUp: " + up + " LCD: " + Bangle.isLCDOn());
if (up && !Bangle.isLCDOn()) {
//console.log("faceUp and LCD off");
clearTimers();
Bangle.setLCDPower(true);
}
});
g.clear();
load_settings();
Bangle.loadWidgets();

View File

@ -12,4 +12,4 @@
1.10: Adds Kalman filter.
1.14: Add VMG and coordinates screens
1.43: Adds mirroring of the watch face to an Android device. See README.md
1.48: Droidscript mirroring prog automatically uses last connection address. Auto connects when run.
1.49: Droidscript mirroring prog automatically uses last connection address. Auto connects when run.

View File

@ -1 +1,2 @@
0.01: New App!
0.02: Fix settings wrapping code for new menu system

View File

@ -2,7 +2,7 @@
"id": "tabata",
"name": "Tabata",
"shortName": "Tabata - Control High-Intensity Interval Training",
"version": "0.01",
"version": "0.02",
"description": "Control high-intensity interval training (according to tabata: https://en.wikipedia.org/wiki/Tabata_method).",
"icon": "tabata.png",
"tags": "workout,health",

View File

@ -30,18 +30,17 @@ function showMainMenu() {
},
'Pause sec.': {
value: settings.pause,
onchange: function(v){
if (v<0)v=MAX_SECONDS;
if (v>MAX_SECONDS)v=0;
min : 0, max : MAX_SECONDS, wrap : true,
onchange: v => {
settings.pause=v;
this.value=v;
saveSettingsDebounce();
}
},
'Trainig sec.': {
value: settings.training,
onchange: function(v){if (v<0)v=MAX_SECONDS;if (v>MAX_SECONDS)v=0;settings.training=v;
this.value=v;
min : 0, max : MAX_SECONDS, wrap : true,
onchange: v => {
settings.training=v;
saveSettingsDebounce();
}
},
@ -61,8 +60,8 @@ function startTabata() {
g.clear();
Bangle.setLCDMode("doublebuffered");
g.flip();
var pause = settings.pause,
training = settings.training,
var pause = settings.pause,
training = settings.training,
round = 1,
active = true,
clearBtn1, clearBtn2, clearBtn3, timer;
@ -86,7 +85,7 @@ function startTabata() {
exitTraining();
return;
}
if (active) {
drawCountDown(round, training, active);
training--;
@ -117,7 +116,7 @@ function drawCountDown(round, count, active) {
g.setFontAlign(0,0);
g.setFont("6x8", 2);
g.drawString("Round " + round + "/" + settings.rounds,120,6);
g.drawString("Round " + round + "/" + settings.rounds,120,6);
g.setFont("6x8", 6);
g.drawString("" + count,120,80);

View File

@ -180,13 +180,6 @@ function Layout(layout, options) {
if (l.id) ll[l.id] = l;
// fix type up
if (!l.type) l.type="";
// FIXME ':'/fsz not needed in new firmwares - Font:12 is handled internally
// fix fonts for pre-2v11 firmware
if (l.font && l.font.includes(":")) {
var f = l.font.split(":");
l.font = f[0];
l.fsz = f[1];
}
if (l.c) l.c.forEach(recurser);
}
recurser(this._l);
@ -241,13 +234,13 @@ Layout.prototype.render = function (l) {
"":function(){},
"txt":function(l){
if (l.wrap) {
g.setFont(l.font,l.fsz).setFontAlign(0,-1);
g.setFont(l.font).setFontAlign(0,-1);
var lines = g.wrapString(l.label, l.w);
var y = l.y+((l.h-g.getFontHeight()*lines.length)>>1);
// TODO: on 2v11 we can just render in a single drawString call
lines.forEach((line, i) => g.drawString(line, l.x+(l.w>>1), y+g.getFontHeight()*i));
} else {
g.setFont(l.font,l.fsz).setFontAlign(0,0,l.r).drawString(l.label, l.x+(l.w>>1), l.y+(l.h>>1));
g.setFont(l.font).setFontAlign(0,0,l.r).drawString(l.label, l.x+(l.w>>1), l.y+(l.h>>1));
}
}, "btn":function(l){
var x = l.x+(0|l.pad), y = l.y+(0|l.pad),
@ -365,7 +358,7 @@ Layout.prototype.update = function() {
if (l.wrap) {
l._h = l._w = 0;
} else {
var m = g.setFont(l.font,l.fsz).stringMetrics(l.label);
var m = g.setFont(l.font).stringMetrics(l.label);
l._w = m.width; l._h = m.height;
}
}, "btn": function(l) {

View File

@ -119,6 +119,7 @@ Bangle.on("GPS", function(fix) {
Bangle.on("step", function(steps) {
if (!state.active) return;
if (stats["step"]) stats["step"].emit("changed",stats["step"]);
state.stepHistory[0] += steps-state.lastStepCount;
state.lastStepCount = steps;
});
Bangle.on("HRM", function(h) {