Restore custom background function, fix clockbg usage, restore img linked in readme
parent
48d077e2e4
commit
3cc5c3f31d
|
|
@ -3,4 +3,5 @@
|
||||||
0.03: Allows showing the month in short or long format by setting `"shortMonth"` to true or false
|
0.03: Allows showing the month in short or long format by setting `"shortMonth"` to true or false
|
||||||
0.04: Improves touchscreen drag handling for background apps such as Pattern Launcher
|
0.04: Improves touchscreen drag handling for background apps such as Pattern Launcher
|
||||||
0.05: Fixes step count not resetting after a new day starts
|
0.05: Fixes step count not resetting after a new day starts
|
||||||
0.06 Added clockbackground app functionality
|
0.06: Added clockbackground app functionality
|
||||||
|
0.07: Allow custom backgrounds per boxclk config and from the clockbg module
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
let locale = require("locale");
|
let locale = require("locale");
|
||||||
let widgets = require("widget_utils");
|
let widgets = require("widget_utils");
|
||||||
let date = new Date();
|
let date = new Date();
|
||||||
|
let bgImage;
|
||||||
let configNumber = (storage.readJSON("boxclk.json", 1) || {}).selectedConfig || 0;
|
let configNumber = (storage.readJSON("boxclk.json", 1) || {}).selectedConfig || 0;
|
||||||
let fileName = 'boxclk' + (configNumber > 0 ? `-${configNumber}` : '') + '.json';
|
let fileName = 'boxclk' + (configNumber > 0 ? `-${configNumber}` : '') + '.json';
|
||||||
// Add a condition to check if the file exists, if it does not, default to 'boxclk.json'
|
// Add a condition to check if the file exists, if it does not, default to 'boxclk.json'
|
||||||
|
|
@ -71,6 +72,14 @@
|
||||||
* ---------------------------------------------------------------
|
* ---------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
for (let key in boxesConfig) {
|
||||||
|
if (key === 'bg' && boxesConfig[key].img) {
|
||||||
|
bgImage = storage.read(boxesConfig[key].img);
|
||||||
|
} else if (key !== 'selectedConfig') {
|
||||||
|
boxes[key] = Object.assign({}, boxesConfig[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let boxKeys = Object.keys(boxes);
|
let boxKeys = Object.keys(boxes);
|
||||||
|
|
||||||
boxKeys.forEach((key) => {
|
boxKeys.forEach((key) => {
|
||||||
|
|
@ -211,14 +220,21 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
let draw = (function() {
|
let draw = (function() {
|
||||||
let updatePerMinute = true; // variable to track the state of time display
|
let updatePerMinute = true;
|
||||||
|
|
||||||
return function(boxes) {
|
return function(boxes) {
|
||||||
date = new Date();
|
date = new Date();
|
||||||
g.clear();
|
g.clear();
|
||||||
background.fillRect(Bangle.appRect);
|
|
||||||
|
// Always draw background for full screen
|
||||||
|
if (bgImage) {
|
||||||
|
g.drawImage(bgImage, 0, 0);
|
||||||
|
} else {
|
||||||
|
background.fillRect(0, 0, g.getWidth(), g.getHeight());
|
||||||
|
}
|
||||||
|
|
||||||
if (boxes.time) {
|
if (boxes.time) {
|
||||||
boxes.time.string = modString(boxes.time, locale.time(date, isBool(boxes.time.short, true) ? 1 : 0));
|
boxes.time.string = modString(boxes.time, locale.time(date, isBool(boxes.time.short, true) ? 1 : 0).trim());
|
||||||
updatePerMinute = isBool(boxes.time.short, true);
|
updatePerMinute = isBool(boxes.time.short, true);
|
||||||
}
|
}
|
||||||
if (boxes.meridian) {
|
if (boxes.meridian) {
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 7.3 KiB |
Loading…
Reference in New Issue