messages: Default to showing message scroller (with title, bigger icon)
parent
4326c5b60c
commit
fd9a150427
|
|
@ -115,3 +115,4 @@
|
|||
0.84: Fix: Assign show message entry to the settings menu and not the message itself.
|
||||
0.85: Use new Rebble fonts if available
|
||||
Remove workaround for 2v10 (>3 years ago) - assume everyone is on never firmware now
|
||||
0.86: Default to showing message scroller (with title, bigger icon)
|
||||
|
|
@ -10,21 +10,8 @@ It is a replacement for the old `notify`/`gadgetbridge` apps.
|
|||
## Settings
|
||||
|
||||
You can change settings by going to the global `Settings` app, then `App Settings`
|
||||
and `Messages`:
|
||||
|
||||
* `Vibrate` - This is the pattern of buzzes that should be made when a new message is received
|
||||
* `Vibrate for calls` - This is the pattern of buzzes that should be made when an incoming call is received
|
||||
* `Repeat` - How often should buzzes repeat - the default of 4 means the Bangle will buzz every 4 seconds
|
||||
* `Vibrate Timer` - When a new message is received when in a non-clock app, we display the message icon and
|
||||
buzz every `Repeat` seconds. This is how long we continue to do that.
|
||||
* `Unread Timer` - When a new message is received when showing the clock we go into the Messages app.
|
||||
If there is no user input for this amount of time then the app will exit and return
|
||||
to the clock where a ringing bell will be shown in the Widget bar.
|
||||
* `Min Font` - The minimum font size used when displaying messages on the screen. A bigger font
|
||||
is chosen if there isn't much message text, but this specifies the smallest the font should get before
|
||||
it starts getting clipped.
|
||||
* `Auto-Open Music` - Should the app automatically open when the phone starts playing music?
|
||||
* `Unlock Watch` - Should the app unlock the watch when a new message arrives, so you can touch the buttons at the bottom of the app?
|
||||
and `Messages`. See the [Messages App Readme](https://banglejs.com/apps/?id=messages&readme)
|
||||
for more information.
|
||||
|
||||
## New Messages
|
||||
|
||||
|
|
@ -36,9 +23,12 @@ When a new message is received:
|
|||
When a message is shown, you'll see a screen showing the message title and text.
|
||||
|
||||
* The 'back-arrow' button (or physical button on Bangle.js 2) goes back to Messages, marking the current message as read.
|
||||
* The top-left icon shows more options, for instance deleting the message of marking unread
|
||||
* On Bangle.js 2 you can tap on the message body to view a scrollable version of the title and text (or can use the top-left icon + `View Message`)
|
||||
- On Bangle.js 2 swipe up/down to show newer/older message
|
||||
* Tapping the title bar shows more options, for instance deleting the message of marking unread
|
||||
* On Bangle.js 2:
|
||||
* Dragging up/down will show more or the current message
|
||||
* Swipe up/down at the beginning/end of a message to show newer/older message
|
||||
* On Bangle.js 1:
|
||||
* Pressing top/bottom buttons will show more or the current message
|
||||
* If shown, the 'tick' button:
|
||||
* **Android** opens the notification on the phone
|
||||
* **iOS** responds positively to the notification (accept call/etc)
|
||||
|
|
|
|||
|
|
@ -13,9 +13,13 @@
|
|||
/* For example for maps:
|
||||
|
||||
// a message
|
||||
require("messages").pushMessage({"t":"add","id":1575479849,"src":"Skype","title":"My Friend","body":"Hey! How's everything going?",positive:1,negative:1})
|
||||
require("messages").pushMessage({"t":"add","id":1575479849,"src":"WhatsApp","title":"My Friend","body":"Hey! How's everything going?",reply:1,negative:1})
|
||||
require("messages").pushMessage({"t":"add","id":1575479849,"src":"Skype","title":"My Friend","body":"Hey! How's everything going? This is a really really long message that is really so super long you'll have to scroll it lots and lots",positive:1,negative:1})
|
||||
require("messages").pushMessage({"t":"add","id":23232,"src":"Skype","title":"Mr. Bobby McBobFace","body":"Boopedy-boop",positive:1,negative:1})
|
||||
require("messages").pushMessage({"t":"add","id":23233,"src":"Skype","title":"Thyttan test","body":"Nummerplåtsbelysning trodo",positive:1,negative:1})
|
||||
require("messages").pushMessage({"t":"add","id":23234,"src":"Skype","title":"Thyttan test 2","body":"Nummerplåtsbelysning trodo Nummerplåtsbelysning trodo Nummerplåtsbelysning trodo Nummerplåtsbelysning trodo Nummerplåtsbelysning trodo Nummerplåtsbelysning trodo",positive:1,negative:1})
|
||||
// maps
|
||||
GB({t:"nav",src:"maps",title:"Navigation",instr:"High St towards Tollgate Rd",distance:"966yd",action:"continue",eta:"08:39"})
|
||||
GB({t:"nav",src:"maps",title:"Navigation",instr:"High St towards Tollgate Rd",distance:"966m",action:"continue",eta:"08:39"})
|
||||
GB({t:"nav",src:"maps",title:"Navigation",instr:"High St",distance:"12km",action:"left_slight",eta:"08:39"})
|
||||
GB({t:"nav",src:"maps",title:"Navigation",instr:"Main St / I-29 ALT / Centerpoint Dr",distance:12345,action:"left_slight",eta:"08:39"})
|
||||
// call
|
||||
|
|
@ -87,6 +91,35 @@ function saveMessages() {
|
|||
}
|
||||
E.on("kill", saveMessages);
|
||||
|
||||
/* Listens to drag events to allow the user to swipe up/down to change message on Bangle.js 2
|
||||
returns dragHandler which should then be removed with Bangle.removeListener("drah", dragHandler); on exit */
|
||||
function addDragHandlerToChangeMessage(idx, scroller) {
|
||||
// save the scroll pos when finger pressed
|
||||
let lastTouched=false, lastScrollPos=0, scrollY=0;
|
||||
let dragHandler = (e) => {
|
||||
let scrollPos = scroller?scroller.scroll:0;
|
||||
if (e.b) {
|
||||
if (!lastTouched) lastScrollPos = scrollPos;
|
||||
scrollY += e.dy;
|
||||
}
|
||||
lastTouched = e.b;
|
||||
// swipe up down to prev/next but ONLY when finger released and if we're already at the top/bottom => scroller hasn't moved
|
||||
if (!e.b && scrollPos==lastScrollPos) {
|
||||
if (scrollY<-50 && idx<MESSAGES.length-1) {
|
||||
Bangle.buzz(30);
|
||||
showMessage(MESSAGES[idx+1].id, true);
|
||||
}
|
||||
if (scrollY>50 && idx>0) {
|
||||
Bangle.buzz(30);
|
||||
showMessage(MESSAGES[idx-1].id, true);
|
||||
}
|
||||
scrollY = 0;
|
||||
}
|
||||
};
|
||||
Bangle.on("drag", dragHandler);
|
||||
return dragHandler;
|
||||
}
|
||||
|
||||
function showMapMessage(msg) {
|
||||
active = "map";
|
||||
require("messages").stopBuzz(); // stop repeated buzzing while the map is showing
|
||||
|
|
@ -129,26 +162,28 @@ function showMapMessage(msg) {
|
|||
street?{type:"h", bgCol:g.theme.bg2, col: g.theme.fg2, fillx:1, c: [
|
||||
{type:"txt", font:fontSmall, label:"Towards" },
|
||||
{type:"txt", font:fontLarge, label:street }
|
||||
]}:{},
|
||||
]}:{type:""},
|
||||
{type:"h",fillx:1, filly:1, c: [
|
||||
img?{type:"img",src:atob(img), scale:2, pad:6}:{},
|
||||
img?{type:"img",src:atob(img), scale:2, pad:6}:{type:""},
|
||||
{type:"v", fillx:1, c: [
|
||||
{type:"txt", font:fontVLarge, label:distance||"" }
|
||||
]},
|
||||
]},
|
||||
{type:"txt", font:fontMedium, label:msg.eta?`ETA ${msg.eta}`:"" }
|
||||
]});
|
||||
g.reset().clearRect(Bangle.appRect);
|
||||
layout.render();
|
||||
function back() { // mark as not new and return to menu
|
||||
]}, { back : function() { // mark as not new and return to menu
|
||||
msg.new = false;
|
||||
layout = undefined;
|
||||
checkMessages({clockIfNoMsg:1,clockIfAllRead:1,ignoreUnread:settings.ignoreUnread,openMusic:0});
|
||||
}
|
||||
Bangle.setUI({mode:"updown", back: back}, back); // any input takes us back
|
||||
}, remove : function() {
|
||||
Bangle.removeListener("drag", dragHandler);
|
||||
}});
|
||||
g.reset().clearRect(Bangle.appRect);
|
||||
layout.render();
|
||||
// handle up/down to drag to new message
|
||||
let dragHandler = addDragHandlerToChangeMessage(MESSAGES.findIndex(m=>m==msg));
|
||||
}
|
||||
|
||||
let updateLabelsInterval;
|
||||
|
||||
|
||||
function showMusicMessage(msg) {
|
||||
active = "music";
|
||||
|
|
@ -163,6 +198,7 @@ function showMusicMessage(msg) {
|
|||
var trackName = '';
|
||||
var artistName = '';
|
||||
var albumName = '';
|
||||
var updateLabelsInterval;
|
||||
|
||||
function fmtTime(s) {
|
||||
var m = Math.floor(s/60);
|
||||
|
|
@ -174,8 +210,10 @@ function showMusicMessage(msg) {
|
|||
return text.substr(offset, sliceLength).padEnd(maxLen, " ");
|
||||
}
|
||||
function unload() {
|
||||
if (updateLabelsInterval)
|
||||
clearInterval(updateLabelsInterval);
|
||||
updateLabelsInterval = undefined;
|
||||
Bangle.removeListener("drag", dragHandler);
|
||||
}
|
||||
function back() {
|
||||
unload();
|
||||
|
|
@ -221,10 +259,14 @@ function showMusicMessage(msg) {
|
|||
{type:"btn", pad:8, label:atob("ABISgQDAAfgAf4Af8Af/Af/gf/wf/8f/+f/+f/8f/wf/gf/Af8Af4AfgAfAAcA=="), cb:()=>Bangle.musicControl("next")}, // next
|
||||
]}:{},
|
||||
{type:"txt", font:"6x8:2", label:msg.dur?fmtTime(msg.dur):"--:--" }
|
||||
]}, { back : back });
|
||||
]}, { back : back, remove : unload
|
||||
});
|
||||
g.reset().clearRect(Bangle.appRect);
|
||||
layout.render();
|
||||
|
||||
// handle up/down to drag to new message
|
||||
let dragHandler = addDragHandlerToChangeMessage(MESSAGES.findIndex(m=>m==msg));
|
||||
|
||||
updateLabelsInterval = setInterval(function() {
|
||||
updateLabels();
|
||||
layout.artist.label = artistName;
|
||||
|
|
@ -234,34 +276,6 @@ function showMusicMessage(msg) {
|
|||
}, 400);
|
||||
}
|
||||
|
||||
function showMessageScroller(msg) {
|
||||
cancelReloadTimeout();
|
||||
active = "scroller";
|
||||
var bodyFont = fontBig;
|
||||
g.setFont(bodyFont);
|
||||
var lines = [];
|
||||
if (msg.title) lines = g.wrapString(msg.title, g.getWidth()-10);
|
||||
var titleCnt = lines.length;
|
||||
if (titleCnt) lines.push(""); // add blank line after title
|
||||
lines = lines.concat(g.wrapString(msg.body, g.getWidth()-10),["",/*LANG*/"< Back"]);
|
||||
E.showScroller({
|
||||
h : g.getFontHeight(), // height of each menu item in pixels
|
||||
c : lines.length, // number of menu items
|
||||
// a function to draw a menu item
|
||||
draw : function(idx, r) {
|
||||
// FIXME: in 2v13 onwards, clearRect(r) will work fine. There's a bug in 2v12
|
||||
g.setBgColor(idx<titleCnt ? g.theme.bg2 : g.theme.bg).
|
||||
setColor(idx<titleCnt ? g.theme.fg2 : g.theme.fg).
|
||||
clearRect(r.x,r.y,r.x+r.w, r.y+r.h);
|
||||
g.setFont(bodyFont).setFontAlign(0,-1).drawString(lines[idx], r.x+r.w/2, r.y);
|
||||
}, select : function(idx) {
|
||||
if (idx>=lines.length-2)
|
||||
showMessage(msg.id, true);
|
||||
},
|
||||
back : () => showMessage(msg.id, true)
|
||||
});
|
||||
}
|
||||
|
||||
function showMessageSettings(msg) {
|
||||
active = "settings";
|
||||
var menu = {"":{
|
||||
|
|
@ -270,10 +284,12 @@ function showMessageSettings(msg) {
|
|||
},
|
||||
};
|
||||
|
||||
if (msg.id!="music")
|
||||
menu[/*LANG*/"View Message"] = () => showMessageScroller(msg);
|
||||
/* Bangle.js 1 can't press a button to go back from
|
||||
showMessage to the message list, so add the option here */
|
||||
if (process.env.BOARD=="BANGLEJS")
|
||||
menu[/*LANG*/"Message List"] = () => { returnToMain(); };
|
||||
|
||||
if (msg.reply && reply) {
|
||||
if (msg.reply && reply)
|
||||
menu[/*LANG*/"Reply"] = () => {
|
||||
replying = true;
|
||||
reply.reply({msg: msg})
|
||||
|
|
@ -287,14 +303,11 @@ function showMessageSettings(msg) {
|
|||
showMessage(msg.id);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
menu = Object.assign(menu, {
|
||||
/*LANG*/"Delete" : () => {
|
||||
menu[/*LANG*/"Delete"] = () => {
|
||||
MESSAGES = MESSAGES.filter(m=>m.id!=msg.id);
|
||||
returnToMain();
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
if (Bangle.messageIgnore && msg.src)
|
||||
menu[/*LANG*/"Ignore"] = () => {
|
||||
|
|
@ -332,11 +345,7 @@ function showMessage(msgid, persist) {
|
|||
if (replying) { return; }
|
||||
if(!persist) resetReloadTimeout();
|
||||
let idx = MESSAGES.findIndex(m=>m.id==msgid);
|
||||
var msg = MESSAGES[idx];
|
||||
if (updateLabelsInterval) {
|
||||
clearInterval(updateLabelsInterval);
|
||||
updateLabelsInterval=undefined;
|
||||
}
|
||||
let msg = MESSAGES[idx];
|
||||
if (!msg) return returnToClockIfEmpty(); // go home if no message found
|
||||
if (msg.id=="music") {
|
||||
cancelReloadTimeout(); // don't auto-reload to clock now
|
||||
|
|
@ -348,15 +357,18 @@ function showMessage(msgid, persist) {
|
|||
}
|
||||
active = "message";
|
||||
// Normal text message display
|
||||
var title=msg.title, titleFont = fontLarge, lines;
|
||||
var body=msg.body, bodyFont = fontLarge;
|
||||
let src=msg.src||/*LANG*/"Message", srcFont = fontSmall;
|
||||
let title=msg.title, titleFont = fontLarge, lines;
|
||||
let body=msg.body, bodyFont = fontLarge;
|
||||
// If no body, use the title text instead...
|
||||
if (body===undefined) {
|
||||
body = title;
|
||||
title = undefined;
|
||||
}
|
||||
if (g.setFont(srcFont).stringWidth(src) > g.getWidth()-52)
|
||||
srcFont = "4x6";
|
||||
if (title) {
|
||||
var w = g.getWidth()-48;
|
||||
let w = g.getWidth()-52;
|
||||
if (g.setFont(titleFont).stringWidth(title) > w) {
|
||||
titleFont = fontBig;
|
||||
if (settings.fontSize!=1 && g.setFont(titleFont).stringWidth(title) > w)
|
||||
|
|
@ -368,37 +380,27 @@ function showMessage(msgid, persist) {
|
|||
}
|
||||
}
|
||||
if (body) { // Try and find a font that fits...
|
||||
var w = g.getWidth()-2, h = Bangle.appRect.h-60;
|
||||
let w = g.getWidth()-2, h = Bangle.appRect.h-60;
|
||||
if (g.setFont(bodyFont).wrapString(body, w).length*g.getFontHeight() > h) {
|
||||
bodyFont = fontBig;
|
||||
if (settings.fontSize!=1 && g.setFont(bodyFont).wrapString(body, w).length*g.getFontHeight() > h) {
|
||||
bodyFont = fontMedium;
|
||||
}
|
||||
}
|
||||
// Now crop, given whatever font we have available
|
||||
lines = g.setFont(bodyFont).wrapString(body, w);
|
||||
var maxLines = Math.floor(h / g.getFontHeight());
|
||||
if (lines.length>maxLines) // if too long, wrap with a bit less spae so we have room for '...'
|
||||
body = g.setFont(bodyFont).wrapString(body, w-10).slice(0,maxLines).join("\n")+"...";
|
||||
else
|
||||
body = lines.join("\n");
|
||||
if (lines.length<3)
|
||||
lines.unshift(""); // if less lines, pad them out a bit at the top!
|
||||
}
|
||||
function goBack() {
|
||||
layout = undefined;
|
||||
msg.new = false; // read mail
|
||||
cancelReloadTimeout(); // don't auto-reload to clock now
|
||||
returnToClockIfEmpty();
|
||||
}
|
||||
var negHandler,posHandler,footer = [ ];
|
||||
let negHandler,posHandler,rowLeftDraw,rowRightDraw;
|
||||
if (msg.negative) {
|
||||
negHandler = ()=>{
|
||||
msg.new = false;
|
||||
cancelReloadTimeout(); // don't auto-reload to clock now
|
||||
Bangle.messageResponse(msg,false);
|
||||
returnToCheckMessages();
|
||||
}; footer.push({type:"img",src:atob("PhAB4A8AAAAAAAPAfAMAAAAAD4PwHAAAAAA/H4DwAAAAAH78B8AAAAAA/+A/AAAAAAH/Af//////w/gP//////8P4D///////H/Af//////z/4D8AAAAAB+/AfAAAAAA/H4DwAAAAAPg/AcAAAAADwHwDAAAAAA4A8AAAAAAAA=="),col:"#f00",cb:negHandler});
|
||||
};
|
||||
rowLeftDraw = function(r) {g.setColor("#f00").drawImage(atob("PhAB4A8AAAAAAAPAfAMAAAAAD4PwHAAAAAA/H4DwAAAAAH78B8AAAAAA/+A/AAAAAAH/Af//////w/gP//////8P4D///////H/Af//////z/4D8AAAAAB+/AfAAAAAA/H4DwAAAAAPg/AcAAAAADwHwDAAAAAA4A8AAAAAAAA=="),r.x+2,r.y+2);};
|
||||
}
|
||||
footer.push({fillx:1}); // push images to left/right
|
||||
if (msg.reply && reply) {
|
||||
posHandler = ()=>{
|
||||
replying = true;
|
||||
|
|
@ -408,56 +410,98 @@ function showMessage(msgid, persist) {
|
|||
.then(result => {
|
||||
Bluetooth.println(JSON.stringify(result));
|
||||
replying = false;
|
||||
layout.render();
|
||||
returnToCheckMessages();
|
||||
})
|
||||
.catch(() => {
|
||||
replying = false;
|
||||
layout.render();
|
||||
showMessage(msg.id);
|
||||
});
|
||||
}; footer.push({type:"img",src:atob("QRABAAAAAAAH//+AAAAABgP//8AAAAADgf//4AAAAAHg4ABwAAAAAPh8APgAAAAAfj+B////////geHv///////hf+f///////GPw///////8cGBwAAAAAPx/gDgAAAAAfD/gHAAAAAA8DngOAAAAABwDHP8AAAAADACGf4AAAAAAAAM/w=="),col:"#0f0", cb:posHandler});
|
||||
}
|
||||
else if (msg.positive) {
|
||||
};
|
||||
rowRightDraw = function(r) {g.setColor("#0f0").drawImage(atob("QRABAAAAAAAH//+AAAAABgP//8AAAAADgf//4AAAAAHg4ABwAAAAAPh8APgAAAAAfj+B////////geHv///////hf+f///////GPw///////8cGBwAAAAAPx/gDgAAAAAfD/gHAAAAAA8DngOAAAAABwDHP8AAAAADACGf4AAAAAAAAM/w=="),r.x+r.w-67,r.y+2);};
|
||||
} else if (msg.positive) {
|
||||
posHandler = ()=>{
|
||||
msg.new = false;
|
||||
cancelReloadTimeout(); // don't auto-reload to clock now
|
||||
Bangle.messageResponse(msg,true);
|
||||
returnToCheckMessages();
|
||||
}; footer.push({type:"img",src:atob("QRABAAAAAAAAAAOAAAAABgAAA8AAAAADgAAD4AAAAAHgAAPgAAAAAPgAA+AAAAAAfgAD4///////gAPh///////gA+D///////AD4H//////8cPgAAAAAAPw8+AAAAAAAfB/4AAAAAAA8B/gAAAAAABwB+AAAAAAADAB4AAAAAAAAABgAA=="),col:"#0f0",cb:posHandler});
|
||||
};
|
||||
rowRightDraw = function(r) {g.setColor("#0f0").drawImage(atob("QRABAAAAAAAAAAOAAAAABgAAA8AAAAADgAAD4AAAAAHgAAPgAAAAAPgAA+AAAAAAfgAD4///////gAPh///////gA+D///////AD4H//////8cPgAAAAAAPw8+AAAAAAAfB/4AAAAAAA8B/gAAAAAABwB+AAAAAAADAB4AAAAAAAAABgAA=="),r.x+r.w-64,r.y+2);};
|
||||
}
|
||||
|
||||
layout = new Layout({ type:"v", c: [
|
||||
{type:"h", fillx:1, bgCol:g.theme.bg2, col: g.theme.fg2, c: [
|
||||
{ type:"v", fillx:1, c: [
|
||||
{type:"txt", font:fontSmall, label:msg.src||/*LANG*/"Message", bgCol:g.theme.bg2, col: g.theme.fg2, fillx:1, pad:2, halign:1 },
|
||||
title?{type:"txt", font:titleFont, label:title, bgCol:g.theme.bg2, col: g.theme.fg2, fillx:1, pad:2 }:{},
|
||||
]},
|
||||
{ type:"btn",
|
||||
src:require("messageicons").getImage(msg),
|
||||
col:require("messageicons").getColor(msg, {settings, default:g.theme.fg2}),
|
||||
pad: 3, cb:()=>{
|
||||
let fontHeight = g.setFont(bodyFont).getFontHeight();
|
||||
let lineHeight = (fontHeight>25)?fontHeight:25;
|
||||
if (title.includes("\n")) lineHeight=25; // ensure enough room for 2 lines of title in header
|
||||
let linesPerRow = 2;
|
||||
if (fontHeight<17) {
|
||||
lineHeight = 16;
|
||||
linesPerRow = 3;
|
||||
}
|
||||
let rowHeight = lineHeight*linesPerRow;
|
||||
let textLineOffset = -(linesPerRow + ((rowLeftDraw||rowRightDraw)?1:0));
|
||||
let msgIcon = require("messageicons").getImage(msg);
|
||||
let msgCol = require("messageicons").getColor(msg, {settings, default:g.theme.fg2});
|
||||
Bangle.setUI(); // force last UI to be removed (will call require("widget_utils").show(); if last displaying a message)
|
||||
if (!settings.showWidgets) require("widget_utils").hide();
|
||||
let scroller = E.showScroller({
|
||||
h : rowHeight, // height of each menu item in pixels
|
||||
c : Math.ceil((lines.length-textLineOffset) / linesPerRow), // number of menu items
|
||||
// a function to draw a menu item
|
||||
draw : function(idx, r) { "ram";
|
||||
if (idx) { // message body
|
||||
let lidx = idx*linesPerRow+textLineOffset;
|
||||
g.setBgColor(g.theme.bg).setColor(g.theme.fg).clearRect(r.x,r.y,r.x+r.w, r.y+r.h);
|
||||
g.setFont(bodyFont).setFontAlign(0,-1).drawString(lines[lidx++]||"", r.x+r.w/2, r.y).drawString(lines[lidx++]||"", r.x+r.w/2, r.y+lineHeight);
|
||||
if (linesPerRow==3) g.drawString(lines[lidx++]||"", r.x+r.w/2, r.y+lineHeight*2);
|
||||
if (idx!=1) return;
|
||||
if (rowLeftDraw) rowLeftDraw(r);
|
||||
if (rowRightDraw) rowRightDraw(r);
|
||||
} else { // idx==0 => header
|
||||
g.setBgColor(g.theme.bg2).setColor(g.theme.fg).clearRect(r.x,r.y,r.x+r.w, r.y+r.h);
|
||||
if (!settings.showWidgets && Bangle.isLocked()) g.drawImage(atob("DhABH+D/wwMMDDAwwMf/v//4f+H/h/8//P/z///f/g=="), r.x+1,r.y+4); // locked symbol
|
||||
var mid = (r.w-48)/2;
|
||||
g.setColor(g.theme.fg2).setFont(srcFont).setFontAlign(0,-1).drawString(src, mid, r.y+2);
|
||||
let srcHeight = g.getFontHeight();
|
||||
g.setFont(titleFont).setFontAlign(0,0).drawString(title, mid, r.y+ (r.h+srcHeight+2)/2);
|
||||
//g.setColor(g.theme.bgH).fillRect({x:r.x+r.w-47, y:r.y+3, w:44, h:44, r:6});
|
||||
g.setColor(msgCol).drawImage(msgIcon, r.x+r.w-24, r.y + rowHeight/2, {rotate:0/*center*/});
|
||||
}
|
||||
}, select : function(idx) {
|
||||
if (idx==0) { // the title
|
||||
cancelReloadTimeout(); // don't auto-reload to clock now
|
||||
showMessageSettings(msg);
|
||||
}
|
||||
},
|
||||
]},
|
||||
{type:"txt", font:bodyFont, label:body, fillx:1, filly:1, pad:2, cb:()=>{
|
||||
// allow tapping to show a larger version
|
||||
showMessageScroller(msg);
|
||||
} },
|
||||
{type:"h",fillx:1, c: footer}
|
||||
]},{back:goBack});
|
||||
remove : function() {
|
||||
Bangle.removeListener("drag", dragHandler);
|
||||
Bangle.removeListener("swipe", swipeHandler);
|
||||
Bangle.removeListener("lock", lockHandler);
|
||||
if (!settings.showWidgets) require("widget_utils").show();
|
||||
},
|
||||
back : function() {
|
||||
msg.new = false; // read mail
|
||||
cancelReloadTimeout(); // don't auto-reload to clock now
|
||||
returnToClockIfEmpty();
|
||||
}
|
||||
});
|
||||
|
||||
Bangle.swipeHandler = (lr,ud) => {
|
||||
if (lr>0 && posHandler) posHandler();
|
||||
if (lr<0 && negHandler) negHandler();
|
||||
if (ud>0 && idx<MESSAGES.length-1) showMessage(MESSAGES[idx+1].id, true);
|
||||
if (ud<0 && idx>0) showMessage(MESSAGES[idx-1].id, true);
|
||||
let dragHandler = addDragHandlerToChangeMessage(idx, scroller);
|
||||
// handle swipes
|
||||
let swipeHandler = (lr,ud) => {
|
||||
// left/right accept/reject
|
||||
if (lr>0 && posHandler) {
|
||||
Bangle.buzz(30);
|
||||
posHandler();
|
||||
}
|
||||
if (lr<0 && negHandler) {
|
||||
Bangle.buzz(30);
|
||||
negHandler();
|
||||
}
|
||||
/* handle up/down in drag handler because we want to
|
||||
move message only when the finger is released, or subsequent
|
||||
finger movement will end up dragging the new message */
|
||||
};
|
||||
Bangle.on("swipe", Bangle.swipeHandler);
|
||||
g.reset().clearRect(Bangle.appRect);
|
||||
layout.render();
|
||||
Bangle.on("swipe", swipeHandler);
|
||||
let lockHandler = () => scroller.draw();
|
||||
Bangle.on("lock",lockHandler); // redraw when we lock/unlock
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"id": "messagegui",
|
||||
"name": "Message UI",
|
||||
"shortName": "Messages",
|
||||
"version": "0.85",
|
||||
"version": "0.86",
|
||||
"description": "Default app to display notifications from iOS and Gadgetbridge/Android",
|
||||
"icon": "app.png",
|
||||
"type": "app",
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.7 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 3.4 KiB |
|
|
@ -11,3 +11,4 @@
|
|||
0.65: Fix settings error introduced by two conflicting changes
|
||||
0.66: Fix 'Auto-Open Unread Msg' polarity - previously checking the box would ignore unread messages
|
||||
0.67: Ensure default vibration pattern is longer
|
||||
Add Option to show widgets (Message GUI 0.86 removes them by default)
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ There are several options to choose from:
|
|||
* **Quiet mode disables auto-open** : When in quiet mode, should we not open the messages app for new messages?
|
||||
* **Disable auto-open** : Should we not open the messages app for new messages?
|
||||
* **Widget messages** : How many message icons should the widget show?
|
||||
* **Show Widgets** : Should widgets be shown when a message is being displayed (default of disabled leaves more room for the message text)
|
||||
* **Icon color mode** : Should icons in widgets be coloured?
|
||||
* **Car driver pos** : What side of the car is the driver on? This affects navigation icons for roundabouts
|
||||
|
||||
|
|
|
|||
|
|
@ -89,6 +89,10 @@
|
|||
format: v => v ? v :/*LANG*/"Hide",
|
||||
onchange: v => updateSetting("maxMessages", v)
|
||||
},
|
||||
/*LANG*/'Show Widgets': {
|
||||
value: !!settings.showWidgets,
|
||||
onchange: v => updateSetting("showWidgets", v)
|
||||
},
|
||||
/*LANG*/'Icon color mode': {
|
||||
value: Math.max(0,iconColorModes.indexOf(settings.iconColorMode)),
|
||||
min: 0, max: iconColorModes.length - 1,
|
||||
|
|
|
|||
Loading…
Reference in New Issue