mirror of https://github.com/espruino/BangleApps
Adjust position of notification src text and notifications without title
parent
ca50a4dbd9
commit
a0b2aa30d2
|
@ -80,7 +80,7 @@
|
||||||
"name": "Notifications (default)",
|
"name": "Notifications (default)",
|
||||||
"shortName":"Notifications",
|
"shortName":"Notifications",
|
||||||
"icon": "notify.png",
|
"icon": "notify.png",
|
||||||
"version":"0.03",
|
"version":"0.05",
|
||||||
"description": "A handler for displaying notifications that displays them in a bar at the top of the screen",
|
"description": "A handler for displaying notifications that displays them in a bar at the top of the screen",
|
||||||
"tags": "widget",
|
"tags": "widget",
|
||||||
"type": "notify",
|
"type": "notify",
|
||||||
|
@ -93,7 +93,7 @@
|
||||||
"name": "Fullscreen Notifications",
|
"name": "Fullscreen Notifications",
|
||||||
"shortName":"Notifications",
|
"shortName":"Notifications",
|
||||||
"icon": "notify.png",
|
"icon": "notify.png",
|
||||||
"version":"0.05",
|
"version":"0.06",
|
||||||
"description": "A handler for displaying notifications that displays them fullscreen. This may not fully restore the screen after on some apps. See `Notifications (default)` for more information about the notifications library.",
|
"description": "A handler for displaying notifications that displays them fullscreen. This may not fully restore the screen after on some apps. See `Notifications (default)` for more information about the notifications library.",
|
||||||
"tags": "widget",
|
"tags": "widget",
|
||||||
"type": "notify",
|
"type": "notify",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
0.01: New Library!
|
0.01: New Library!
|
||||||
0.02: Add notification ID option
|
0.02: Add notification ID option
|
||||||
0.03: Pass `area{x,y,w,h}` to render callback instead of just `y`
|
0.03: Pass `area{x,y,w,h}` to render callback instead of just `y`
|
||||||
|
0.04: Adjust position of notification src text
|
||||||
|
|
|
@ -94,8 +94,8 @@ exports.show = function(options) {
|
||||||
g.setColor(-1).setFontAlign(-1, -1, 0).setFont("6x8", 2);
|
g.setColor(-1).setFontAlign(-1, -1, 0).setFont("6x8", 2);
|
||||||
g.drawString(title.trim().substring(0, 13), x+25,y+3);
|
g.drawString(title.trim().substring(0, 13), x+25,y+3);
|
||||||
if (options.title && options.src) {
|
if (options.title && options.src) {
|
||||||
g.setFont("6x8", 1);
|
g.setFont("6x8", 1).setFontAlign(1, 1, 0);
|
||||||
g.drawString(options.src.substring(0, 10), x+215,y+5);
|
g.drawString(options.src.substring(0, 10), g.getWidth()-23,y+18);
|
||||||
}
|
}
|
||||||
y += 20;h -= 20;
|
y += 20;h -= 20;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,3 +3,4 @@
|
||||||
0.03: Fix custom render callback
|
0.03: Fix custom render callback
|
||||||
0.04: Pass `area{x,y,w,h}` to render callback instead of just `y`
|
0.04: Pass `area{x,y,w,h}` to render callback instead of just `y`
|
||||||
0.05: Fix `g` corruption issue if .hide gets called twice
|
0.05: Fix `g` corruption issue if .hide gets called twice
|
||||||
|
0.06: Adjust position of notification src text and notifications without title
|
||||||
|
|
|
@ -49,14 +49,13 @@ exports.show = function(options) {
|
||||||
if (size>120) {size=120}
|
if (size>120) {size=120}
|
||||||
Bangle.setLCDMode("direct");
|
Bangle.setLCDMode("direct");
|
||||||
let x = 0,
|
let x = 0,
|
||||||
y = 0,
|
y = 40,
|
||||||
w = 240,
|
w = 240,
|
||||||
h = 240;
|
h = size;
|
||||||
// clear screen
|
// clear screen
|
||||||
g.clear(1);
|
g.clear(1);
|
||||||
// top bar
|
// top bar
|
||||||
if (options.title||options.src) {
|
if (options.title||options.src) {
|
||||||
y=40;h=size;
|
|
||||||
const title = options.title || options.src
|
const title = options.title || options.src
|
||||||
g.setColor(0x39C7).fillRect(x, y, x+w-1, y+30);
|
g.setColor(0x39C7).fillRect(x, y, x+w-1, y+30);
|
||||||
g.setColor(-1).setFontAlign(-1, -1, 0).setFont("6x8", 3);
|
g.setColor(-1).setFontAlign(-1, -1, 0).setFont("6x8", 3);
|
||||||
|
@ -64,7 +63,8 @@ exports.show = function(options) {
|
||||||
if (options.title && options.src) {
|
if (options.title && options.src) {
|
||||||
g.setColor(-1).setFontAlign(1, 1, 0).setFont("6x8", 2);
|
g.setColor(-1).setFontAlign(1, 1, 0).setFont("6x8", 2);
|
||||||
// above drawing area, but we are fullscreen
|
// above drawing area, but we are fullscreen
|
||||||
g.drawString(options.src.substring(0, 10), x+235, y-32);
|
print(options.src.substring(0, 10), w-23, y-4);
|
||||||
|
g.drawString(options.src.substring(0, 10), w-16, y-4);
|
||||||
}
|
}
|
||||||
y += 30;h -= 30;
|
y += 30;h -= 30;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue