tweak - always allow scrollable message by tapping on the message body, even if it fit in the main message view

pull/1411/head
Gordon Williams 2022-02-08 10:49:13 +00:00
parent af0dfed2c3
commit bc242a6cf2
3 changed files with 7 additions and 8 deletions

View File

@ -29,5 +29,4 @@
Back button now goes back to list of messages
If showMessage called with no message (eg all messages deleted) now return to the clock (fix #1267)
0.19: Use a larger font for message text if it'll fit
0.20: If message doesn't fit, allow tapping on the body to show a scrollable
view of the message and title in a bigger font (fix #1405, #1031)
0.20: Allow tapping on the body to show a scrollable view of the message and title in a bigger font (fix #1405, #1031)

View File

@ -28,7 +28,7 @@ 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
* If the message text doesn't fit in, you can tap on the message to view a scrollable version of the title and text
* 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`)
* If shown, the 'tick' button:
* **Android** opens the notification on the phone
* **iOS** responds positively to the notification (accept call/etc)

View File

@ -204,6 +204,7 @@ function showMessageScroller(msg) {
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
@ -300,15 +301,14 @@ function showMessage(msgid) {
}});
}
// If body of message is only two lines long w/ large font, use large font.
var body=msg.body, bodyFont = fontLarge, lines, bodyScroll = false;
var body=msg.body, bodyFont = fontLarge, lines;
if (body) {
var w = g.getWidth()-48;
if (g.setFont(bodyFont).stringWidth(body) > w * 2)
bodyFont = fontMedium;
if (g.setFont(bodyFont).stringWidth(body) > w) {
lines = g.setFont(bodyFont).wrapString(msg.body, g.getWidth()-10);
bodyScroll = lines.length>4;
body = bodyScroll ? lines.slice(0,4).join("\n")+"..." : lines.join("\n");
body = (lines.length>4) ? lines.slice(0,4).join("\n")+"..." : lines.join("\n");
}
}
@ -324,8 +324,8 @@ function showMessage(msgid) {
]},
]},
{type:"txt", font:bodyFont, label:body, fillx:1, filly:1, pad:2, cb:()=>{
// if the text was cropped, allow tapping to show a larger version
if (bodyScroll) showMessageScroller(msg);
// allow tapping to show a larger version
showMessageScroller(msg);
} },
{type:"h",fillx:1, c: buttons}
]});