From 5fcb5198888f4a2b0a6ce01f2cc1bf3f3d55d610 Mon Sep 17 00:00:00 2001 From: thyttan <6uuxstm66@mozmail.com⁩> Date: Wed, 19 Mar 2025 23:18:54 +0100 Subject: [PATCH 1/9] voldisp: new app that displays volume change on Android device --- apps/voldisp/ChangeLog | 1 + apps/voldisp/app.png | Bin 0 -> 1245 bytes apps/voldisp/boot.js | 36 ++++++++++++++++++++++++++++++++++++ apps/voldisp/metadata.json | 15 +++++++++++++++ apps/voldisp/screenshot.png | Bin 0 -> 2693 bytes 5 files changed, 52 insertions(+) create mode 100644 apps/voldisp/ChangeLog create mode 100644 apps/voldisp/app.png create mode 100644 apps/voldisp/boot.js create mode 100644 apps/voldisp/metadata.json create mode 100644 apps/voldisp/screenshot.png diff --git a/apps/voldisp/ChangeLog b/apps/voldisp/ChangeLog new file mode 100644 index 0000000000..5560f00bce --- /dev/null +++ b/apps/voldisp/ChangeLog @@ -0,0 +1 @@ +0.01: New App! diff --git a/apps/voldisp/app.png b/apps/voldisp/app.png new file mode 100644 index 0000000000000000000000000000000000000000..c36e104410d236302b1c4bb30c2a25af7302c5a2 GIT binary patch literal 1245 zcmV<31S0#1P)ejM^}Y_NF;rc0D4IR zWh@~5R_8iBHPEk5zS&=tfCf8ty#yMu09Dz@uYu&P0_cEe>rHNEUw^kpJRHRc5RkY| zDmuZAFCAQ6a`F_e9Plw;*zg5i5?CR?}E%7rE z&=70Af{AB$Ar`+~08X<5H%8;vW<>yP_k|@MDs)C5{cO*RdT4l5?;ZUrZ%iINrhl0{ z>izS+RNJD-FIIq1_>BPit@s z%g{+}J9U{<^t%L{aUACo&r;&?WxOjqpJzrw;U->Sc;vv62rx~vP6F-@?$yrANU@lcr0vMdAyeigSdo^Fn=4X}%&yUOvI2`UPPXPGID&o*pd|j__Mew%w zRlESxH0wB&=9*B%p_PFTd>B3#0cx&D6S4v)779OJj1x;I@nl7YQIT`#=X%I9DM&n$ zV?v(>X11~*kqs_UB9lN}LDn4&6PaJ};vbyI>Jcyg&qNkc*uV>{ + if (timeout) {clearTimeout(timeout); timeout=undefined;} + + if (Bangle.CLOCK) { + let barWidth = g.getWidth()*volPercent/100; + g. + setColor(0x0000).fillRect(0,0,g.getWidth(),24). + setColor(0xF800).fillRect(0,0,barWidth,19). + setColor(0xFFFF).setFont("12x20").setFontAlign(1,-1). + drawString("volume",barWidth,1); + + let goAway = ()=>{ + let isAllWidgetsHidden = true; + for (var w of global.WIDGETS) { + if (!w._draw) { + isAllWidgetsHidden = false; + break; + } + } + + if (global.WIDGETS && !isAllWidgetsHidden) { + Bangle.drawWidgets(); + } else if (Bangle.uiRedraw) { + Bangle.uiRedraw(); + } else { + Bangle.load(); + } + }; + timeout = setTimeout(goAway, 3*1000); + } + }; + Bangle.on("musicVolume", onMusicVolume); + //GB({t:"audio",v:10}); +} diff --git a/apps/voldisp/metadata.json b/apps/voldisp/metadata.json new file mode 100644 index 0000000000..6629cb8c11 --- /dev/null +++ b/apps/voldisp/metadata.json @@ -0,0 +1,15 @@ +{ "id": "voldisp", + "name": "Display Volume for Android", + "version":"0.01", + "description": "Display the media volume of your android device when it's changed. A bar shows up at the top of your Bangles screen. (Needs recent Gadgetbridge nightly or stable ver. 85 once out)", + "icon": "app.png", + "tags": "audio,media,android,volume,sound", + "type": "bootloader", + "supports" : ["BANGLEJS2"], + "screenshots" : [ + { "url":"screenshot.png" } + ], + "storage": [ + {"name":"voldisp.boot.js","url":"boot.js"} + ] +} diff --git a/apps/voldisp/screenshot.png b/apps/voldisp/screenshot.png new file mode 100644 index 0000000000000000000000000000000000000000..898aaa6a692f8fa0b4cc0f4e7e1b4d161889c753 GIT binary patch literal 2693 zcmai$do+|=AIG2PF%!md>EzNo4nr4Yvgm~5M1zD*xy6XWRAR!Iyqw&5DCtU4={6>p zE|_85B9}Z#DV0n$<1!6XouU~sCo{tg#yjVI|2%)Zd#$~H>$iX3@7`TQ&DWOe{fgLTQ6@vmqt?;dvka)Htx&|C~KhMIv)0Tu`AiNJ$948A|LJ+2IepY~5%cJ{)DcZ`OAv2P#!6~DFr+*YxJ`gV%>uSoydT!MTZtd6^(A=uc~ z_^G*-5vF(TO4BFPHg*6IlY7O$3n;K+x*R*rFuAw6c8V`MB!MRrjUY-=vawA`m1lz< z65~CpUvFylYWSA!elj&X@#V?~dgoT}-G@V?SVe_D8ofcV(>pa^8epa^s85#C zoakjQUP9mlb(hWyj^f64;sf{0#(Pb-Gx7!5(@YXf!w z2<|>B$1eJ={zm*-1@%3114?={Nr5c0B=DDYj1OO}ZyPv;P(71~gjV(~^p%bSXwfz)n(6aKh<9~WV*M$LI}6g!({nShrr;}0ZQZ{5MDOQ}QSmG+pmbO$)9XGo<3_GU29q)w3)Sf zXfxOjX_4@kJ}iC#lD_qaVcz=_x?k5dc5Ty`v5) zjvW-YH(D4B;?l0``@V~{GK1qJZlSxa&0x#?cg>mT0o{9r>XwjGx9(Y|Y8WU}iG(U9 z+Y+dkM_{P^f}`1`-9nXGB-?piTjf^YamgoK#VCKwstH7+#IX0T)wM8C$1^_ScpEWB zxHHk(y`2tjk?5K-dW%vh4Swkdl=PNsoll;Nj?lj7_&8RsNxG!Ejb+PdpRGq{i8@!W5#@{ldVSR98crP5|-bbxC*UjR+&ZG=y>T1{fS zK66(v|F_dy6;_U`HAyD*W#d9ch4kQ(7HPufqycMEzR`>`^F)gTb`F`gDKKKmB10O7 zcC;oNT+}Z5)Sw*PK$DhIiX;SSxtuLUO4BM<5g;>gWYK>cm!6UxpIPhjR*h5eb^ol# zEZQzm<9y``V}6037f_)XT%3eZtbl{>NtFxYZyJOk+znhffNBfNBf52p+_dYi+TPTy zd9&XyE?ZI=V=j6;*;JJ9++}nRkOM^k$@UH6b$ef zPSmGM`$n}$#D-_ecPRU-3o7|cI+G4d%o7|)98|L-l9Ao)%2u*1FQ#dk!-uu+=CN079>!y+RD8oudP(mf4EYejLI6_GA_d_94G2>sq%XG8ymCdE6vU8xTBLc+UpNPhamPnU5M z)BN`IEY6Qr$ht&mAGMOd<^)jv0J^y7G5cR4@pe0e_rP|HVE4xlrniG9i*L5b_r9xT_D71Q_&Fz6&=GiX4|b$75uEDVRO@hd>dTBevQ|*G>aclq z$xa#h0I>G_v%XMfag1%wG7$aI<>x4~e-x+yjxYu;QIbq!%y#C}`T~kozRj`YyvDG~ z=Ml=gpwib4dnjlf)(Fw4{40?d_vgqte1>;^x;3>z>^RF zu9H2y+PhQ6O?g|{p%>4Kmi-lfK76WHR;MKnPl^foShHpd3XL)e&Pb6ve|g?-ua+3R za*c8KxtW@-RY-@P;eozBU|XZYG|a?vQ&Qd^R~HI4h;c^m)dDTNU2{}lNx;X`cSoH& GDeph#87>R} literal 0 HcmV?d00001 From 0539ab934587219a1204fe8058d6ae11607089d3 Mon Sep 17 00:00:00 2001 From: thyttan <6uuxstm66@mozmail.com⁩> Date: Thu, 20 Mar 2025 19:48:49 +0100 Subject: [PATCH 2/9] voldisp: move where to look if widgets are loaded --- apps/voldisp/boot.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/voldisp/boot.js b/apps/voldisp/boot.js index 7e461d0143..1d41eec13a 100644 --- a/apps/voldisp/boot.js +++ b/apps/voldisp/boot.js @@ -13,14 +13,15 @@ let goAway = ()=>{ let isAllWidgetsHidden = true; - for (var w of global.WIDGETS) { - if (!w._draw) { - isAllWidgetsHidden = false; - break; + if (global.WIDGETS) { + for (var w of global.WIDGETS) { + if (!w._draw) { + isAllWidgetsHidden = false; + break; + } } } - - if (global.WIDGETS && !isAllWidgetsHidden) { + if (!isAllWidgetsHidden) { Bangle.drawWidgets(); } else if (Bangle.uiRedraw) { Bangle.uiRedraw(); From fec5eb08049ffe659676356116cec8ea4ffc653f Mon Sep 17 00:00:00 2001 From: thyttan <6uuxstm66@mozmail.com⁩> Date: Thu, 20 Mar 2025 20:38:30 +0100 Subject: [PATCH 3/9] voldisp: make sure widgets wont draw over volume bar --- apps/voldisp/boot.js | 52 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 11 deletions(-) diff --git a/apps/voldisp/boot.js b/apps/voldisp/boot.js index 1d41eec13a..ec025cf31d 100644 --- a/apps/voldisp/boot.js +++ b/apps/voldisp/boot.js @@ -4,6 +4,44 @@ if (timeout) {clearTimeout(timeout); timeout=undefined;} if (Bangle.CLOCK) { + + const WIDGET_UTILS_HIDE = function() { + //exports.cleanup(); + if (!global.WIDGETS) return; + g.reset(); // reset colors + for (var w of global.WIDGETS) { + if (w._draw) return; // already hidden + w._draw = w.draw; + w.draw = () => {}; + w._area = w.area; + w.area = ""; + if (w.x!=undefined) g.clearRect(w.x,w.y,w.x+w.width-1,w.y+23); + } + }; + /// Show any hidden widgets + const WIDGET_UTILS_SHOW = function() { + //exports.cleanup(); + if (!global.WIDGETS) return; + for (var w of global.WIDGETS) { + if (!w._draw) return; // not hidden + w.draw = w._draw; + w.area = w._area; + delete w._draw; + delete w._area; + w.draw(w); + } + }; + + let isAllWidgetsHidden = true; + if (global.WIDGETS) { + for (var w of global.WIDGETS) { + if (!w._draw) { + isAllWidgetsHidden = false; + break; + } + } + } + WIDGET_UTILS_HIDE(); let barWidth = g.getWidth()*volPercent/100; g. setColor(0x0000).fillRect(0,0,g.getWidth(),24). @@ -12,17 +50,9 @@ drawString("volume",barWidth,1); let goAway = ()=>{ - let isAllWidgetsHidden = true; - if (global.WIDGETS) { - for (var w of global.WIDGETS) { - if (!w._draw) { - isAllWidgetsHidden = false; - break; - } - } - } if (!isAllWidgetsHidden) { - Bangle.drawWidgets(); + g.reset().clearRect(0,0,g.getWidth(),24); + WIDGET_UTILS_SHOW(); } else if (Bangle.uiRedraw) { Bangle.uiRedraw(); } else { @@ -33,5 +63,5 @@ } }; Bangle.on("musicVolume", onMusicVolume); - //GB({t:"audio",v:10}); + //GB({t:"audio",v:66}); } From 500296af191730b4eff2b7f489f7658fff84a37d Mon Sep 17 00:00:00 2001 From: thyttan <6uuxstm66@mozmail.com⁩> Date: Thu, 20 Mar 2025 21:00:46 +0100 Subject: [PATCH 4/9] voldisp: some optimization Hopefully. And also, probably not needed... --- apps/voldisp/boot.js | 59 ++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/apps/voldisp/boot.js b/apps/voldisp/boot.js index ec025cf31d..ef179d7056 100644 --- a/apps/voldisp/boot.js +++ b/apps/voldisp/boot.js @@ -1,37 +1,37 @@ { + const WIDGET_UTILS_HIDE = function() { + //exports.cleanup(); + if (!global.WIDGETS) return; + g.reset(); // reset colors + for (var w of global.WIDGETS) { + if (w._draw) return; // already hidden + w._draw = w.draw; + w.draw = () => {}; + w._area = w.area; + w.area = ""; + if (w.x!=undefined) g.clearRect(w.x,w.y,w.x+w.width-1,w.y+23); + } + }; + /// Show any hidden widgets + const WIDGET_UTILS_SHOW = function() { + //exports.cleanup(); + if (!global.WIDGETS) return; + for (var w of global.WIDGETS) { + if (!w._draw) return; // not hidden + w.draw = w._draw; + w.area = w._area; + delete w._draw; + delete w._area; + w.draw(w); + } + }; + let timeout; let onMusicVolume = (volPercent)=>{ - if (timeout) {clearTimeout(timeout); timeout=undefined;} + if (timeout) {clearTimeout(timeout);} if (Bangle.CLOCK) { - const WIDGET_UTILS_HIDE = function() { - //exports.cleanup(); - if (!global.WIDGETS) return; - g.reset(); // reset colors - for (var w of global.WIDGETS) { - if (w._draw) return; // already hidden - w._draw = w.draw; - w.draw = () => {}; - w._area = w.area; - w.area = ""; - if (w.x!=undefined) g.clearRect(w.x,w.y,w.x+w.width-1,w.y+23); - } - }; - /// Show any hidden widgets - const WIDGET_UTILS_SHOW = function() { - //exports.cleanup(); - if (!global.WIDGETS) return; - for (var w of global.WIDGETS) { - if (!w._draw) return; // not hidden - w.draw = w._draw; - w.area = w._area; - delete w._draw; - delete w._area; - w.draw(w); - } - }; - let isAllWidgetsHidden = true; if (global.WIDGETS) { for (var w of global.WIDGETS) { @@ -41,7 +41,7 @@ } } } - WIDGET_UTILS_HIDE(); + if (!timeout) {WIDGET_UTILS_HIDE();} let barWidth = g.getWidth()*volPercent/100; g. setColor(0x0000).fillRect(0,0,g.getWidth(),24). @@ -58,6 +58,7 @@ } else { Bangle.load(); } + timeout = undefined; }; timeout = setTimeout(goAway, 3*1000); } From 1fa489b918c1fa94e1756f3c2b61bb0c25da9e39 Mon Sep 17 00:00:00 2001 From: thyttan <6uuxstm66@mozmail.com⁩> Date: Thu, 20 Mar 2025 21:58:37 +0100 Subject: [PATCH 5/9] voldisp: fix logic re hide/show widgets and how to `goAway` Also small optimization. --- apps/voldisp/boot.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/apps/voldisp/boot.js b/apps/voldisp/boot.js index ef179d7056..349876d910 100644 --- a/apps/voldisp/boot.js +++ b/apps/voldisp/boot.js @@ -26,6 +26,7 @@ } }; + let isWeHidingTheWidgets = false; let timeout; let onMusicVolume = (volPercent)=>{ if (timeout) {clearTimeout(timeout);} @@ -33,15 +34,20 @@ if (Bangle.CLOCK) { let isAllWidgetsHidden = true; - if (global.WIDGETS) { - for (var w of global.WIDGETS) { - if (!w._draw) { - isAllWidgetsHidden = false; - break; + if (!timeout) { // No need to do this if we already did it before and it wasn't undone. I.e. the timout to execute `goAway` never ran out. + if (global.WIDGETS) { + for (var w of global.WIDGETS) { + if (!w._draw) { + isAllWidgetsHidden = false; + break; + } } } + if (!isAllWidgetsHidden) { + WIDGET_UTILS_HIDE(); + isWeHidingTheWidgets = true; // Remember if it was we who hid the widgets between draws of the volume bar. + } } - if (!timeout) {WIDGET_UTILS_HIDE();} let barWidth = g.getWidth()*volPercent/100; g. setColor(0x0000).fillRect(0,0,g.getWidth(),24). @@ -50,9 +56,10 @@ drawString("volume",barWidth,1); let goAway = ()=>{ - if (!isAllWidgetsHidden) { + if (isWeHidingTheWidgets) { g.reset().clearRect(0,0,g.getWidth(),24); WIDGET_UTILS_SHOW(); + isWeHidingTheWidgets = false; } else if (Bangle.uiRedraw) { Bangle.uiRedraw(); } else { From cc97e86709dd1c6e360b653d57d22743cbdaf3a8 Mon Sep 17 00:00:00 2001 From: thyttan <6uuxstm66@mozmail.com⁩> Date: Fri, 21 Mar 2025 18:56:55 +0100 Subject: [PATCH 6/9] Revert "voldisp: fix logic re hide/show widgets and how to `goAway`" This reverts commit 1fa489b918c1fa94e1756f3c2b61bb0c25da9e39. --- apps/voldisp/boot.js | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/apps/voldisp/boot.js b/apps/voldisp/boot.js index 349876d910..ef179d7056 100644 --- a/apps/voldisp/boot.js +++ b/apps/voldisp/boot.js @@ -26,7 +26,6 @@ } }; - let isWeHidingTheWidgets = false; let timeout; let onMusicVolume = (volPercent)=>{ if (timeout) {clearTimeout(timeout);} @@ -34,20 +33,15 @@ if (Bangle.CLOCK) { let isAllWidgetsHidden = true; - if (!timeout) { // No need to do this if we already did it before and it wasn't undone. I.e. the timout to execute `goAway` never ran out. - if (global.WIDGETS) { - for (var w of global.WIDGETS) { - if (!w._draw) { - isAllWidgetsHidden = false; - break; - } + if (global.WIDGETS) { + for (var w of global.WIDGETS) { + if (!w._draw) { + isAllWidgetsHidden = false; + break; } } - if (!isAllWidgetsHidden) { - WIDGET_UTILS_HIDE(); - isWeHidingTheWidgets = true; // Remember if it was we who hid the widgets between draws of the volume bar. - } } + if (!timeout) {WIDGET_UTILS_HIDE();} let barWidth = g.getWidth()*volPercent/100; g. setColor(0x0000).fillRect(0,0,g.getWidth(),24). @@ -56,10 +50,9 @@ drawString("volume",barWidth,1); let goAway = ()=>{ - if (isWeHidingTheWidgets) { + if (!isAllWidgetsHidden) { g.reset().clearRect(0,0,g.getWidth(),24); WIDGET_UTILS_SHOW(); - isWeHidingTheWidgets = false; } else if (Bangle.uiRedraw) { Bangle.uiRedraw(); } else { From 108a932a581bb8cbbaf792663b21638ba2b62594 Mon Sep 17 00:00:00 2001 From: thyttan <6uuxstm66@mozmail.com⁩> Date: Fri, 21 Mar 2025 18:59:22 +0100 Subject: [PATCH 7/9] Revert "voldisp: some optimization" This reverts commit 500296af191730b4eff2b7f489f7658fff84a37d. --- apps/voldisp/boot.js | 59 ++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/apps/voldisp/boot.js b/apps/voldisp/boot.js index ef179d7056..ec025cf31d 100644 --- a/apps/voldisp/boot.js +++ b/apps/voldisp/boot.js @@ -1,37 +1,37 @@ { - const WIDGET_UTILS_HIDE = function() { - //exports.cleanup(); - if (!global.WIDGETS) return; - g.reset(); // reset colors - for (var w of global.WIDGETS) { - if (w._draw) return; // already hidden - w._draw = w.draw; - w.draw = () => {}; - w._area = w.area; - w.area = ""; - if (w.x!=undefined) g.clearRect(w.x,w.y,w.x+w.width-1,w.y+23); - } - }; - /// Show any hidden widgets - const WIDGET_UTILS_SHOW = function() { - //exports.cleanup(); - if (!global.WIDGETS) return; - for (var w of global.WIDGETS) { - if (!w._draw) return; // not hidden - w.draw = w._draw; - w.area = w._area; - delete w._draw; - delete w._area; - w.draw(w); - } - }; - let timeout; let onMusicVolume = (volPercent)=>{ - if (timeout) {clearTimeout(timeout);} + if (timeout) {clearTimeout(timeout); timeout=undefined;} if (Bangle.CLOCK) { + const WIDGET_UTILS_HIDE = function() { + //exports.cleanup(); + if (!global.WIDGETS) return; + g.reset(); // reset colors + for (var w of global.WIDGETS) { + if (w._draw) return; // already hidden + w._draw = w.draw; + w.draw = () => {}; + w._area = w.area; + w.area = ""; + if (w.x!=undefined) g.clearRect(w.x,w.y,w.x+w.width-1,w.y+23); + } + }; + /// Show any hidden widgets + const WIDGET_UTILS_SHOW = function() { + //exports.cleanup(); + if (!global.WIDGETS) return; + for (var w of global.WIDGETS) { + if (!w._draw) return; // not hidden + w.draw = w._draw; + w.area = w._area; + delete w._draw; + delete w._area; + w.draw(w); + } + }; + let isAllWidgetsHidden = true; if (global.WIDGETS) { for (var w of global.WIDGETS) { @@ -41,7 +41,7 @@ } } } - if (!timeout) {WIDGET_UTILS_HIDE();} + WIDGET_UTILS_HIDE(); let barWidth = g.getWidth()*volPercent/100; g. setColor(0x0000).fillRect(0,0,g.getWidth(),24). @@ -58,7 +58,6 @@ } else { Bangle.load(); } - timeout = undefined; }; timeout = setTimeout(goAway, 3*1000); } From 0b5af5f48e1277f7469b00e961ceed4403ca6e7a Mon Sep 17 00:00:00 2001 From: thyttan <6uuxstm66@mozmail.com⁩> Date: Fri, 21 Mar 2025 18:59:39 +0100 Subject: [PATCH 8/9] Revert "voldisp: make sure widgets wont draw over volume bar" This reverts commit fec5eb08049ffe659676356116cec8ea4ffc653f. --- apps/voldisp/boot.js | 52 ++++++++++---------------------------------- 1 file changed, 11 insertions(+), 41 deletions(-) diff --git a/apps/voldisp/boot.js b/apps/voldisp/boot.js index ec025cf31d..1d41eec13a 100644 --- a/apps/voldisp/boot.js +++ b/apps/voldisp/boot.js @@ -4,44 +4,6 @@ if (timeout) {clearTimeout(timeout); timeout=undefined;} if (Bangle.CLOCK) { - - const WIDGET_UTILS_HIDE = function() { - //exports.cleanup(); - if (!global.WIDGETS) return; - g.reset(); // reset colors - for (var w of global.WIDGETS) { - if (w._draw) return; // already hidden - w._draw = w.draw; - w.draw = () => {}; - w._area = w.area; - w.area = ""; - if (w.x!=undefined) g.clearRect(w.x,w.y,w.x+w.width-1,w.y+23); - } - }; - /// Show any hidden widgets - const WIDGET_UTILS_SHOW = function() { - //exports.cleanup(); - if (!global.WIDGETS) return; - for (var w of global.WIDGETS) { - if (!w._draw) return; // not hidden - w.draw = w._draw; - w.area = w._area; - delete w._draw; - delete w._area; - w.draw(w); - } - }; - - let isAllWidgetsHidden = true; - if (global.WIDGETS) { - for (var w of global.WIDGETS) { - if (!w._draw) { - isAllWidgetsHidden = false; - break; - } - } - } - WIDGET_UTILS_HIDE(); let barWidth = g.getWidth()*volPercent/100; g. setColor(0x0000).fillRect(0,0,g.getWidth(),24). @@ -50,9 +12,17 @@ drawString("volume",barWidth,1); let goAway = ()=>{ + let isAllWidgetsHidden = true; + if (global.WIDGETS) { + for (var w of global.WIDGETS) { + if (!w._draw) { + isAllWidgetsHidden = false; + break; + } + } + } if (!isAllWidgetsHidden) { - g.reset().clearRect(0,0,g.getWidth(),24); - WIDGET_UTILS_SHOW(); + Bangle.drawWidgets(); } else if (Bangle.uiRedraw) { Bangle.uiRedraw(); } else { @@ -63,5 +33,5 @@ } }; Bangle.on("musicVolume", onMusicVolume); - //GB({t:"audio",v:66}); + //GB({t:"audio",v:10}); } From 78c796478327be7f6936aefb62a0e1f0f1c94d24 Mon Sep 17 00:00:00 2001 From: thyttan <6uuxstm66@mozmail.com⁩> Date: Sat, 22 Mar 2025 11:13:48 +0100 Subject: [PATCH 9/9] voldisp: add README with some notes re widgets and performance --- apps/voldisp/README.md | 15 +++++++++++++++ apps/voldisp/metadata.json | 1 + 2 files changed, 16 insertions(+) create mode 100644 apps/voldisp/README.md diff --git a/apps/voldisp/README.md b/apps/voldisp/README.md new file mode 100644 index 0000000000..e44d0fce54 --- /dev/null +++ b/apps/voldisp/README.md @@ -0,0 +1,15 @@ +# Display Volume for Android + +Display the media volume of your android device when it's changed. A bar shows up at the top of your Bangles screen. (Needs recent Gadgetbridge nightly or stable ver. 85 once out) + +## Notes + +- Widgets may redraw on top of the volume bar. There was an effort to mitigate this, but the code complexity was annoying. + - This is however preserved in the git history (by revert commits) so can be brought back by reverting (revert the revert commits...) if needed. +- Indicator might appear laggy or to not update continuously. + - There seems to be a limitation to how often Gadgetbridge can send send the volume info from the Android device - when it's in the background (most of the time). If Gadgetbridge is in the foreground on Android the volume bar on the Bangle updates almost as fast as the one on the Android device itself. + +## Contributors + +thyttan + diff --git a/apps/voldisp/metadata.json b/apps/voldisp/metadata.json index 6629cb8c11..3af0dc7fd9 100644 --- a/apps/voldisp/metadata.json +++ b/apps/voldisp/metadata.json @@ -6,6 +6,7 @@ "tags": "audio,media,android,volume,sound", "type": "bootloader", "supports" : ["BANGLEJS2"], + "readme": "README.md", "screenshots" : [ { "url":"screenshot.png" } ],