Adjust position of notification src text and notifications without title

pull/563/head
Gordon Williams 2020-09-22 09:07:27 +01:00
parent ca50a4dbd9
commit a0b2aa30d2
5 changed files with 11 additions and 9 deletions

View File

@ -80,7 +80,7 @@
"name": "Notifications (default)",
"shortName":"Notifications",
"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",
"tags": "widget",
"type": "notify",
@ -93,7 +93,7 @@
"name": "Fullscreen Notifications",
"shortName":"Notifications",
"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.",
"tags": "widget",
"type": "notify",

View File

@ -1,3 +1,4 @@
0.01: New Library!
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

View File

@ -94,8 +94,8 @@ exports.show = function(options) {
g.setColor(-1).setFontAlign(-1, -1, 0).setFont("6x8", 2);
g.drawString(title.trim().substring(0, 13), x+25,y+3);
if (options.title && options.src) {
g.setFont("6x8", 1);
g.drawString(options.src.substring(0, 10), x+215,y+5);
g.setFont("6x8", 1).setFontAlign(1, 1, 0);
g.drawString(options.src.substring(0, 10), g.getWidth()-23,y+18);
}
y += 20;h -= 20;
}

View File

@ -3,3 +3,4 @@
0.03: Fix custom render callback
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.06: Adjust position of notification src text and notifications without title

View File

@ -49,14 +49,13 @@ exports.show = function(options) {
if (size>120) {size=120}
Bangle.setLCDMode("direct");
let x = 0,
y = 0,
y = 40,
w = 240,
h = 240;
h = size;
// clear screen
g.clear(1);
// top bar
if (options.title||options.src) {
y=40;h=size;
const title = options.title || options.src
g.setColor(0x39C7).fillRect(x, y, x+w-1, y+30);
g.setColor(-1).setFontAlign(-1, -1, 0).setFont("6x8", 3);
@ -64,7 +63,8 @@ exports.show = function(options) {
if (options.title && options.src) {
g.setColor(-1).setFontAlign(1, 1, 0).setFont("6x8", 2);
// 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;
}