Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

voldisp: new app that displays volume change on Android device #3780

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions apps/voldisp/ChangeLog
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.01: New App!
15 changes: 15 additions & 0 deletions apps/voldisp/README.md
Original file line number Diff line number Diff line change
@@ -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

Binary file added apps/voldisp/app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions apps/voldisp/boot.js
Original file line number Diff line number Diff line change
@@ -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});
}
16 changes: 16 additions & 0 deletions apps/voldisp/metadata.json
Original file line number Diff line number Diff line change
@@ -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"}
]
}
Binary file added apps/voldisp/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.