+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
pull/2758/head
Gordon Williams 2023-05-15 09:49:17 +01:00
parent de79b0a39e
commit b5167d7068
7 changed files with 13 additions and 5 deletions

View File

@ -1 +1,2 @@
0.01: New Widget!
0.02: Ensure that the generated image is transparent (2v18+)

View File

@ -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") }},

View File

@ -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",

View File

@ -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
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+)

View File

@ -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

View File

@ -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;

View File

@ -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",