Qt: faster app icons on start
Three things still held icons up: - The app list was built on Qt's thread, so nothing on screen could paint (icons included) until every app was listed and labelled. HomeActivity now lists apps on its own thread and answers through Native.appList. - Each icon was drawn, PNG-encoded in Java and decoded again in C++. Icons now cross as raw premultiplied RGBA, and drawn ones are kept in the cache dir, keyed by the app's last update, so a fresh start just reads them. - The closed drawer made its icons at the same time as home. It now waits 1.5s, or until it opens. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hiQsCq11CwCPnKPp9D
This commit is contained in:
7 files changed
+115
-16
No files matched your search
+2
-1
@@ -10,6 +10,7 @@ Item {
|
||||
property var apps: [] // [{label, component, system}]
|
||||
property var homeSet: ({}) // component -> true: on the home screen
|
||||
property bool loading: true
|
||||
property bool warm: true // false: hold off making icons until it opens
|
||||
property var iconGen: ({}) // package -> n, see Main.gen
|
||||
property real insetTop: 0
|
||||
property real insetBottom: 0
|
||||
@@ -102,7 +103,7 @@ Item {
|
||||
clip: true
|
||||
bottomMargin: root.insetBottom + 24
|
||||
boundsBehavior: Flickable.DragOverBounds
|
||||
model: root.shown
|
||||
model: root.warm || root.visible ? root.shown : []
|
||||
// Swiping up once the list is at its end puts the drawer away.
|
||||
onDragEnded: if (verticalOvershoot > 48) root.closeRequested()
|
||||
delegate: Item {
|
||||
|
||||
+10
-3
@@ -114,7 +114,8 @@ Window {
|
||||
say("Brought over your home screen");
|
||||
}
|
||||
|
||||
function loadApps() { setApps(Host.apps()); loading = false; dropGone(); }
|
||||
function loadApps() { gotApps(Host.apps()) }
|
||||
function gotApps(list) { setApps(list); loading = false; dropGone(); }
|
||||
|
||||
function setApps(list) {
|
||||
const rows = {};
|
||||
@@ -127,7 +128,7 @@ Window {
|
||||
const g = Object.assign({}, iconGen);
|
||||
for (const p of (packages || "").split(",")) if (p) g[p] = (g[p] || 0) + 1;
|
||||
iconGen = g;
|
||||
loadApps();
|
||||
Host.requestApps();
|
||||
if (sheet === "app") { sheet = ""; appSheetRow = -1; }
|
||||
}
|
||||
|
||||
@@ -400,6 +401,7 @@ Window {
|
||||
Connections {
|
||||
target: Host
|
||||
function onAppsChanged(packages) { root.reload(packages) }
|
||||
function onAppsLoaded(list) { root.gotApps(list) }
|
||||
function onHomePressed() { root.goHome() }
|
||||
function onBackPressed() { root.back() }
|
||||
function onWidgetAdded(id) { root.widgetAdded(id) }
|
||||
@@ -418,11 +420,15 @@ Window {
|
||||
function onLegacyHome(json) { root.importLegacy(json) }
|
||||
}
|
||||
|
||||
// The drawer's icons load once home's have had a head start (or when it opens).
|
||||
Timer { id: drawerWarm; interval: 1500 }
|
||||
|
||||
Component.onCompleted: {
|
||||
loadHome();
|
||||
setApps(Host.savedApps()); // icons and names show at once; the real list follows
|
||||
Host.ready();
|
||||
Qt.callLater(loadApps);
|
||||
Host.requestApps();
|
||||
drawerWarm.start();
|
||||
}
|
||||
|
||||
// ---- view
|
||||
@@ -783,6 +789,7 @@ Window {
|
||||
homeSet: root.homeSet
|
||||
loading: root.loading
|
||||
iconGen: root.iconGen
|
||||
warm: !drawerWarm.running
|
||||
insetTop: root.insetTop
|
||||
insetBottom: root.insetBottom
|
||||
onEdgeChanged: root.cover()
|
||||
|
||||
Reference in new issue
Block a user