Use Bangle.load() and Bangle.showClock()

master
thyttan 2022-11-12 15:28:58 +01:00
parent aa7c38a08c
commit b2b4492459
3 changed files with 13 additions and 15 deletions

View File

@ -16,6 +16,8 @@
0.16: Use default Bangle formatter for booleans 0.16: Use default Bangle formatter for booleans
0.17: Bangle 2: Fast loading on exit to clock face. Added option for exit to 0.17: Bangle 2: Fast loading on exit to clock face. Added option for exit to
clock face by timeout. clock face by timeout.
0.18: Move interactions inside setUI. Replace "one click exit" with 0.18: Bangle 2: Move interactions inside setUI. Replace "one click exit" with
back-functionality through setUI, adding the red back button as well. Hardware back-functionality through setUI, adding the red back button as well. Hardware
button to exit is no longer an option. button to exit is no longer an option.
0.19: Bangle 2: Utilize new Bangle.load(), Bangle.showClock() functions to
facilitate 'fast switching' of apps where available.

View File

@ -85,14 +85,13 @@ let drawPage = function(p){
}; };
Bangle.loadWidgets(); Bangle.loadWidgets();
//g.clear();
//Bangle.drawWidgets();
drawPage(0); drawPage(0);
let swipeListenerDt = function(dirLeftRight, dirUpDown){ let swipeListenerDt = function(dirLeftRight, dirUpDown){
updateTimeoutToClock();
selected = 0; selected = 0;
oldselected=-1; oldselected=-1;
if(settings.swipeExit && dirLeftRight==1) returnToClock(); if(settings.swipeExit && dirLeftRight==1) Bangle.showClock();
if (dirUpDown==-1||dirLeftRight==-1){ if (dirUpDown==-1||dirLeftRight==-1){
++page; if (page>maxPage) page=0; ++page; if (page>maxPage) page=0;
drawPage(page); drawPage(page);
@ -110,6 +109,7 @@ let isTouched = function(p,n){
}; };
let touchListenerDt = function(_,p){ let touchListenerDt = function(_,p){
updateTimeoutToClock();
let i; let i;
for (i=0;i<4;i++){ for (i=0;i<4;i++){
if((page*4+i)<Napps){ if((page*4+i)<Napps){
@ -119,7 +119,7 @@ let touchListenerDt = function(_,p){
if (selected!=i && !settings.direct){ if (selected!=i && !settings.direct){
drawIcon(page,selected,false); drawIcon(page,selected,false);
} else { } else {
load(apps[page*4+i].src); Bangle.load(apps[page*4+i].src);
} }
} }
selected=i; selected=i;
@ -133,25 +133,21 @@ let touchListenerDt = function(_,p){
} }
}; };
const returnToClock = function() {
Bangle.setUI();
setTimeout(eval, 0, s.read(".bootcde"));
};
Bangle.setUI({ Bangle.setUI({
mode : 'custom', mode : 'custom',
back : returnToClock, back : Bangle.showClock,
swipe : swipeListenerDt, swipe : swipeListenerDt,
touch : touchListenerDt touch : touchListenerDt,
remove : ()=>{if (timeoutToClock) clearTimeout(timeoutToClock);}
}); });
// taken from Icon Launcher with minor alterations // taken from Icon Launcher with minor alterations
var timeoutToClock; let timeoutToClock;
const updateTimeoutToClock = function(){ const updateTimeoutToClock = function(){
if (settings.timeOut!="Off"){ if (settings.timeOut!="Off"){
let time=parseInt(settings.timeOut); //the "s" will be trimmed by the parseInt let time=parseInt(settings.timeOut); //the "s" will be trimmed by the parseInt
if (timeoutToClock) clearTimeout(timeoutToClock); if (timeoutToClock) clearTimeout(timeoutToClock);
timeoutToClock = setTimeout(returnToClock,time*1000); timeoutToClock = setTimeout(Bangle.showClock,time*1000);
} }
}; };
updateTimeoutToClock(); updateTimeoutToClock();

View File

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