1
0
Fork 0

messages 0.49: Change messages icon (to fit within 24px) and ensure widget renders icons centrally if they're not 24px

master
Gordon Williams 2022-07-25 15:53:59 +01:00
parent 34230b019f
commit 2d99d5f92c
4 changed files with 10 additions and 8 deletions

View File

@ -62,3 +62,4 @@
Fix message removal from widget bar (previously caused exception as .hide has been removed)
0.47: Add new Icons (Nextbike, Mattermost, etc.)
0.48: When getting new message from the clock, only buzz once the messages app is loaded
0.49: Change messages icon (to fit within 24px) and ensure widget renders icons centrally

View File

@ -104,7 +104,7 @@ exports.clearAll = function(event) {
exports.getMessageImage = function(msg) {
/*
* icons should be 24x24px with 1bpp colors and 'Transparency to Color'
* icons should be 24x24px or less with 1bpp colors and 'Transparency to Color'
* http://www.espruino.com/Image+Converter
*/
if (msg.img) return atob(msg.img);
@ -150,7 +150,7 @@ exports.getMessageImage = function(msg) {
if (s=="youtube" || s=="newpipe") return atob("GBgBAAAAAAAAAAAAAAAAAf8AH//4P//4P//8P//8P5/8P4/8f4P8f4P8P4/8P5/8P//8P//8P//4H//4Af8AAAAAAAAAAAAAAAAA");
if (msg.id=="music") return atob("FhaBAH//+/////////////h/+AH/4Af/gB/+H3/7/f/v9/+/3/7+f/vB/w8H+Dwf4PD/x/////////////3//+A=");
// if (s=="sms message" || s=="mail" || s=="gmail") // .. default icon (below)
return atob("HBKBAD///8H///iP//8cf//j4//8f5//j/x/8//j/H//H4//4PB//EYj/44HH/Hw+P4//8fH//44///xH///g////A==");
return atob("FhKBAH//+P//yf/+c//z5/+fz/z/n+f/Pz/+ef/8D///////////////////////f//4///A");
};
exports.getMessageImageCol = function(msg,def) {

View File

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

View File

@ -11,8 +11,7 @@ function filterMessages(msgs) {
.filter((msg, i, arr) => arr.findIndex(nmsg => msg.src == nmsg.src) == i);
}
WIDGETS["messages"]={area:"tl", width:0, iconwidth:24,
draw:function(recall) {
WIDGETS["messages"]={area:"tl", width:0, draw:function(recall) {
// If we had a setTimeout queued from the last time we were called, remove it
if (WIDGETS["messages"].i) {
clearTimeout(WIDGETS["messages"].i);
@ -36,7 +35,9 @@ draw:function(recall) {
}
}
g.setColor(colors[1]).setBgColor(colors[0]);
g.drawImage(i == (settings.maxMessages - 1) && this.msgs.length > settings.maxMessages ? atob("GBgBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH4H4H4H4H4H4H4H4H4H4H4H4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") : require("messages").getMessageImage(msg), this.x + i * this.iconwidth, this.y - 1);
// draw the icon, or '...' if too many messages
g.drawImage(i == (settings.maxMessages - 1) && this.msgs.length > settings.maxMessages ? atob("EASBAGGG88/zz2GG") : require("messages").getMessageImage(msg),
this.x + 12 + i * 24, this.y + 12, {rotate:0/*force centering*/});
}
}
if (c<settings.vibrateTimeout && // not going on too long...
@ -58,7 +59,7 @@ draw:function(recall) {
this.l=Date.now()-10000; // last buzz
if (quiet) this.t -= 500000; // if quiet, set last time in the past so there is no buzzing
}
this.width=this.iconwidth * E.clip(this.msgs.length, 0, settings.maxMessages);
this.width = 24 * E.clip(this.msgs.length, 0, settings.maxMessages);
Bangle.drawWidgets();
},buzz:function(msgSrc) {
if ((require('Storage').readJSON('setting.json',1)||{}).quiet) return; // never buzz during Quiet Mode
@ -73,7 +74,7 @@ draw:function(recall) {
require("buzz").pattern(pattern);
},touch:function(b,c) {
var w=WIDGETS["messages"];
if (!w||!w.width||c.x<w.x||c.x>w.x+w.width||c.y<w.y||c.y>w.y+w.iconwidth) return;
if (!w||!w.width||c.x<w.x||c.x>w.x+w.width||c.y<w.y||c.y>w.y+24) return;
load("messages.app.js");
}};