commit
528815d3c5
|
|
@ -21,4 +21,5 @@
|
||||||
0.15: Ensure that we hide widgets if in fullscreen mode
|
0.15: Ensure that we hide widgets if in fullscreen mode
|
||||||
(So that widgets are still hidden if launcher is fast-loaded)
|
(So that widgets are still hidden if launcher is fast-loaded)
|
||||||
0.16: Use firmware provided E.showScroller method
|
0.16: Use firmware provided E.showScroller method
|
||||||
0.17: fix fullscreen with oneClickExit
|
0.17: fix fullscreen with oneClickExit
|
||||||
|
0.18: Better performance
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
timeOut:"Off"
|
timeOut:"Off"
|
||||||
}, s.readJSON("iconlaunch.json", true) || {});
|
}, s.readJSON("iconlaunch.json", true) || {});
|
||||||
|
|
||||||
|
|
||||||
if (!settings.fullscreen) {
|
if (!settings.fullscreen) {
|
||||||
Bangle.loadWidgets();
|
Bangle.loadWidgets();
|
||||||
Bangle.drawWidgets();
|
Bangle.drawWidgets();
|
||||||
|
|
@ -19,9 +18,9 @@
|
||||||
let launchCache = s.readJSON("iconlaunch.cache.json", true)||{};
|
let launchCache = s.readJSON("iconlaunch.cache.json", true)||{};
|
||||||
let launchHash = s.hash(/\.info/);
|
let launchHash = s.hash(/\.info/);
|
||||||
if (launchCache.hash!=launchHash) {
|
if (launchCache.hash!=launchHash) {
|
||||||
launchCache = {
|
launchCache = {
|
||||||
hash : launchHash,
|
hash : launchHash,
|
||||||
apps : s.list(/\.info$/)
|
apps : s.list(/\.info$/)
|
||||||
.map(app=>{let a=s.readJSON(app,1);return a&&{name:a.name,type:a.type,icon:a.icon,sortorder:a.sortorder,src:a.src};})
|
.map(app=>{let a=s.readJSON(app,1);return a&&{name:a.name,type:a.type,icon:a.icon,sortorder:a.sortorder,src:a.src};})
|
||||||
.filter(app=>app && (app.type=="app" || (app.type=="clock" && settings.showClocks) || !app.type))
|
.filter(app=>app && (app.type=="app" || (app.type=="clock" && settings.showClocks) || !app.type))
|
||||||
.sort((a,b)=>{
|
.sort((a,b)=>{
|
||||||
|
|
@ -34,42 +33,66 @@
|
||||||
s.writeJSON("iconlaunch.cache.json", launchCache);
|
s.writeJSON("iconlaunch.cache.json", launchCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// cache items
|
||||||
|
const ICON_MISSING = s.read("iconlaunch.na.img");
|
||||||
|
let count = 0;
|
||||||
|
|
||||||
let selectedItem = -1;
|
let selectedItem = -1;
|
||||||
const R = Bangle.appRect;
|
const R = Bangle.appRect;
|
||||||
const iconSize = 48;
|
const iconSize = 48;
|
||||||
const appsN = Math.floor(R.w / iconSize);
|
const appsN = Math.floor(R.w / iconSize);
|
||||||
const whitespace = (R.w - appsN * iconSize) / (appsN + 1);
|
const whitespace = Math.floor((R.w - appsN * iconSize) / (appsN + 1));
|
||||||
|
const iconYoffset = Math.floor(whitespace/4)-1;
|
||||||
const itemSize = iconSize + whitespace;
|
const itemSize = iconSize + whitespace;
|
||||||
|
|
||||||
|
launchCache.items = {};
|
||||||
|
for (let c of launchCache.apps){
|
||||||
|
let i = Math.floor(count/appsN);
|
||||||
|
if (!launchCache.items[i])
|
||||||
|
launchCache.items[i] = {};
|
||||||
|
launchCache.items[i][(count%3)] = c;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
let texted;
|
||||||
let drawItem = function(itemI, r) {
|
let drawItem = function(itemI, r) {
|
||||||
g.clearRect(r.x, r.y, r.x + r.w - 1, r.y + r.h - 1);
|
"jit";
|
||||||
let x = 0;
|
let x = whitespace;
|
||||||
for (let i = itemI * appsN; i < appsN * (itemI + 1); i++) {
|
let i = itemI * appsN - 1;
|
||||||
if (!launchCache.apps[i]) break;
|
let selectedApp;
|
||||||
x += whitespace;
|
let c;
|
||||||
if (!launchCache.apps[i].icon) {
|
let selectedRect;
|
||||||
g.setFontAlign(0, 0, 0).setFont("12x20:2").drawString("?", x + r.x + iconSize / 2, r.y + iconSize / 2);
|
let item = launchCache.items[itemI];
|
||||||
} else {
|
if (texted == itemI){
|
||||||
if (!launchCache.apps[i].icondata) launchCache.apps[i].icondata = s.read(launchCache.apps[i].icon);
|
g.clearRect(r.x, r.y, r.x + r.w - 1, r.y + r.h - 1);
|
||||||
g.drawImage(launchCache.apps[i].icondata, x + r.x, r.y);
|
texted = undefined;
|
||||||
}
|
}
|
||||||
if (selectedItem == i) {
|
for (c of item) {
|
||||||
g.drawRect(
|
i++;
|
||||||
x + r.x - 1,
|
let id = c.icondata || (c.iconData = (c.icon ? s.read(c.icon) : ICON_MISSING));
|
||||||
r.y - 1,
|
g.drawImage(id,x + r.x - 1, r.y + iconYoffset - 1, x + r.x + iconSize, r.y + iconYoffset + iconSize);
|
||||||
x + r.x + iconSize + 1,
|
if (selectedItem == i) {
|
||||||
r.y + iconSize + 1
|
selectedApp = c;
|
||||||
);
|
selectedRect = [
|
||||||
}
|
x + r.x - 1,
|
||||||
x += iconSize;
|
r.y + iconYoffset - 1,
|
||||||
|
x + r.x + iconSize,
|
||||||
|
r.y + iconYoffset + iconSize
|
||||||
|
];
|
||||||
|
}
|
||||||
|
x += iconSize + whitespace;
|
||||||
|
}
|
||||||
|
if (selectedRect) {
|
||||||
|
g.drawRect.apply(null, selectedRect);
|
||||||
|
drawText(itemI, r.y, selectedApp);
|
||||||
|
texted=itemI;
|
||||||
}
|
}
|
||||||
drawText(itemI, r.y);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let drawText = function(i, appY) {
|
let drawText = function(i, appY, selectedApp) {
|
||||||
const selectedApp = launchCache.apps[selectedItem];
|
"jit";
|
||||||
const idy = (selectedItem - (selectedItem % 3)) / 3;
|
const idy = (selectedItem - (selectedItem % 3)) / 3;
|
||||||
if (!selectedApp || i != idy) return;
|
if (i != idy) return;
|
||||||
appY = appY + itemSize/2;
|
appY = appY + itemSize/2;
|
||||||
g.setFontAlign(0, 0, 0);
|
g.setFontAlign(0, 0, 0);
|
||||||
g.setFont("12x20");
|
g.setFont("12x20");
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"id": "iconlaunch",
|
"id": "iconlaunch",
|
||||||
"name": "Icon Launcher",
|
"name": "Icon Launcher",
|
||||||
"shortName" : "Icon launcher",
|
"shortName" : "Icon launcher",
|
||||||
"version": "0.17",
|
"version": "0.18",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"description": "A launcher inspired by smartphones, with an icon-only scrollable menu.",
|
"description": "A launcher inspired by smartphones, with an icon-only scrollable menu.",
|
||||||
"tags": "tool,system,launcher",
|
"tags": "tool,system,launcher",
|
||||||
|
|
@ -10,7 +10,8 @@
|
||||||
"supports": ["BANGLEJS2"],
|
"supports": ["BANGLEJS2"],
|
||||||
"storage": [
|
"storage": [
|
||||||
{ "name": "iconlaunch.app.js", "url": "app.js" },
|
{ "name": "iconlaunch.app.js", "url": "app.js" },
|
||||||
{ "name": "iconlaunch.settings.js", "url": "settings.js" }
|
{ "name": "iconlaunch.settings.js", "url": "settings.js" },
|
||||||
|
{ "name": "iconlaunch.na.img", "url": "na.img" }
|
||||||
],
|
],
|
||||||
"data": [{"name":"iconlaunch.json"},{"name":"iconlaunch.cache.json"}],
|
"data": [{"name":"iconlaunch.json"},{"name":"iconlaunch.cache.json"}],
|
||||||
"screenshots": [{ "url": "screenshot1.png" }, { "url": "screenshot2.png" }],
|
"screenshots": [{ "url": "screenshot1.png" }, { "url": "screenshot2.png" }],
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -16,8 +16,7 @@
|
||||||
}
|
}
|
||||||
const timeOutChoices = [/*LANG*/"Off", "10s", "15s", "20s", "30s"];
|
const timeOutChoices = [/*LANG*/"Off", "10s", "15s", "20s", "30s"];
|
||||||
const appMenu = {
|
const appMenu = {
|
||||||
"": { "title": /*LANG*/"Launcher" },
|
"": { "title": /*LANG*/"Launcher", back: back },
|
||||||
/*LANG*/"< Back": back,
|
|
||||||
/*LANG*/"Show Clocks": {
|
/*LANG*/"Show Clocks": {
|
||||||
value: settings.showClocks == true,
|
value: settings.showClocks == true,
|
||||||
onchange: (m) => {
|
onchange: (m) => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue