From c9b4f24c7b541a4a900a96ddd081543f93394972 Mon Sep 17 00:00:00 2001 From: thyttan <6uuxstm66@mozmail.comā©> Date: Thu, 17 Aug 2023 03:09:08 +0200 Subject: [PATCH] spotrem: add timeout to wait for values from GB ... getting the current volume level from android. --- apps/spotrem/app.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/spotrem/app.js b/apps/spotrem/app.js index 00a33613f29..219e2a4eef1 100644 --- a/apps/spotrem/app.js +++ b/apps/spotrem/app.js @@ -103,6 +103,8 @@ let audioHandler = (e)=>{audioLevels = e; print(audioLevels);}; Bangle.on('audio', audioHandler); Bangle.musicControl("volumegetlevel"); +let tempMask = ()=>{E.stopEventPropagation&&E.stopEventPropagation(); setTimeout(()=>{Bangle.removeListener('drag',tempMask);}, 150);}; // FIXME: Temporary fix/hack before redoing input to not rely on setUI's "updown" mode. + // Navigation input on the main layout let setUI = function() { // Bangle.setUI code from rigrig's smessages app for volume control: https://git.tubul.net/rigrig/BangleApps/src/branch/personal/apps/smessages/app.js @@ -119,12 +121,14 @@ let setUI = function() { //if (ud) Bangle.musicControl(ud>0 ? "volumedown" : "volumeup"); if (ud) { + Bangle.prependListener('drag', tempMask); + let callback = (mode, fb)=>{ if (mode == "map") Bangle.musicControl({cmd:"volumesetlevel", extra:Math.round(100*fb/30)}); if (mode == "incr") Bangle.musicControl(fb>0 ? "volumedown" : "volumeup"); if (mode =="remove") {audioLevels.c = fb; print(audioLevels.c);} }; - require("SliderInput").interface(callback, {useMap:true, oversizeL:0.25, steps:audioLevels.u, currLevel:audioLevels.c}); + setTimeout(()=>{require("SliderInput").interface(callback, {useMap:true, steps:audioLevels.u, currLevel:audioLevels.c});},200); } } );