dtlaunch - Optimize line breaks for Bangle 2

master
Martin Boonk 2022-02-11 23:25:38 +01:00
parent 405de6d6c0
commit f85d49a09f
3 changed files with 18 additions and 5 deletions

View File

@ -5,3 +5,4 @@
0.05: add Bangle 2 version
0.06: Adds settings page (hide clocks or launchers)
0.07: Adds setting for directly launching app on touch for Bangle 2
0.08: Optimize line wrapping for Bangle 2

View File

@ -45,11 +45,23 @@ function draw_icon(p,n,selected) {
g.setColor(g.theme.fg);
try{g.drawImage(apps[p*4+n].icon,x+12,y+4);} catch(e){}
g.setFontAlign(0,-1,0).setFont("6x8",1);
var txt = apps[p*4+n].name.split(" ");
for (var i = 0; i < txt.length; i++) {
txt[i] = txt[i].trim();
g.drawString(txt[i],x+36,y+54+i*8);
var txt = apps[p*4+n].name.replace(/([a-z])([A-Z])/g, "$1 $2").split(" ");
var lineY = 0;
var line = "";
while (txt.length > 0){
var c = txt.shift();
if (c.length + 1 + line.length > 13){
if (line.length > 0){
g.drawString(line.trim(),x+36,y+54+lineY*8);
lineY++;
}
line = c;
} else {
line += " " + c;
}
}
g.drawString(line.trim(),x+36,y+54+lineY*8);
}
function drawPage(p){

View File

@ -1,7 +1,7 @@
{
"id": "dtlaunch",
"name": "Desktop Launcher",
"version": "0.07",
"version": "0.08",
"description": "Desktop style App Launcher with six (four for Bangle 2) apps per page - fast access if you have lots of apps installed.",
"screenshots": [{"url":"shot1.png"},{"url":"shot2.png"},{"url":"shot3.png"}],
"icon": "icon.png",