Skip to content

poweroff app: Use E.showMessage() instead of g.drawString(). #3918

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/poweroff/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
0.03: Add settings to configure prompt
0.04: Minor code improvements
0.05: Comment out unused function in settings.js
0.06: Changed to use E.showMessage() instead of g.drawString() to display power off message. Looks better and is more coherent.
15 changes: 5 additions & 10 deletions apps/poweroff/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,21 @@ if (showPrompt) {
setTimeout(load, 100);
return;
}
g.setFont("6x8",2).setFontAlign(0,0);
var x = g.getWidth()/2;
var y = g.getHeight()/2 + 10;
g.drawString("Powering off...", x, y);

E.showMessage("Powering off...");

setTimeout(function() {
if (Bangle.softOff) Bangle.softOff(); else Bangle.off();
}, 1000);
});
} else {
g.setFont("6x8",2).setFontAlign(0,0);
var x = g.getWidth()/2;
var y = g.getHeight()/2 + 10;
g.drawString("Powering off...", x, y);

E.showMessage("Powering off...");

setTimeout(function() {
if (Bangle.softOff) Bangle.softOff(); else Bangle.off();
}, 1000);
}

Bangle.loadWidgets();
Bangle.drawWidgets();
}
}
2 changes: 1 addition & 1 deletion apps/poweroff/metadata.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ "id": "poweroff",
"name": "Poweroff",
"shortName":"Poweroff",
"version": "0.05",
"version": "0.06",
"description": "Simple app to power off your Bangle.js",
"icon": "app.png",
"tags": "tool,poweroff,shutdown",
Expand Down