Merge pull request #2261 from thyttan/dtlaunch

[Desktop Launcher] Use Bangle.load() and Bangle.showClock()
pull/2270/head
Gordon Williams 2022-11-14 09:06:10 +00:00 committed by GitHub
commit d37a865813
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 15 deletions

View File

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

View File

@ -1,7 +1,7 @@
{
"id": "dtlaunch",
"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.",
"screenshots": [{"url":"shot1.png"},{"url":"shot2.png"},{"url":"shot3.png"}],
"icon": "icon.png",