New medical alert widget

Signed-off-by: James Taylor <jt-git@nti.me.uk>
pull/2104/head
James Taylor 2022-08-25 21:16:43 +01:00
parent fb7b69379a
commit 130a847c32
6 changed files with 69 additions and 0 deletions

1
apps/widmeda/ChangeLog Normal file
View File

@ -0,0 +1 @@
0.01: Initial Medical Alert Widget!

23
apps/widmeda/README.md Normal file
View File

@ -0,0 +1,23 @@
# Medical Alert Widget
Shows a medical alert logo in the top right widget area, and a medical alert message in the bottom widget area.
**Note:** this is not a replacement for a medical alert band but hopefully a useful addition.
## Features
Implemented:
- Basic medical alert logo and message
- Only display bottom widget on clocks
- High contrast colours depending on theme
Future:
- Configure when to show bottom widget (always/never/clocks)
- Configure medical alert text
- Show details when touched
## Creator
James Taylor ([jt-nti](https://github.com/jt-nti))

View File

@ -0,0 +1,15 @@
{ "id": "widmeda",
"name": "Medical Alert Widget",
"shortName":"Medical Alert",
"version":"0.01",
"description": "Display a medical alert in the bottom widget section.",
"icon": "widget.png",
"type": "widget",
"tags": "health,medical,tools,widget",
"supports" : ["BANGLEJS2"],
"readme": "README.md",
"screenshots": [{"url":"screenshot_light.png"}],
"storage": [
{"name":"widmeda.wid.js","url":"widget.js"}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

30
apps/widmeda/widget.js Normal file
View File

@ -0,0 +1,30 @@
(() => {
// Top right star of life logo
WIDGETS["widmedatr"]={
area: "tr",
width: 24,
draw: function() {
g.reset();
g.setColor("#f00");
g.drawImage(atob("FhYBAAAAA/AAD8AAPwAc/OD/P8P8/x/z/n+/+P5/wP58A/nwP5/x/v/n/P+P8/w/z/Bz84APwAA/AAD8AAAAAA=="), this.x + 1, this.y + 1);
}
};
// Bottom medical alert message
WIDGETS["widmedabl"]={
area: "bl",
width: Bangle.CLOCK?Bangle.appRect.w:0,
draw: function() {
// Only show the widget on clocks
if (!Bangle.CLOCK) return;
g.reset();
g.setBgColor(g.theme.dark ? "#fff" : "#f00");
g.setColor(g.theme.dark ? "#f00" : "#fff");
g.setFont("Vector",18);
g.setFontAlign(0,0);
g.clearRect(this.x, this.y, this.x + this.width - 1, this.y + 23);
g.drawString("MEDICAL ALERT", this.width / 2, this.y + ( 23 / 2 ));
}
};
})();

BIN
apps/widmeda/widget.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB