forked from FOSS/BangleApps
commit
0782599dc3
13
apps.json
13
apps.json
|
@ -2479,6 +2479,19 @@
|
||||||
{"name":"gmeter.img","url":"app-icon.js","evaluate":true}
|
{"name":"gmeter.img","url":"app-icon.js","evaluate":true}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{ "id": "dtlaunch",
|
||||||
|
"name": "Desktop Launcher",
|
||||||
|
"icon": "icon.png",
|
||||||
|
"version":"0.02",
|
||||||
|
"description": "Desktop style App Launcher with six apps per page - fast access if you have lots of apps installed.",
|
||||||
|
"readme": "README.md",
|
||||||
|
"tags": "tool,system,launcher",
|
||||||
|
"type":"launch",
|
||||||
|
"storage": [
|
||||||
|
{"name":"dtlaunch.app.js","url":"app.js"},
|
||||||
|
{"name":"dtlaunch.img","url":"app-icon.js","evaluate":true}
|
||||||
|
]
|
||||||
|
},
|
||||||
{ "id": "HRV",
|
{ "id": "HRV",
|
||||||
"name": "HRV monitor app",
|
"name": "HRV monitor app",
|
||||||
"shortName":"HRV monitor",
|
"shortName":"HRV monitor",
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
0.01: Initial version
|
||||||
|
0.02: Multiple pages
|
|
@ -0,0 +1,16 @@
|
||||||
|
# Desktop style App Launcher
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
In the picture above, the Settings app is selected.
|
||||||
|
## Controls
|
||||||
|
|
||||||
|
**BTN1** - move backward through app icons on a page
|
||||||
|
|
||||||
|
**BTN2** - run the selected app
|
||||||
|
|
||||||
|
**BTN3** - move forward through app icons
|
||||||
|
|
||||||
|
**Swipe Left** - move to next page of app icons
|
||||||
|
|
||||||
|
**Swipe Right** - move to previous page of app icons
|
|
@ -0,0 +1 @@
|
||||||
|
require("heatshrink").decompress(atob("mEwwhC/AH4ATxAAQC+2N7vd7AX/C/6/7a/4X/a/4X/C/4X/C/4Xfl3iC6vu9wXtI653WAH4A/ABg"))
|
|
@ -0,0 +1,73 @@
|
||||||
|
/* Desktop launcher
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
var s = require("Storage");
|
||||||
|
var apps = s.list(/\.info$/).map(app=>{var 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" || !app.type));
|
||||||
|
apps.sort((a,b)=>{
|
||||||
|
var n=(0|a.sortorder)-(0|b.sortorder);
|
||||||
|
if (n) return n; // do sortorder first
|
||||||
|
if (a.name<b.name) return -1;
|
||||||
|
if (a.name>b.name) return 1;
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
var Napps = apps.length;
|
||||||
|
var Npages = Math.ceil(Napps/6);
|
||||||
|
var maxPage = Npages-1;
|
||||||
|
var selected = -1;
|
||||||
|
var oldselected = -1;
|
||||||
|
var page = 0;
|
||||||
|
|
||||||
|
function draw_icon(p,n,selected) {
|
||||||
|
var x = (n%3)*80;
|
||||||
|
var y = n>2?130:40;
|
||||||
|
(selected?g.setColor(0.3,0.3,0.3):g.setColor(0,0,0)).fillRect(x,y,x+79,y+89);
|
||||||
|
g.drawImage(s.read(apps[p*6+n].icon),x+10,y+10,{scale:1.25});
|
||||||
|
g.setColor(-1).setFontAlign(0,-1,0).setFont("6x8",1);
|
||||||
|
var txt = apps[p*6+n].name.split(" ");
|
||||||
|
for (var i = 0; i < txt.length; i++) {
|
||||||
|
txt[i] = txt[i].trim();
|
||||||
|
g.drawString(txt[i],x+40,y+70+i*8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function drawPage(p){
|
||||||
|
g.setColor(0,0,0).fillRect(0,0,239,239);
|
||||||
|
g.setFont("6x8",2).setFontAlign(0,-1,0).setColor(1,1,1).drawString("Bangle ("+(p+1)+"/"+Npages+")",120,12);
|
||||||
|
for (var i=0;i<6;i++) {
|
||||||
|
if (!apps[p*6+i]) return i;
|
||||||
|
draw_icon(p,i,selected==i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Bangle.on("swipe",(dir)=>{
|
||||||
|
selected = 0;
|
||||||
|
oldselected=-1;
|
||||||
|
if (dir<0){
|
||||||
|
++page; if (page>maxPage) page=maxPage;
|
||||||
|
drawPage(page);
|
||||||
|
} else {
|
||||||
|
--page; if (page<0) page=0;
|
||||||
|
drawPage(page);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function nextapp(d){
|
||||||
|
oldselected = selected;
|
||||||
|
selected+=d;
|
||||||
|
selected = selected<0?5:selected>5?0:selected;
|
||||||
|
selected = (page*6+selected)>=Napps?0:selected;
|
||||||
|
draw_icon(page,selected,true);
|
||||||
|
if (oldselected>=0) draw_icon(page,oldselected,false);
|
||||||
|
}
|
||||||
|
|
||||||
|
function doselect(){
|
||||||
|
load(apps[page*6+selected].src);
|
||||||
|
}
|
||||||
|
|
||||||
|
setWatch(nextapp.bind(null,-1), BTN1, {repeat:true,edge:"falling"});
|
||||||
|
setWatch(doselect, BTN2, {repeat:true,edge:"falling"});
|
||||||
|
setWatch(nextapp.bind(null,1), BTN3, {repeat:true,edge:"falling"});
|
||||||
|
|
||||||
|
drawPage(0);
|
Binary file not shown.
After Width: | Height: | Size: 305 B |
Binary file not shown.
After Width: | Height: | Size: 49 KiB |
Loading…
Reference in New Issue