gbridge: 0.19: Support for call incoming/start/end
parent
28c7cfc3fa
commit
0e2f33d656
|
|
@ -80,7 +80,7 @@
|
|||
"name": "Notifications (default)",
|
||||
"shortName":"Notifications",
|
||||
"icon": "notify.png",
|
||||
"version":"0.05",
|
||||
"version":"0.06",
|
||||
"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.06",
|
||||
"version":"0.07",
|
||||
"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",
|
||||
|
|
@ -139,7 +139,7 @@
|
|||
{ "id": "gbridge",
|
||||
"name": "Gadgetbridge",
|
||||
"icon": "app.png",
|
||||
"version":"0.18",
|
||||
"version":"0.19",
|
||||
"description": "The default notification handler for Gadgetbridge notifications from Android",
|
||||
"tags": "tool,system,android,widget",
|
||||
"readme": "README.md",
|
||||
|
|
|
|||
|
|
@ -18,3 +18,4 @@
|
|||
Nicer display of alarm clock notifications
|
||||
0.17: Modified music notification for updated 'notify' library
|
||||
0.18: Added reporting of step count and HRM (new Gadgetbridges can now log this)
|
||||
0.19: Support for call incoming/start/end
|
||||
|
|
|
|||
|
|
@ -129,11 +129,23 @@
|
|||
}
|
||||
|
||||
function handleCallEvent(event) {
|
||||
if (event.cmd === "accept") {
|
||||
var callIcon = require("heatshrink").decompress(atob("jEYwIMJj4CCwACJh4CCCIMOAQMGAQMHAQMDAQMBCIMB4PwgHz/EAn4CBj4CBg4CBgACCAAw="));
|
||||
if (event.cmd === "incoming") {
|
||||
require("notify").show({
|
||||
size: 55, title: event.name, id: "call",
|
||||
body: event.number, icon:require("heatshrink").decompress(atob("jEYwIMJj4CCwACJh4CCCIMOAQMGAQMHAQMDAQMBCIMB4PwgHz/EAn4CBj4CBg4CBgACCAAw="))});
|
||||
body: event.number, icon:callIcon});
|
||||
Bangle.buzz();
|
||||
} else if (event.cmd === "start") {
|
||||
require("notify").show({
|
||||
size: 55, title: event.name, id: "call", bgColor : "#008000", titleBgColor : "#00C000",
|
||||
body: "In progress: "+event.number, icon:callIcon});
|
||||
} else if (event.cmd === "end") {
|
||||
require("notify").show({
|
||||
size: 55, title: event.name, id: "call", bgColor : "#800000", titleBgColor : "#C00000",
|
||||
body: "Ended: "+event.number, icon:callIcon});
|
||||
setTimeout(function() {
|
||||
require("notify").hide({ id: "call" });
|
||||
}, 2000);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,3 +2,4 @@
|
|||
0.02: Add notification ID option
|
||||
0.03: Pass `area{x,y,w,h}` to render callback instead of just `y`
|
||||
0.05: Adjust position of notification src text
|
||||
0.06: Support background color
|
||||
|
|
|
|||
|
|
@ -41,7 +41,9 @@ function fitWords(text,rows,width) {
|
|||
src : string // optional source name
|
||||
body : string // optional body text
|
||||
icon : string // optional icon (image string)
|
||||
render function(y) // function callback to render
|
||||
render : function(y) // function callback to render
|
||||
bgColor : int/string // optional background color (default black)
|
||||
titleBgColor : int/string // optional background color for title (default black)
|
||||
}
|
||||
*/
|
||||
/*
|
||||
|
|
@ -83,13 +85,13 @@ exports.show = function(options) {
|
|||
b = y+h-1, r = x+w-1; // bottom,right
|
||||
g.setClipRect(x,y, r,b);
|
||||
// clear area
|
||||
g.setColor(0).fillRect(x,y, r,b);
|
||||
g.setColor(options.bgColor||0).fillRect(x,y, r,b);
|
||||
// bottom border
|
||||
g.setColor(0x39C7).fillRect(0,b-1, r,b);
|
||||
b -= 2;h -= 2;
|
||||
// title bar
|
||||
if (options.title || options.src) {
|
||||
g.setColor(0x39C7).fillRect(x,y, r,y+20);
|
||||
g.setColor(options.titleBgColor||0x39C7).fillRect(x,y, r,y+20);
|
||||
const title = options.title||options.src;
|
||||
g.setColor(-1).setFontAlign(-1, -1, 0).setFont("6x8", 2);
|
||||
g.drawString(title.trim().substring(0, 13), x+25,y+3);
|
||||
|
|
|
|||
|
|
@ -4,3 +4,4 @@
|
|||
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
|
||||
0.07: Support background color
|
||||
|
|
|
|||
|
|
@ -37,7 +37,9 @@ function fitWords(text,rows,width) {
|
|||
src : string // optional source name
|
||||
body : string // optional body text
|
||||
icon : string // optional icon (image string)
|
||||
render function(y) // function callback to render
|
||||
render : function(y) // function callback to render
|
||||
bgColor : int/string // optional background color (default black)
|
||||
titleBgColor : int/string // optional background color for title (default black)
|
||||
}
|
||||
*/
|
||||
exports.show = function(options) {
|
||||
|
|
@ -53,11 +55,11 @@ exports.show = function(options) {
|
|||
w = 240,
|
||||
h = size;
|
||||
// clear screen
|
||||
g.clear(1);
|
||||
g.setColor(options.bgColor||0).fillRect(0,0,g.getWidth(),g.getHeight());
|
||||
// top bar
|
||||
if (options.title||options.src) {
|
||||
const title = options.title || options.src
|
||||
g.setColor(0x39C7).fillRect(x, y, x+w-1, y+30);
|
||||
g.setColor(options.titleBgColor||0x39C7).fillRect(x, y, x+w-1, y+30);
|
||||
g.setColor(-1).setFontAlign(-1, -1, 0).setFont("6x8", 3);
|
||||
g.drawString(title.trim().substring(0, 13), x+5, y+3);
|
||||
if (options.title && options.src) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue