widcloselaunch - New widget

pull/2159/head
Martin Boonk 2022-09-22 19:59:21 +02:00
parent 3d09724859
commit 79b9217960
8 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1 @@
0.01: New widget!

View File

@ -0,0 +1,9 @@
# Close Button Launcher
Adds a ![X](preview.png) button to close the current app and go back to the launcher.
(Widget is not visible on the clock screen)
Copied from widclose by @rigrig and slightly modified.
![Light theme screenshot](screenshot_light.png)
![Dark theme screenshot](screenshot_dark.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1,15 @@
{
"id": "widcloselaunch",
"name": "Close Button to launcher",
"version": "0.01",
"description": "A button to close the current app and go to launcher",
"readme": "README.md",
"icon": "icon.png",
"type": "widget",
"tags": "widget,tools",
"supports": ["BANGLEJS2"],
"screenshots": [{"url":"screenshot_light.png"},{"url":"screenshot_dark.png"}],
"storage": [
{"name":"widclose.wid.js","url":"widget.js"}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -0,0 +1,14 @@
if (!Bangle.CLOCK) WIDGETS.close = {
area: "tr", width: 24, sortorder: 10, // we want the right-most spot please
draw: function() {
Bangle.removeListener("touch", this.touch);
Bangle.on("touch", this.touch);
g.reset().setColor("#f00").drawImage(atob( // hardcoded red to match setUI back button
// b/w version of preview.png, 24x24
"GBgBABgAAf+AB//gD//wH//4P//8P//8fn5+fjx+fxj+f4H+/8P//8P/f4H+fxj+fjx+fn5+P//8P//8H//4D//wB//gAf+AABgA"
), this.x, this.y);
}, touch: function(_, c) {
const w = WIDGETS.close;
if (w && c.x>=w.x && c.x<=w.x+24 && c.y>=w.y && c.y<=w.y+24) Bangle.showLauncher();
}
};