From b5167d7068f4769bc2f5d94a855c23373f277657 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Mon, 15 May 2023 09:49:17 +0100 Subject: [PATCH] +0.04: On 2v18+ firmware, we can now stop swipe events from being handled by other apps + eg. when a clockinfo is selected, swipes won't affect swipe-down widgets +0.05: Reported image for battery is now transparent (2v18+) Fix https://github.com/espruino/BangleApps/issues/2749 --- apps/clkinfomag/ChangeLog | 1 + apps/clkinfomag/clkinfo.js | 1 + apps/clkinfomag/metadata.json | 2 +- apps/clock_info/ChangeLog | 5 ++++- apps/clock_info/README.md | 2 +- apps/clock_info/lib.js | 5 ++++- apps/clock_info/metadata.json | 2 +- 7 files changed, 13 insertions(+), 5 deletions(-) diff --git a/apps/clkinfomag/ChangeLog b/apps/clkinfomag/ChangeLog index 4c21f3ace..4d19c5998 100644 --- a/apps/clkinfomag/ChangeLog +++ b/apps/clkinfomag/ChangeLog @@ -1 +1,2 @@ 0.01: New Widget! +0.02: Ensure that the generated image is transparent (2v18+) \ No newline at end of file diff --git a/apps/clkinfomag/clkinfo.js b/apps/clkinfomag/clkinfo.js index 7a6062a2f..620227472 100644 --- a/apps/clkinfomag/clkinfo.js +++ b/apps/clkinfomag/clkinfo.js @@ -27,6 +27,7 @@ g.drawLine(8,12,16,12); else g.fillPoly(g.transformVertices([0,-10,4,10,-4,10],{x:12,y:12,rotate:-heading/57})); + g.transparent=0; // only works on 2v18+, ignored otherwise (makes image background transparent) return { text : isNaN(heading)?"--":Math.round(heading), v : 0|heading, min : 0, max : 360, img : g.asImage("string") }}, diff --git a/apps/clkinfomag/metadata.json b/apps/clkinfomag/metadata.json index 84d6bc16c..464bba778 100644 --- a/apps/clkinfomag/metadata.json +++ b/apps/clkinfomag/metadata.json @@ -1,6 +1,6 @@ { "id": "clkinfomag", "name": "Compass Clockinfo", - "version":"0.01", + "version":"0.02", "description": "Extra information to add to clock screens. When selected, displays the compass heading and an arrow pointing North", "icon": "icon.png", "type": "clkinfo", diff --git a/apps/clock_info/ChangeLog b/apps/clock_info/ChangeLog index 0081c49d4..ae33f6f26 100644 --- a/apps/clock_info/ChangeLog +++ b/apps/clock_info/ChangeLog @@ -1,3 +1,6 @@ 0.01: Moved from modules/clock_info.js 0.02: Fix settings page -0.03: Reported image for battery now reflects charge level \ No newline at end of file +0.03: Reported image for battery now reflects charge level +0.04: On 2v18+ firmware, we can now stop swipe events from being handled by other apps + eg. when a clockinfo is selected, swipes won't affect swipe-down widgets +0.05: Reported image for battery is now transparent (2v18+) \ No newline at end of file diff --git a/apps/clock_info/README.md b/apps/clock_info/README.md index 37bac8f80..7e1a3d637 100644 --- a/apps/clock_info/README.md +++ b/apps/clock_info/README.md @@ -25,7 +25,7 @@ By default Clock Info provides: But by installing other apps that are tagged with the type `clkinfo` you can add extra features. For example [Sunrise Clockinfo](http://banglejs.com/apps/?id=clkinfosunrise) -A full list is available at https://banglejs.com/apps/?q=clkinfo +A full list is available at https://banglejs.com/apps/?c=clkinfo ## Settings diff --git a/apps/clock_info/lib.js b/apps/clock_info/lib.js index e849be256..206022272 100644 --- a/apps/clock_info/lib.js +++ b/apps/clock_info/lib.js @@ -56,8 +56,9 @@ exports.load = function() { get : () => { let v = E.getBattery(); var img; if (!Bangle.isCharging()) { - var s=24,g = Graphics.createArrayBuffer(24,24,1,{msb:true}); + var s=24, g=Graphics.createArrayBuffer(24,24,1,{msb:true}); g.fillRect(0,6,s-3,18).clearRect(2,8,s-5,16).fillRect(s-2,10,s,15).fillRect(3,9,3+v*(s-9)/100,15); + g.transparent=0; // only works on 2v18+, ignored otherwise (makes image background transparent) img = g.asImage("string"); } else img=atob("GBiBAAABgAADwAAHwAAPgACfAAHOAAPkBgHwDwP4Hwf8Pg/+fB//OD//kD//wD//4D//8D//4B//QB/+AD/8AH/4APnwAHAAACAAAA=="); return { @@ -268,6 +269,8 @@ exports.addInteractive = function(menu, options) { let settings = exports.loadSettings(); settings.apps[appName] = {a:options.menuA,b:options.menuB}; require("Storage").writeJSON("clock_info.json",settings); + // On 2v18+ firmware we can stop other event handlers from being executed since we handled this + E.stopEventPropagation&&E.stopEventPropagation(); } Bangle.on("swipe",swipeHandler); let touchHandler, lockHandler; diff --git a/apps/clock_info/metadata.json b/apps/clock_info/metadata.json index 703cf9909..a45741253 100644 --- a/apps/clock_info/metadata.json +++ b/apps/clock_info/metadata.json @@ -1,7 +1,7 @@ { "id": "clock_info", "name": "Clock Info Module", "shortName": "Clock Info", - "version":"0.03", + "version":"0.05", "description": "A library used by clocks to provide extra information on the clock face (Altitude, BPM, etc)", "icon": "app.png", "type": "module",