Skip to content

Commit aaf406a

Browse files
author
thyttan
committed
voldisp: new app that displays volume change on Android device
1 parent 1f2e693 commit aaf406a

File tree

4 files changed

+49
-0
lines changed

4 files changed

+49
-0
lines changed

apps/voldisp/ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.01: New App!

apps/voldisp/app.png

1.22 KB
Loading

apps/voldisp/boot.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
let timeout;
3+
let onMusicVolume = (volPercent)=>{
4+
if (timeout) {clearTimeout(timeout); timeout=undefined;}
5+
6+
if (Bangle.CLOCK) {
7+
let barWidth = g.getWidth()*volPercent/100;
8+
g.
9+
setColor(0x0000).fillRect(0,0,g.getWidth(),24).
10+
setColor(0xF800).fillRect(0,0,barWidth,19).
11+
setColor(0xFFFF).setFont("12x20").setFontAlign(1,-1).
12+
drawString("volume",barWidth,1);
13+
14+
let goAway = ()=>{
15+
let isAllWidgetsHidden = true;
16+
for (var w of global.WIDGETS) {
17+
if (!w._draw) {
18+
isAllWidgetsHidden = false;
19+
break;
20+
}
21+
}
22+
23+
if (global.WIDGETS && !isAllWidgetsHidden) {
24+
Bangle.drawWidgets();
25+
} else if (Bangle.uiRedraw) {
26+
Bangle.uiRedraw();
27+
} else {
28+
Bangle.load();
29+
}
30+
};
31+
timeout = setTimeout(goAway, 3*1000);
32+
}
33+
};
34+
Bangle.on("musicVolume", onMusicVolume);
35+
//GB({t:"audio",v:10});
36+
}

apps/voldisp/metadata.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{ "id": "voldisp",
2+
"name": "Display Volume for Android",
3+
"version":"0.01",
4+
"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)",
5+
"icon": "app.png",
6+
"tags": "audio,media,android,volume,sound",
7+
"type": "bootloader",
8+
"supports" : ["BANGLEJS2"],
9+
"storage": [
10+
{"name":"voldisp.boot.js","url":"boot.js"}
11+
]
12+
}

0 commit comments

Comments
 (0)