Skip to content

Commit 19cc36e

Browse files
author
thyttan
committed
Merge remote-tracking branch 'RKBoss6/master' into app-loader
2 parents 32bbe27 + b9f4526 commit 19cc36e

File tree

24 files changed

+231
-148
lines changed

24 files changed

+231
-148
lines changed

apps/bigclkinfo/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Interact with it like one big clock info, which it is!
1212

1313
## Settings
1414

15+
Change the background from `Settings -> Apps -> Backgrounds`
16+
1517
TBA: Should the app be treated as a clock face app?
1618
TBA: Should the app remember last open clock info menu position between launches?
1719

apps/bigclkinfo/app.js

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,24 @@ if (isClock) {
1010
// once at the start
1111
let background = require("clockbg");
1212
let clock_info = require("clock_info");
13+
const R = Bangle.appRect;
14+
let txtg = Graphics.createArrayBuffer(R.w>>1, 32, 2);
15+
txtg.transparent = 0;
16+
txtg.palette = new Uint16Array([0,g.theme.bg,g.theme.bg,g.theme.fg]);
1317

1418
// Load the clock infos
1519
let clockInfoItems = clock_info.load();
16-
if (clockInfoItems[0].items[6]) { // TODO: Should maybe be more robust against changes to clock info, i.e. search for "clock" among items.
17-
let clockItem = clockInfoItems[0].items.pop();
18-
clockInfoItems[0].items.unshift(clockItem);
20+
let clockInfoClockIdx = clockInfoItems[0].items.findIndex(c => c.name=="Clock");
21+
if (clockInfoClockIdx>=0) { // pull the clock to the front
22+
let clockInfoClock = clockInfoItems[0].items[clockInfoClockIdx];
23+
clockInfoItems[0].items.splice(clockInfoClockIdx,1); // remove
24+
clockInfoItems[0].items.unshift(clockInfoClock); // add to front
1925
}
2026
// Add the
2127
let clockInfoMenu = clock_info.addInteractive(clockInfoItems, {
2228
app: "bigclkinfo",
2329
// Add the dimensions we're rendering to here - these are used to detect taps on the clock info area
24-
x : 0, y: 0, w: Bangle.appRect.w, h: Bangle.appRect.h, // You can add other information here you want to be passed into 'options' in 'draw'
30+
x : 0, y: 0, w: R.w, h: R.h, // You can add other information here you want to be passed into 'options' in 'draw'
2531
// This function draws the info
2632
draw : (itm, info, options) => {
2733
// itm: the item containing name/hasRange/etc
@@ -36,17 +42,32 @@ let clockInfoMenu = clock_info.addInteractive(clockInfoItems, {
3642
var midx = options.x+options.w/2;
3743
let scale = 4;
3844
if (info.img) clock_info.drawBorderedImage(info.img, midx-12*scale,options.y+10, {scale:scale}); // draw the image
39-
let foundFontText = g.findFont(info.text, {
40-
w : options.w-9, // optional: width available (default = screen width)
41-
h : options.h*2/5, // optional: height available (default = screen height)
45+
let foundFontText = txtg.findFont(info.text, {
46+
w : txtg.getWidth()-4, // optional: width available (default = screen width)
47+
h : txtg.getHeight()-4, // optional: height available (default = screen height)
4248
min : 10, // optional: min font height
43-
max : 60, // optional: max font height
49+
max : 24, // optional: max font height
4450
wrap : true, // optional: allow word wrap?
4551
trim : true // optional: trim to the specified height, add '...'
4652
}); // TODO: g.findFont returns max size 28px. Would be nice with bigger font if there's room.
4753
//print(foundFontText);
48-
g.setFont(foundFontText.font).setFontAlign(0,1).drawString(foundFontText.text, midx,options.y+165); // draw the text
54+
txtg.clear(1);
55+
txtg.setFont(foundFontText.font).setFontAlign(0,1);
56+
txtg.drawString(foundFontText.text, txtg.getWidth()/2, txtg.getHeight()-2);
57+
txtg.filter([ // a gaussian filter
58+
0, 1, 1, 1, 0,
59+
1, 1, 1, 1, 1,
60+
1, 1, 1, 1, 1,
61+
1, 1, 1, 1, 1,
62+
0, 1, 1, 1, 0,
63+
], { w:5, h:5, div:1, max:1, filter:"max" });
64+
g.drawImage(txtg, 0, R.h - txtg.getHeight()*2-4, {scale:2});
4965
}
5066
});
5167

68+
Bangle.on("lock", function(locked) {
69+
// ensure that when unlocked, we automaticlly focus the clockinfo
70+
if (!locked && !clockInfoMenu.focus)
71+
Bangle.emit("touch",0,{x:100,y:100});
72+
});
5273
E.prependListener("kill", ()=>{clockInfoMenu.menuA = 0; clockInfoMenu.menuB = 0;}) // reset to initial menu state to prepare for next launch.

apps/bigclkinfo/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"author": "thyttan",
66
"description": "One single big clock info. Full screen.",
77
"icon": "icon.png",
8+
"screenshots" : [ { "url":"screenshot.png" }],
89
"type": "clock",
910
"tags": "clock,clkinfo,clk_info",
1011
"supports" : ["BANGLEJS2"],
@@ -14,7 +15,6 @@
1415
"clkinfoclk":"app",
1516
"clockbg":"module"
1617
},
17-
1818
"storage": [
1919
{"name":"bigclkinfo.app.js","url":"app.js"},
2020
{"name":"bigclkinfo.img","url":"app-icon.js","evaluate":true}

apps/bigclkinfo/screenshot.png

1.6 KB
Loading

apps/clock_info/ChangeLog

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@
2121
Tapping Altitude now updates the reading
2222
0.20: Altitude ClockInfo now uses the distance units set in locale.
2323
0.21: Add haptics when changing infos and a setting to toggle it on or off
24-
0.22: Tapping on step counter now disable step counting on 2v29+ firmwares
24+
0.22: Tapping on step counter now disable step counting on 2v29+ firmwares
25+
0.23: Use filter function for better image borders if it exists (2v22)

apps/clock_info/lib.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ clockInfoMenu is the 'options' parameter, with the following added:
234234
* `menuB` : int - index in 'menu[menuA].items' of showing clockInfo item
235235
* `remove` : function - remove this clockInfo item
236236
* `redraw` : function - force a redraw
237-
* `focus` : function - bool to show if menu is focused or not
237+
* `focus` : bool to show if menu is focused or not
238238
239239
You can have more than one clock_info at once as well, for instance:
240240
@@ -452,10 +452,19 @@ exports.drawBorderedImage = function(img,x,y,options) {
452452
if (!gfx) {
453453
gfx = exports.imgGfxB = Graphics.createArrayBuffer(28, 28, 2, {msb:true});
454454
gfx.transparent = 3;
455-
gfx.palette = new Uint16Array([g.theme.bg, g.theme.fg, g.theme.bg/*border*/, g.toColor("#888")]);
455+
gfx.palette = new Uint16Array([g.theme.bg, g.theme.bg/*border*/, g.theme.fg, g.toColor("#888")]);
456+
}
457+
if (gfx.filter) { // if firmware supports it (2v22+) use filter which can give a much better border
458+
gfx.clear(1).setColor(2).drawImage(img, 2,2); // main image
459+
gfx.filter([ // a gaussian filter
460+
1,1,1,
461+
1,1,1,
462+
1,1,1,
463+
], { w:3, h:3, div:1, max:1,filter:"max" });
464+
} else {
465+
gfx.clear(1).setColor(1).drawImage(img, 1,1).drawImage(img, 3,1).drawImage(img, 1,3).drawImage(img, 3,3); // border
466+
gfx.setColor(2).drawImage(img, 2,2); // main image
456467
}
457-
gfx.clear(1).setColor(2).drawImage(img, 1,1).drawImage(img, 3,1).drawImage(img, 1,3).drawImage(img, 3,3); // border
458-
gfx.setColor(1).drawImage(img, 2,2); // main image
459468
gfx.floodFill(27,27,3); // flood fill edge to transparent
460469
var o = ((options && options.scale) || 1)*2;
461470
return g.drawImage(gfx, x-o,y-o,options);
@@ -480,4 +489,4 @@ items.forEach((itm,i) => {
480489
itm.show();
481490
draw();
482491
});
483-
*/
492+
*/

apps/clock_info/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{ "id": "clock_info",
22
"name": "Clock Info Module",
33
"shortName": "Clock Info",
4-
"version":"0.22",
4+
"version":"0.23",
55
"description": "A library used by clocks to provide extra information on the clock face (Altitude, BPM, etc)",
66
"icon": "app.png",
77
"type": "module",

apps/kbtouch/ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
0.03: Convert Yes/No On/Off in settings to checkboxes
44
0.04: Catch and discard swipe events on fw2v19 and up (as well as some cutting
55
edge 2v18 ones), allowing compatability with the Back Swipe app.
6+
0.05: Ensure we can't drag the cursor to a column on the right that doesn't exist

apps/kbtouch/lib.js

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ var KEYIMGL = Graphics.createImage(`
3333
#
3434
#
3535
#
36-
#
37-
#
3836
`);KEYIMGL.transparent=0;
3937
var KEYIMGR = Graphics.createImage(`
4038
@@ -53,22 +51,14 @@ var KEYIMGR = Graphics.createImage(`
5351
#
5452
#
5553
#
54+
#
55+
#
56+
#
5657
#####
5758
###
5859
#
60+
`);KEYIMGR.transparent=0;
5961

60-
#`);KEYIMGR.transparent=0;
61-
/* If a char in the keymap is >=128,
62-
subtract 128 and look in this array for
63-
multi-character key codes*/
64-
var KEYEXTRA = [
65-
String.fromCharCode(27,91,68), // 0x80 left
66-
String.fromCharCode(27,91,67), // 0x81 right
67-
String.fromCharCode(27,91,65), // 0x82 up
68-
String.fromCharCode(27,91,66), // 0x83 down
69-
String.fromCharCode(27,91,53,126), // 0x84 page up
70-
String.fromCharCode(27,91,54,126), // 0x85 page down
71-
];
7262

7363
var settings = Object.assign({
7464
// default values
@@ -83,7 +73,7 @@ var settings = Object.assign({
8373
const R = Bangle.appRect;
8474
var kbx = 0, kby = 0, kbdx = 0, kbdy = 0, kbShift = false, flashToggle = false;
8575
const PX=12, PY=16, DRAGSCALE=settings.speedScaling;
86-
var xoff = 3, yoff = g.getHeight()-PY*(4+5*settings.offsetKeyboard);
76+
var xoff = 4, yoff = g.getHeight()-PY*(4+5*settings.offsetKeyboard);
8777

8878
function draw() {
8979
"ram";
@@ -120,7 +110,7 @@ function draw() {
120110
kby = Math.max(Math.min(Math.floor((e.y-120) / (8*2)) , 3) , 0);
121111
//print(e.y, kby, e.x, kbx);
122112
}
123-
113+
124114
if (!settings.oneToOne) {
125115
kbdx += e.dx;
126116
kbdy += e.dy;
@@ -129,7 +119,7 @@ function draw() {
129119
kbdy -= dy*DRAGSCALE;
130120
if (dx || dy) {
131121
if (settings.loopAround) {
132-
kbx = (kbx+dx+15)%15;
122+
kbx = (kbx+dx+14)%14;
133123
kby = (kby+dy+4)%4;
134124
} else {
135125
kbx = Math.max(Math.min((kbx+dx),13),0);
@@ -138,7 +128,7 @@ function draw() {
138128
}
139129
}
140130
draw();
141-
131+
142132
if (!e.b && e.y>Bangle.appRect.y && settings.oneToOne /*&& settings.releaseToSelect*/) {
143133
var map = kbShift ? KEYMAPUPPER : KEYMAPLOWER;
144134
var ch = map[kby][kbx];

apps/kbtouch/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{ "id": "kbtouch",
22
"name": "Touch keyboard",
3-
"version":"0.04",
3+
"version":"0.05",
44
"description": "A library for text input via onscreen keyboard",
55
"icon": "app.png",
66
"type":"textinput",

0 commit comments

Comments
 (0)