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/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/app.png b/apps/voldisp/app.png new file mode 100644 index 0000000000..c36e104410 Binary files /dev/null and b/apps/voldisp/app.png differ diff --git a/apps/voldisp/boot.js b/apps/voldisp/boot.js new file mode 100644 index 0000000000..1d41eec13a --- /dev/null +++ b/apps/voldisp/boot.js @@ -0,0 +1,37 @@ +{ + let timeout; + let onMusicVolume = (volPercent)=>{ + 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; + if (global.WIDGETS) { + for (var w of global.WIDGETS) { + if (!w._draw) { + isAllWidgetsHidden = false; + break; + } + } + } + if (!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..3af0dc7fd9 --- /dev/null +++ b/apps/voldisp/metadata.json @@ -0,0 +1,16 @@ +{ "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"], + "readme": "README.md", + "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 0000000000..898aaa6a69 Binary files /dev/null and b/apps/voldisp/screenshot.png differ