diff --git a/apps.json b/apps.json index 040fa2088..da3b04799 100644 --- a/apps.json +++ b/apps.json @@ -121,7 +121,7 @@ { "id": "gbridge", "name": "Gadgetbridge", "icon": "app.png", - "version":"0.14", + "version":"0.15", "description": "The default notification handler for Gadgetbridge notifications from Android", "tags": "tool,system,android,widget", "type":"widget", diff --git a/apps/gbridge/ChangeLog b/apps/gbridge/ChangeLog index 124f2f001..8277b3479 100644 --- a/apps/gbridge/ChangeLog +++ b/apps/gbridge/ChangeLog @@ -13,3 +13,4 @@ 0.12: Setting to show/hide icon 0.13: Modified to use the 'notify' library 0.14: Added 'find' event handling +0.15: Don't keep LCD on while playing music \ No newline at end of file diff --git a/apps/gbridge/widget.js b/apps/gbridge/widget.js index 0741fcb58..b2f169985 100644 --- a/apps/gbridge/widget.js +++ b/apps/gbridge/widget.js @@ -29,25 +29,32 @@ Bangle.buzz(); } - function handleMusicStateUpdate(event) { - const changed = state.music === event.state - state.music = event.state - + function updateMusic(options){ if (state.music === "play") { - require("notify").show({size:40, render:y => { + require("notify").show(Object.assign({size:40, render:y => { g.setColor(-1); g.drawImage(require("heatshrink").decompress(atob("jEYwILI/EAv/8gP/ARcMgOAASN8h+A/kfwP8n4CD/E/gHgjg/HA=")), 8, y + 8); g.setFontAlign(-1, -1); var x = 40; g.setFont("4x6", 2).drawString(state.musicInfo.artist, x, y + 8); g.setFont("6x8", 1).drawString(state.musicInfo.track, x, y + 22); - }}); + }}, options)); } if (state.music === "pause") { require("notify").hide(); } } + function handleMusicStateUpdate(event) { + if (state.music !== event.state) { + state.music = event.state + updateMusic({on: true}); + } + } + function handleMusicInfoUpdate(event) { + state.musicInfo = event; + updateMusic({on: false}); + } function handleCallEvent(event) { if (event.cmd === "accept") { @@ -77,7 +84,7 @@ handleNotificationEvent(event); break; case "musicinfo": - state.musicInfo = event; + handleMusicInfoUpdate(event); break; case "musicstate": handleMusicStateUpdate(event);