Widbatpc: setting to hide widget, apps.json fix for stopwatch touch

pull/854/head
hughbarney 2021-10-20 19:13:29 +01:00
parent 4ccc61822f
commit 572dac6889
4 changed files with 12 additions and 3 deletions

View File

@ -668,7 +668,7 @@
"name": "Battery Level Widget (with percentage)", "name": "Battery Level Widget (with percentage)",
"shortName": "Battery Widget", "shortName": "Battery Widget",
"icon": "widget.png", "icon": "widget.png",
"version":"0.13", "version":"0.14",
"description": "Show the current battery level and charging status in the top right of the clock, with charge percentage", "description": "Show the current battery level and charging status in the top right of the clock, with charge percentage",
"tags": "widget,battery,b2", "tags": "widget,battery,b2",
"type":"widget", "type":"widget",
@ -3622,7 +3622,7 @@
"readme": "README.md", "readme": "README.md",
"tags": "tool, b2", "tags": "tool, b2",
"storage": [ "storage": [
{"name":"stopwatch.app.js","url":"stopwatch.js"}, {"name":"stopwatch.app.js","url":"stopwatch.app.js"},
{"name":"stopwatch.img","url":"stopwatch.icon.js","evaluate":true} {"name":"stopwatch.img","url":"stopwatch.icon.js","evaluate":true}
] ]
} }

View File

@ -10,3 +10,4 @@
0.11: Don't overwrite existing settings on app update 0.11: Don't overwrite existing settings on app update
0.12: Fixed for Bangle 2 0.12: Fixed for Bangle 2
0.13: Fillbar setting added, see README 0.13: Fillbar setting added, see README
0.14: Added setting to completely hide the widget

View File

@ -13,6 +13,7 @@
'fillbar': false, 'fillbar': false,
'charger': true, 'charger': true,
'hideifmorethan': 100, 'hideifmorethan': 100,
'hidewidget': false,
} }
// ...and overwrite them with any saved values // ...and overwrite them with any saved values
// This way saved values are preserved if a new version adds more settings // This way saved values are preserved if a new version adds more settings
@ -31,7 +32,8 @@
} }
} }
const onOffFormat = b => (b ? 'on' : 'off') const onOffFormat = b => (b ? 'On' : 'Off')
const yesNoFormat = b => (b ? 'Yes' : 'No')
const menu = { const menu = {
'': { 'title': 'Battery Widget' }, '': { 'title': 'Battery Widget' },
'< Back': back, '< Back': back,
@ -68,6 +70,11 @@
format: x => x+"%", format: x => x+"%",
onchange: save('hideifmorethan'), onchange: save('hideifmorethan'),
}, },
'Hide Widget': {
value: s.hidewidget,
format: yesNoFormat,
onchange: save('hidewidget'),
},
} }
E.showMenu(menu) E.showMenu(menu)
}) })

View File

@ -76,6 +76,7 @@
function draw() { function draw() {
// if hidden, don't draw // if hidden, don't draw
if (!WIDGETS["batpc"].width) return; if (!WIDGETS["batpc"].width) return;
if (setting('hidewidget')) return;
// else... // else...
var s = 39; var s = 39;
var x = this.x, y = this.y; var x = this.x, y = this.y;