remove only specific listeners

master
thyttan 2022-12-06 12:20:52 +01:00
parent a3f77de725
commit 02cdc9fc93
3 changed files with 12 additions and 11 deletions

View File

@ -4,3 +4,5 @@
0.04: New layout. 0.04: New layout.
0.05: Add widgets field. Tweak layout. 0.05: Add widgets field. Tweak layout.
0.06: Make compatible with Fastload Utils app. 0.06: Make compatible with Fastload Utils app.
0.07: Remove just the specific listeners to not interfere with Quick Launch
when fastloading.

View File

@ -57,8 +57,8 @@ let touchHandler = function(_, xy) {
// doing a<b+1 seemed faster than a<=b, also using a>b-1 instead of a>b. // doing a<b+1 seemed faster than a<=b, also using a>b-1 instead of a>b.
if ((R.x-1<x && x<R.x+len) && (R.y-1<y && y<R.y+len)) { if ((R.x-1<x && x<R.x+len) && (R.y-1<y && y<R.y+len)) {
//Menu //Menu
Bangle.removeAllListeners("touch"); Bangle.removeListener("touch", touchHandler);
Bangle.removeAllListeners("swipe"); Bangle.removeListener("swipe", swipeHandler);
backToMenu = true; backToMenu = true;
E.showMenu(spotifyMenu); E.showMenu(spotifyMenu);
} else if ((R.x-1<x && x<R.x+len) && (R.y2-len<y && y<R.y2+1)) { } else if ((R.x-1<x && x<R.x+len) && (R.y2-len<y && y<R.y2+1)) {
@ -67,13 +67,13 @@ let touchHandler = function(_, xy) {
gadgetbridgeWake(); gadgetbridgeWake();
} else if ((R.x2-len<x && x<R.x2+1) && (R.y-1<y && y<R.y+len)) { } else if ((R.x2-len<x && x<R.x2+1) && (R.y-1<y && y<R.y+len)) {
//Srch //Srch
Bangle.removeAllListeners("touch"); Bangle.removeListener("touch", touchHandler);
Bangle.removeAllListeners("swipe"); Bangle.removeListener("swipe", swipeHandler);
E.showMenu(searchMenu); E.showMenu(searchMenu);
} else if ((R.x2-len<x && x<R.x2+1) && (R.y2-len<y && y<R.y2+1)) { } else if ((R.x2-len<x && x<R.x2+1) && (R.y2-len<y && y<R.y2+1)) {
//Saved //Saved
Bangle.removeAllListeners("touch"); Bangle.removeListener("touch", touchHandler);
Bangle.removeAllListeners("swipe"); Bangle.removeListener("swipe", swipeHandler);
E.showMenu(savedMenu); E.showMenu(savedMenu);
} else if ((R.x-1<x && x<R.x+len) && (R.y+R.h/2-len/2<y && y<R.y+R.h/2+len/2)) { } else if ((R.x-1<x && x<R.x+len) && (R.y+R.h/2-len/2<y && y<R.y+R.h/2+len/2)) {
//Previous //Previous
@ -89,7 +89,7 @@ let touchHandler = function(_, xy) {
} }
}; };
// Swipe handler for main layout, used to jump backward and forward within a podcast episode. // Swipe handler for main layout, used for next previous track.
let swipeHandler = function(LR, _) { let swipeHandler = function(LR, _) {
if (LR==-1) { if (LR==-1) {
spotifyWidget("NEXT"); spotifyWidget("NEXT");
@ -125,8 +125,8 @@ let backToGfx = function() {
E.showMenu(); E.showMenu();
g.clear(); g.clear();
g.reset(); g.reset();
Bangle.removeAllListeners("touch"); Bangle.removeListener("touch", touchHandler);
Bangle.removeAllListeners("swipe"); Bangle.removeListener("swipe", swipeHandler);
setUI(); setUI();
gfx(); gfx();
backToMenu = false; backToMenu = false;
@ -286,6 +286,5 @@ let savedMenu = {
Bangle.loadWidgets(); Bangle.loadWidgets();
setUI(); setUI();
widgetUtils.hide();
gfx(); gfx();
} }

View File

@ -1,7 +1,7 @@
{ {
"id": "spotrem", "id": "spotrem",
"name": "Remote for Spotify", "name": "Remote for Spotify",
"version": "0.06", "version": "0.07",
"description": "Control spotify on your android device.", "description": "Control spotify on your android device.",
"readme": "README.md", "readme": "README.md",
"type": "app", "type": "app",