mirror of https://github.com/espruino/BangleApps
Fix merge conflicts
parent
2707a1206e
commit
37f3e10008
|
@ -6,11 +6,7 @@ Box Clock is a customizable clock app for Bangle.js 2 that features an interacti
|
||||||
|
|
||||||
__Drag & Drop:__
|
__Drag & Drop:__
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
This intuitive feature allows you to reposition any element (box) on the clock face with ease. Tap on the box(s) you want to move and the border will show, drag into position and tap outside of the boxes to finish placing.
|
This intuitive feature allows you to reposition any element (box) on the clock face with ease. Tap on the box(s) you want to move and the border will show, drag into position and tap outside of the boxes to finish placing.
|
||||||
=======
|
|
||||||
This intuitive feature allows you to reposition any element (box) on the clock face with ease. Tap on the box(s) you want to move and the border will show, drag into position and tap outside of the boxes to finish placing. **Note:** Roll the tip of your finger slowly on the screen for fine adjustments.
|
|
||||||
>>>>>>> ba7a2f79968ed26d3caa8ac2821e07856369e60e
|
|
||||||
|
|
||||||
__Double Tap to Save:__
|
__Double Tap to Save:__
|
||||||
|
|
||||||
|
@ -18,7 +14,6 @@ After you've found the perfect position for your boxes, you can save their posit
|
||||||
|
|
||||||
__JSON Configuration:__
|
__JSON Configuration:__
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
Each box can be customized extensively via a simple JSON configuration. You can also add a custom text string to your configuration with the "string" attribute. Here's what an example configuration might look like:
|
Each box can be customized extensively via a simple JSON configuration. You can also add a custom text string to your configuration with the "string" attribute. Here's what an example configuration might look like:
|
||||||
|
|
||||||
## Config File Structure
|
## Config File Structure
|
||||||
|
@ -26,17 +21,6 @@ Each box can be customized extensively via a simple JSON configuration. You can
|
||||||
```
|
```
|
||||||
{
|
{
|
||||||
"customBox": {
|
"customBox": {
|
||||||
=======
|
|
||||||
Each box can be customized extensively via a simple JSON configuration. You can add a custom text string to your configuration with the "string" parameter and you can match system theme colors by using "fg", "bg", "fg2", "bg2", "fgH", or "bgH" for any of the color parameters.
|
|
||||||
|
|
||||||
## Config File Structure
|
|
||||||
|
|
||||||
Here's what an example configuration might look like:
|
|
||||||
|
|
||||||
```
|
|
||||||
{
|
|
||||||
"customBox": { //
|
|
||||||
>>>>>>> ba7a2f79968ed26d3caa8ac2821e07856369e60e
|
|
||||||
"string": "Your text here",
|
"string": "Your text here",
|
||||||
"font": "CustomFont", // Custom fonts must be removed in setUI
|
"font": "CustomFont", // Custom fonts must be removed in setUI
|
||||||
"fontSize": 1,
|
"fontSize": 1,
|
||||||
|
@ -48,7 +32,6 @@ Here's what an example configuration might look like:
|
||||||
"yPadding": -4,
|
"yPadding": -4,
|
||||||
"xOffset": 0,
|
"xOffset": 0,
|
||||||
"yOffset": 3,
|
"yOffset": 3,
|
||||||
<<<<<<< HEAD
|
|
||||||
"boxPos": { "x": 0.5, "y": 0.5 },
|
"boxPos": { "x": 0.5, "y": 0.5 },
|
||||||
"prefix": "", // Adds a string to the beginning of the main string
|
"prefix": "", // Adds a string to the beginning of the main string
|
||||||
"suffix": "", // Adds a string to the end of the main string
|
"suffix": "", // Adds a string to the end of the main string
|
||||||
|
@ -57,20 +40,11 @@ Here's what an example configuration might look like:
|
||||||
|
|
||||||
},
|
},
|
||||||
"bg": { // Can also be removed for no backround
|
"bg": { // Can also be removed for no backround
|
||||||
=======
|
|
||||||
"boxPos": { "x": 0.5, "y": 0.5 }
|
|
||||||
},
|
|
||||||
"bg": { // Can also be removed for no background
|
|
||||||
>>>>>>> ba7a2f79968ed26d3caa8ac2821e07856369e60e
|
|
||||||
"img": "YourImageName.img"
|
"img": "YourImageName.img"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
<<<<<<< HEAD
|
|
||||||
* **Box Name:** The name of your text box. The app includes functional support for "time", "date", "meridian", "dow" (Day of Week), "batt" (Battery), and "step" (Step count). You can add additional custom boxes with unique titles.
|
* **Box Name:** The name of your text box. The app includes functional support for "time", "date", "meridian", "dow" (Day of Week), "batt" (Battery), and "step" (Step count). You can add additional custom boxes with unique titles.
|
||||||
=======
|
|
||||||
__Breakdown of Parameters:__
|
|
||||||
>>>>>>> ba7a2f79968ed26d3caa8ac2821e07856369e60e
|
|
||||||
|
|
||||||
* **string:** The text string to be displayed inside the box.
|
* **string:** The text string to be displayed inside the box.
|
||||||
|
|
||||||
|
@ -92,7 +66,6 @@ __Breakdown of Parameters:__
|
||||||
|
|
||||||
* **boxPos:** Initial position of the box on the screen. Values are fractions of the screen width (x) and height (y), so { "x": 0.5, "y": 0.5 } would be in the middle of the screen.
|
* **boxPos:** Initial position of the box on the screen. Values are fractions of the screen width (x) and height (y), so { "x": 0.5, "y": 0.5 } would be in the middle of the screen.
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
* **prefix:** Adds a string to the beginning of the main string. For example, you can set "prefix": "Steps: " to display "Steps: 100" for the step count.
|
* **prefix:** Adds a string to the beginning of the main string. For example, you can set "prefix": "Steps: " to display "Steps: 100" for the step count.
|
||||||
|
|
||||||
* **suffix:** Adds a string to the end of the main string. For example, you can set "suffix": "%" to display "80%" for the battery percentage.
|
* **suffix:** Adds a string to the end of the main string. For example, you can set "suffix": "%" to display "80%" for the battery percentage.
|
||||||
|
@ -101,8 +74,6 @@ __Breakdown of Parameters:__
|
||||||
|
|
||||||
* **short:** Set to false to get the long format value of time, meridian, date, or DayOfWeek. Short formats are used by default,
|
* **short:** Set to false to get the long format value of time, meridian, date, or DayOfWeek. Short formats are used by default,
|
||||||
|
|
||||||
=======
|
|
||||||
>>>>>>> ba7a2f79968ed26d3caa8ac2821e07856369e60e
|
|
||||||
* **bg:** This specifies a custom background image, with the img property defining the name of the image file on the Bangle.js storage.
|
* **bg:** This specifies a custom background image, with the img property defining the name of the image file on the Bangle.js storage.
|
||||||
|
|
||||||
## Multiple Configurations
|
## Multiple Configurations
|
||||||
|
|
|
@ -33,10 +33,6 @@
|
||||||
let w = g.getWidth();
|
let w = g.getWidth();
|
||||||
let h = g.getHeight();
|
let h = g.getHeight();
|
||||||
let totalWidth, totalHeight;
|
let totalWidth, totalHeight;
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
let enableSuffix = true;
|
|
||||||
>>>>>>> ba7a2f79968ed26d3caa8ac2821e07856369e60e
|
|
||||||
let drawTimeout;
|
let drawTimeout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -168,7 +164,6 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ---------------------------------------------------------------
|
* ---------------------------------------------------------------
|
||||||
<<<<<<< HEAD
|
|
||||||
* 7. String forming helper functions
|
* 7. String forming helper functions
|
||||||
* ---------------------------------------------------------------
|
* ---------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -180,15 +175,6 @@
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
const dayOfMonth = date.getDate();
|
const dayOfMonth = date.getDate();
|
||||||
const month = short ? locale.month(date, 0) : locale.month(date, 1);
|
const month = short ? locale.month(date, 0) : locale.month(date, 1);
|
||||||
=======
|
|
||||||
* 7. Date and time related functions
|
|
||||||
* ---------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
let getDate = function() {
|
|
||||||
const date = new Date();
|
|
||||||
const dayOfMonth = date.getDate();
|
|
||||||
const month = locale.month(date, 1);
|
|
||||||
>>>>>>> ba7a2f79968ed26d3caa8ac2821e07856369e60e
|
|
||||||
const year = date.getFullYear();
|
const year = date.getFullYear();
|
||||||
let suffix;
|
let suffix;
|
||||||
if ([1, 21, 31].includes(dayOfMonth)) {
|
if ([1, 21, 31].includes(dayOfMonth)) {
|
||||||
|
@ -200,7 +186,6 @@
|
||||||
} else {
|
} else {
|
||||||
suffix = "th";
|
suffix = "th";
|
||||||
}
|
}
|
||||||
<<<<<<< HEAD
|
|
||||||
let dayOfMonthStr = short ? dayOfMonth : (disableSuffix ? dayOfMonth : dayOfMonth + suffix);
|
let dayOfMonthStr = short ? dayOfMonth : (disableSuffix ? dayOfMonth : dayOfMonth + suffix);
|
||||||
return month + " " + dayOfMonthStr + (short ? '' : (", " + year)); // not including year for short version
|
return month + " " + dayOfMonthStr + (short ? '' : (", " + year)); // not including year for short version
|
||||||
};
|
};
|
||||||
|
@ -219,14 +204,6 @@
|
||||||
let prefix = boxItem.prefix || '';
|
let prefix = boxItem.prefix || '';
|
||||||
let suffix = boxItem.suffix || '';
|
let suffix = boxItem.suffix || '';
|
||||||
return prefix + data + suffix;
|
return prefix + data + suffix;
|
||||||
=======
|
|
||||||
let dayOfMonthStr = enableSuffix ? dayOfMonth + suffix : dayOfMonth;
|
|
||||||
return month + " " + dayOfMonthStr + ", " + year;
|
|
||||||
};
|
|
||||||
|
|
||||||
let getDayOfWeek = function(date) {
|
|
||||||
return locale.dow(date, 0);
|
|
||||||
>>>>>>> ba7a2f79968ed26d3caa8ac2821e07856369e60e
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -234,7 +211,6 @@
|
||||||
* 8. Main draw function
|
* 8. Main draw function
|
||||||
* ---------------------------------------------------------------
|
* ---------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
<<<<<<< HEAD
|
|
||||||
let draw = (function() {
|
let draw = (function() {
|
||||||
let updatePerMinute = true; // variable to track the state of time display
|
let updatePerMinute = true; // variable to track the state of time display
|
||||||
|
|
||||||
|
@ -285,46 +261,6 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
=======
|
|
||||||
let draw = function(boxes) {
|
|
||||||
date = new Date();
|
|
||||||
g.clear();
|
|
||||||
if (bgImage) {
|
|
||||||
g.drawImage(bgImage, 0, 0);
|
|
||||||
}
|
|
||||||
if (boxes.time) {
|
|
||||||
boxes.time.string = locale.time(date, 1);
|
|
||||||
}
|
|
||||||
if (boxes.date) {
|
|
||||||
boxes.date.string = getDate();
|
|
||||||
}
|
|
||||||
if (boxes.dow) {
|
|
||||||
boxes.dow.string = getDayOfWeek(date);
|
|
||||||
}
|
|
||||||
if (boxes.batt) {
|
|
||||||
boxes.batt.string = E.getBattery() + "%";
|
|
||||||
}
|
|
||||||
boxKeys.forEach((boxKey) => {
|
|
||||||
let boxItem = boxes[boxKey];
|
|
||||||
calcBoxSize(boxItem);
|
|
||||||
const pos = calcBoxPos(boxKey);
|
|
||||||
if (isDragging[boxKey]) {
|
|
||||||
g.setColor(boxItem.border);
|
|
||||||
g.drawRect(pos.x1, pos.y1, pos.x2, pos.y2);
|
|
||||||
}
|
|
||||||
g.drawString(
|
|
||||||
boxItem,
|
|
||||||
boxItem.string,
|
|
||||||
boxPos[boxKey].x + boxItem.xOffset,
|
|
||||||
boxPos[boxKey].y + boxItem.yOffset
|
|
||||||
);
|
|
||||||
});
|
|
||||||
if (!Object.values(isDragging).some(Boolean)) {
|
|
||||||
if (drawTimeout) clearTimeout(drawTimeout);
|
|
||||||
drawTimeout = setTimeout(() => draw(boxes), 60000 - (Date.now() % 60000));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
>>>>>>> ba7a2f79968ed26d3caa8ac2821e07856369e60e
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ---------------------------------------------------------------
|
* ---------------------------------------------------------------
|
||||||
|
|
|
@ -23,12 +23,8 @@
|
||||||
"yPadding": 0.5,
|
"yPadding": 0.5,
|
||||||
"xOffset": 1,
|
"xOffset": 1,
|
||||||
"yOffset": 1,
|
"yOffset": 1,
|
||||||
<<<<<<< HEAD
|
|
||||||
"boxPos": { "x": 0.633, "y": 0.3 },
|
"boxPos": { "x": 0.633, "y": 0.3 },
|
||||||
"short": false
|
"short": false
|
||||||
=======
|
|
||||||
"boxPos": { "x": 0.633, "y": 0.3 }
|
|
||||||
>>>>>>> ba7a2f79968ed26d3caa8ac2821e07856369e60e
|
|
||||||
},
|
},
|
||||||
"date": {
|
"date": {
|
||||||
"font": "6x8",
|
"font": "6x8",
|
||||||
|
@ -41,12 +37,8 @@
|
||||||
"yPadding": 0.5,
|
"yPadding": 0.5,
|
||||||
"xOffset": 1,
|
"xOffset": 1,
|
||||||
"yOffset": 1,
|
"yOffset": 1,
|
||||||
<<<<<<< HEAD
|
|
||||||
"boxPos": { "x": 0.633, "y": 0.39 },
|
"boxPos": { "x": 0.633, "y": 0.39 },
|
||||||
"short": false
|
"short": false
|
||||||
=======
|
|
||||||
"boxPos": { "x": 0.633, "y": 0.39 }
|
|
||||||
>>>>>>> ba7a2f79968ed26d3caa8ac2821e07856369e60e
|
|
||||||
},
|
},
|
||||||
"batt": {
|
"batt": {
|
||||||
"font": "4x6",
|
"font": "4x6",
|
||||||
|
@ -59,12 +51,8 @@
|
||||||
"yPadding": -0.5,
|
"yPadding": -0.5,
|
||||||
"xOffset": 2,
|
"xOffset": 2,
|
||||||
"yOffset": 1,
|
"yOffset": 1,
|
||||||
<<<<<<< HEAD
|
|
||||||
"boxPos": { "x": 0.92, "y": 0.95 },
|
"boxPos": { "x": 0.92, "y": 0.95 },
|
||||||
"suffix": "%"
|
"suffix": "%"
|
||||||
=======
|
|
||||||
"boxPos": { "x": 0.92, "y": 0.95 }
|
|
||||||
>>>>>>> ba7a2f79968ed26d3caa8ac2821e07856369e60e
|
|
||||||
},
|
},
|
||||||
"bg": {
|
"bg": {
|
||||||
"img": "boxclk.beachhouse.img"
|
"img": "boxclk.beachhouse.img"
|
||||||
|
|
|
@ -32,19 +32,11 @@
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
let configFiles = [];
|
let configFiles = [];
|
||||||
storage.list().forEach(file => {
|
storage.list().forEach(file => {
|
||||||
let match = file.match(fileRegex);
|
let match = file.match(fileRegex);
|
||||||
if (match) {
|
if (match) {
|
||||||
configFiles.push({ file: file, number: parseInt(match[1]) });
|
configFiles.push({ file: file, number: parseInt(match[1]) });
|
||||||
=======
|
|
||||||
storage.list().forEach(file => {
|
|
||||||
let match = file.match(fileRegex);
|
|
||||||
if (match) {
|
|
||||||
let configNumber = match[1];
|
|
||||||
configs[configNumber] = handleSelection(configNumber);
|
|
||||||
>>>>>>> ba7a2f79968ed26d3caa8ac2821e07856369e60e
|
|
||||||
} else if (file === "boxclk.json") {
|
} else if (file === "boxclk.json") {
|
||||||
hasDefaultConfig = true;
|
hasDefaultConfig = true;
|
||||||
let defaultConfig = storage.readJSON(file, 1);
|
let defaultConfig = storage.readJSON(file, 1);
|
||||||
|
@ -64,7 +56,6 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
// Sort the config files by number
|
// Sort the config files by number
|
||||||
configFiles.sort((a, b) => a.number - b.number);
|
configFiles.sort((a, b) => a.number - b.number);
|
||||||
|
|
||||||
|
@ -72,8 +63,6 @@
|
||||||
configs[configFile.number] = handleSelection(configFile.number);
|
configs[configFile.number] = handleSelection(configFile.number);
|
||||||
});
|
});
|
||||||
|
|
||||||
=======
|
|
||||||
>>>>>>> ba7a2f79968ed26d3caa8ac2821e07856369e60e
|
|
||||||
if (!selectedConfig) {
|
if (!selectedConfig) {
|
||||||
if (hasDefaultConfig) {
|
if (hasDefaultConfig) {
|
||||||
selectedConfig = "Default";
|
selectedConfig = "Default";
|
||||||
|
@ -102,8 +91,4 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
E.showMenu(menu);
|
E.showMenu(menu);
|
||||||
<<<<<<< HEAD
|
|
||||||
})();
|
|
||||||
=======
|
|
||||||
});
|
});
|
||||||
>>>>>>> ba7a2f79968ed26d3caa8ac2821e07856369e60e
|
|
||||||
|
|
Loading…
Reference in New Issue