1
0
Fork 0

Merge pull request #2263 from thyttan/torch

[Torch] use Bangle.showClock
master
Gordon Williams 2022-11-15 08:30:06 +00:00 committed by GitHub
commit caab338ba2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 20 deletions

View File

@ -7,3 +7,4 @@
0.07: Code tweaks
0.08: Force background of widget field to the torch colour
0.09: Change code taking FW tweaks into account
0.10: Introduce fast switching.

View File

@ -1,21 +1,31 @@
const SETTINGS_FILE = "torch.json";
let settings;
{
const SETTINGS_FILE = "torch.json";
let settings;
function loadSettings() {
settings = require("Storage").readJSON(SETTINGS_FILE,1)|| {'bg': '#FFFFFF', 'color': 'White'};
let loadSettings = function() {
settings = require("Storage").readJSON(SETTINGS_FILE,1)|| {'bg': '#FFFFFF', 'color': 'White'};
};
loadSettings();
let brightnessBackup = require("Storage").readJSON('setting.json').brightness;
let optionsBackup = Bangle.getOptions();
Bangle.setLCDBrightness(1);
Bangle.setLCDPower(1);
Bangle.setLCDTimeout(0);
g.reset();
let themeBackup = g.theme;
g.setTheme({bg:settings.bg,fg:"#000"});
g.setColor(settings.bg);
g.fillRect(0,0,g.getWidth(),g.getHeight());
Bangle.setUI({
mode : 'custom',
back : Bangle.showClock, // B2: SW back button to exit
btn : _=>Bangle.showClock(), // B1&2: HW button to exit.
remove : ()=>{
Bangle.setLCDBrightness(brightnessBackup);
Bangle.setOptions(optionsBackup);
g.setTheme(themeBackup);
}
});
}
loadSettings();
Bangle.setLCDBrightness(1);
Bangle.setLCDPower(1);
Bangle.setLCDTimeout(0);
g.reset();
g.setTheme({bg:settings.bg,fg:"#000"});
g.setColor(settings.bg);
g.fillRect(0,0,g.getWidth(),g.getHeight());
Bangle.setUI({
mode : 'custom',
back : load, // B2: SW back button to exit
btn : ()=>{load();}, // B1&2: HW button to exit. // A simple 'load' as on the line above did not work for btn???
});

View File

@ -2,7 +2,7 @@
"id": "torch",
"name": "Torch",
"shortName": "Torch",
"version": "0.09",
"version": "0.10",
"description": "Turns screen white to help you see in the dark. Select from the launcher or press BTN1,BTN3,BTN1,BTN3 quickly to start when in any app that shows widgets on Bangle.js 1. You can also set the color through the app's setting menu.",
"icon": "app.png",
"tags": "tool,torch",