launcher 0.23: Draw a placeholder screen right at the start to speed up apparent boot time

master
Gordon Williams 2025-03-27 14:59:41 +00:00
parent 73f376e5e3
commit 62a4d8f5d4
3 changed files with 21 additions and 10 deletions

View File

@ -21,4 +21,5 @@
0.19: Fix regression after back button added (returnToClock was called twice!)
0.20: Use Bangle.showClock for changing to clock
0.21: Make the "App source not found" warning less buggy
0.22: Add less padding between launcher items, use new font if available in 2v26+
0.22: Add less padding between launcher items, use new font if available in 2v26+
0.23: Draw a placeholder screen right at the start to speed up apparent boot time

View File

@ -1,10 +1,9 @@
{ // must be inside our own scope here so that when we are unloaded everything disappears
let s = require("Storage");
// handle customised launcher
let scaleval = 1;
let vectorval = 20;
let font = g.getFonts().includes("12x20") ? "12x20" : "6x8:2";
if (g.getFonts().includes("22")) font="22"; // 2v26+
let scaleval = 1, vectorval = 20, fonts = g.getFonts();
let font = fonts.includes("12x20") ? "12x20" : "6x8:2";
if (fonts.includes("22")) font="22"; // 2v26+
let settings = Object.assign({
showClocks: true,
fullscreen: false
@ -20,6 +19,19 @@
scaleval = (font.split("x")[1])/20;
}
}
let height = 50*scaleval;
// Now apps list is loaded - render
if (!settings.fullscreen)
Bangle.loadWidgets();
let R = Bangle.appRect;
g.reset().clearRect(R).setColor("#888");
for (var y=R.y;y<R.y2;y+=height) {
g.drawRect(5*scaleval,y+5*scaleval,49*scaleval,y+49*scaleval) // image
.drawRect(54*scaleval,y+20*scaleval,R.y2-16,y+34*scaleval); // text
}
g.flip();
// cache app list so launcher loads more quickly
let launchCache = s.readJSON("launch.cache.json", true)||{};
let launchHash = require("Storage").hash(/\.info/);
@ -39,13 +51,11 @@
s.writeJSON("launch.cache.json", launchCache);
}
let apps = launchCache.apps;
// Now apps list is loaded - render
if (!settings.fullscreen)
Bangle.loadWidgets();
const drawMenu = () => {
E.showScroller({
h : 50*scaleval, c : apps.length,
h : height, c : apps.length,
draw : (i, r) => {
var app = apps[i];
if (!app) return;

View File

@ -2,7 +2,7 @@
"id": "launch",
"name": "Launcher",
"shortName": "Launcher",
"version": "0.22",
"version": "0.23",
"description": "This is needed to display a menu allowing you to choose your own applications. You can replace this with a customised launcher.",
"readme": "README.md",
"icon": "app.png",