forked from FOSS/BangleApps
messages 0.49: Change messages icon (to fit within 24px) and ensure widget renders icons centrally if they're not 24px
parent
34230b019f
commit
2d99d5f92c
|
@ -62,3 +62,4 @@
|
||||||
Fix message removal from widget bar (previously caused exception as .hide has been removed)
|
Fix message removal from widget bar (previously caused exception as .hide has been removed)
|
||||||
0.47: Add new Icons (Nextbike, Mattermost, etc.)
|
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.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
|
||||||
|
|
|
@ -104,7 +104,7 @@ exports.clearAll = function(event) {
|
||||||
|
|
||||||
exports.getMessageImage = function(msg) {
|
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
|
* http://www.espruino.com/Image+Converter
|
||||||
*/
|
*/
|
||||||
if (msg.img) return atob(msg.img);
|
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 (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 (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)
|
// 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) {
|
exports.getMessageImageCol = function(msg,def) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "messages",
|
"id": "messages",
|
||||||
"name": "Messages",
|
"name": "Messages",
|
||||||
"version": "0.48",
|
"version": "0.49",
|
||||||
"description": "App to display notifications from iOS and Gadgetbridge/Android",
|
"description": "App to display notifications from iOS and Gadgetbridge/Android",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"type": "app",
|
"type": "app",
|
||||||
|
|
|
@ -11,8 +11,7 @@ function filterMessages(msgs) {
|
||||||
.filter((msg, i, arr) => arr.findIndex(nmsg => msg.src == nmsg.src) == i);
|
.filter((msg, i, arr) => arr.findIndex(nmsg => msg.src == nmsg.src) == i);
|
||||||
}
|
}
|
||||||
|
|
||||||
WIDGETS["messages"]={area:"tl", width:0, iconwidth:24,
|
WIDGETS["messages"]={area:"tl", width:0, draw:function(recall) {
|
||||||
draw:function(recall) {
|
|
||||||
// If we had a setTimeout queued from the last time we were called, remove it
|
// If we had a setTimeout queued from the last time we were called, remove it
|
||||||
if (WIDGETS["messages"].i) {
|
if (WIDGETS["messages"].i) {
|
||||||
clearTimeout(WIDGETS["messages"].i);
|
clearTimeout(WIDGETS["messages"].i);
|
||||||
|
@ -36,7 +35,9 @@ draw:function(recall) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g.setColor(colors[1]).setBgColor(colors[0]);
|
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...
|
if (c<settings.vibrateTimeout && // not going on too long...
|
||||||
|
@ -58,7 +59,7 @@ draw:function(recall) {
|
||||||
this.l=Date.now()-10000; // last buzz
|
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
|
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();
|
Bangle.drawWidgets();
|
||||||
},buzz:function(msgSrc) {
|
},buzz:function(msgSrc) {
|
||||||
if ((require('Storage').readJSON('setting.json',1)||{}).quiet) return; // never buzz during Quiet Mode
|
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);
|
require("buzz").pattern(pattern);
|
||||||
},touch:function(b,c) {
|
},touch:function(b,c) {
|
||||||
var w=WIDGETS["messages"];
|
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");
|
load("messages.app.js");
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue