messages 0.87: Make choosing of font size more repeatable

master
Gordon Williams 2025-05-26 07:21:57 +01:00
parent 15ddeaae14
commit e05b80d319
3 changed files with 8 additions and 6 deletions

View File

@ -115,4 +115,5 @@
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)
0.86: Default to showing message scroller (with title, bigger icon)
0.87: Make choosing of font size more repeatable

View File

@ -355,6 +355,9 @@ function showMessage(msgid, persist) {
cancelReloadTimeout(); // don't auto-reload to clock now
return showMapMessage(msg);
}
// remove widgets here as we need to check the height when choosing a font
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();
active = "message";
// Normal text message display
let src=msg.src||/*LANG*/"Message", srcFont = fontSmall;
@ -380,7 +383,7 @@ function showMessage(msgid, persist) {
}
}
if (body) { // Try and find a font that fits...
let w = g.getWidth()-2, h = Bangle.appRect.h-60;
let w = g.getWidth()-2, h = Bangle.appRect.h-80;
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) {
@ -439,8 +442,6 @@ function showMessage(msgid, persist) {
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
@ -647,4 +648,4 @@ as a queue to stop repeated buzzing */
Bangle.on('lock',locked => {
if (!locked)
require("messages").stopBuzz();
});
});

View File

@ -2,7 +2,7 @@
"id": "messagegui",
"name": "Message UI",
"shortName": "Messages",
"version": "0.86",
"version": "0.87",
"description": "Default app to display notifications from iOS and Gadgetbridge/Android",
"icon": "app.png",
"type": "app",