Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Le-Kat committed Mar 31, 2024
2 parents ed3d0da + ec9f9ce commit a444a53
Show file tree
Hide file tree
Showing 66 changed files with 1,659 additions and 291 deletions.
15 changes: 6 additions & 9 deletions apps/activityreminder/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,13 @@ exports.loadData = function () {
dismissDate: new Date(1970),
pauseDate: new Date(1970),
},
require("Storage").readJSON("activityreminder.data.json") || {});

require("Storage").readJSON("activityreminder.data.json") || {});

if (typeof (data.stepsDate) == "string")
data.stepsDate = new Date(data.stepsDate);
if (typeof (data.okDate) == "string")
data.okDate = new Date(data.okDate);
if (typeof (data.dismissDate) == "string")
data.dismissDate = new Date(data.dismissDate);
if (typeof (data.pauseDate) == "string")
data.pauseDate = new Date(data.pauseDate);
data.stepsDate = new Date(typeof data.stepsDate === 'string' ? data.stepsDate : data.stepsDate.ms);
data.okDate = new Date(typeof data.okDate === 'string' ? data.okDate : data.okDate.ms);
data.dismissDate = new Date(typeof data.dismissDate === 'string' ? data.dismissDate : data.dismissDate.ms);
data.pauseDate = new Date(typeof data.pauseDate === 'string' ? data.pauseDate : data.pauseDate.ms);

return data;
};
1 change: 1 addition & 0 deletions apps/alarm/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@
0.44: Add "delete timer after expiration" setting to events.
0.45: Fix new alarm when selectedAlarm is undefined
0.46: Show alarm groups if the Show Group setting is ON. Scroll alarms menu back to previous position when getting back to it.
0.47: Fix wrap around when snoozed through midnight
4 changes: 3 additions & 1 deletion apps/alarm/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ const iconTimerOff = "\0" + (g.theme.dark

// An array of alarm objects (see sched/README.md)
var alarms = require("sched").getAlarms();
// Fix possible wrap around in existing alarms #3281, broken alarms still needs to be saved to get fixed
alarms.forEach(e => e.t %= 86400000); // This can probably be removed in the future when we are sure there are no more broken alarms

function handleFirstDayOfWeek(dow) {
if (firstDayOfWeek == 1) {
Expand Down Expand Up @@ -497,7 +499,7 @@ function showEditTimerMenu(selectedTimer, timerIndex) {

function prepareTimerForSave(timer, timerIndex, time, temp) {
timer.timer = require("time_utils").encodeTime(time);
timer.t = require("time_utils").getCurrentTimeMillis() + timer.timer;
timer.t = (require("time_utils").getCurrentTimeMillis() + timer.timer) % 86400000;
timer.last = 0;

if (!temp) {
Expand Down
2 changes: 1 addition & 1 deletion apps/alarm/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "alarm",
"name": "Alarms & Timers",
"shortName": "Alarms",
"version": "0.46",
"version": "0.47",
"description": "Set alarms and timers on your Bangle",
"icon": "app.png",
"tags": "tool,alarm",
Expand Down
4 changes: 4 additions & 0 deletions apps/binaryclk/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
0.03: Added setting for fullscreen option
0.04: Added settings to hide unused squares and show date
0.05: Minor code improvements
0.06: Added setting to show battery and added artwork to date
0.07: Removed percentage from battery and cleaned up logic
0.08: Changed month to day and text color to black on date
0.09: Changed day color back to white
60 changes: 51 additions & 9 deletions apps/binaryclk/app.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
var settings = Object.assign({
fullscreen: false,
fullscreen: true,
hidesq: false,
showdate: false,
showdate: true,
showbat: true,
}, require('Storage').readJSON("binaryclk.json", true) || {});

function draw() {

var cnt = 0;
var dt = new Date();
var h = dt.getHours(), m = dt.getMinutes(), d = dt.getDate();
var h = dt.getHours();
var m = dt.getMinutes();
var d = dt.getDate();
var day = dt.toString().substring(0,3);
const t = [];

t[0] = Math.floor(h/10);
Expand All @@ -19,15 +24,16 @@ function draw() {
g.clearRect(Bangle.appRect);

let i = 0;
var gap = 8;
var mgn = 20;
var gap = 4;
var mgn = 24;
var sq = 33;

if (settings.fullscreen) {
gap = 12;
gap = 8;
mgn = 0;
sq = 34;
}

const sq = 29;
var pos = sq + gap;

for (let r = 3; r >= 0; r--) {
Expand All @@ -53,11 +59,47 @@ function draw() {
g.clearRect(Math.floor(mgn/2), mgn, Math.floor(mgn/2) + pos, mgn + c1sqhide * pos);
g.clearRect(Math.floor(mgn/2) + 2 * pos + gap, mgn, Math.floor(mgn/2) + 3 * pos, mgn + c3sqhide * pos);
}

if (settings.showdate) {
g.setFontAlign(0, 0);
g.setColor(-1).fillRect(Math.floor(mgn/2) + gap, mgn + gap, Math.floor(mgn/2) + gap + sq, mgn + gap + sq);
g.setColor('#FF0000').fillRect(Math.floor(mgn/2) + gap, mgn + gap, Math.floor(mgn/2) + gap + sq, mgn + gap + 12);
g.setFontAlign(0, -1);
g.setFont("Vector",12);
g.setColor(-1).drawString(day, Math.ceil(mgn/2) + gap + Math.ceil(sq/2) + 1, mgn + gap + 1);
g.setFontAlign(0, 1);
g.setFont("Vector",20);
g.setColor(1).drawString(d, Math.ceil(mgn/2) + gap + Math.ceil(sq/2) + 1, mgn + gap + sq + 2);
if (g.theme.dark) {
g.setColor(-1);
} else {
g.setColor(1);
g.drawLine(Math.floor(mgn/2) + gap, mgn + gap + 13, Math.floor(mgn/2) + gap + sq, mgn + gap + 13);
}
g.drawRect(Math.floor(mgn/2) + gap, mgn + gap, Math.floor(mgn/2) + gap + sq, mgn + gap + sq);
g.drawString(d, Math.ceil(mgn/2) + gap + Math.ceil(sq/2) + 1, mgn + gap + Math.ceil(sq/2) + 1);
}

if (cnt == 0) {
if (settings.showbat) {
var bat = E.getBattery();
if (bat < 20) {
g.setColor('#FF0000');
} else if (bat < 40) {
g.setColor('#FFA500');
} else {
g.setColor('#00FF00');
}
g.fillRect(Math.floor(mgn/2) + gap + 2 * pos, mgn + gap, Math.floor(mgn/2) + gap + 2 * pos + Math.floor(bat * sq / 100), mgn + gap + sq);
if (g.theme.dark) {
g.setColor(-1);
} else {
g.setColor(1);
}
g.drawRect(Math.floor(mgn/2) + gap + 2 * pos, mgn + gap, Math.floor(mgn/2) + gap + 2 * pos + sq, mgn + gap + sq);
}
cnt++;
if (cnt > 599999) {
cnt = 0;
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions apps/binaryclk/metadata.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"id": "binaryclk",
"name": "Bin Clock",
"version": "0.05",
"description": "Clock face to show binary time in 24 hour format",
"version": "0.09",
"description": "Binary clock with date and battery",
"icon": "app-icon.png",
"screenshots": [{"url":"screenshot.png"}],
"type": "clock",
Expand Down
Binary file modified apps/binaryclk/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions apps/binaryclk/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
fullscreen: false,
hidesq: false,
showdate: false,
showbat: false,
}, require('Storage').readJSON(FILE, true) || {});

function writeSettings() {
Expand Down Expand Up @@ -34,5 +35,12 @@
writeSettings();
},
},
'Show Battery': {
value: settings.showbat,
onchange: v => {
settings.showbat = v;
writeSettings();
},
},
});
})
1 change: 1 addition & 0 deletions apps/clock_info/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
0.06: When >1 clockinfo, swiping one back tries to ensure they don't display the same thing
0.07: Developer tweak: clkinfo load errors are emitted
0.08: Pass options to show(), hide() and run(), and add focus() and blur() item methods
0.09: Save clkinfo settings on kill and remove
13 changes: 9 additions & 4 deletions apps/clock_info/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,13 @@ exports.addInteractive = function(menu, options) {
options.menuB = b;
}
}
const save = () => {
// save the currently showing clock_info
const settings = exports.loadSettings();
settings.apps[appName] = {a:options.menuA, b:options.menuB};
require("Storage").writeJSON("clock_info.json",settings);
};
E.on("kill", save);

if (options.menuA===undefined) options.menuA = 0;
if (options.menuB===undefined) options.menuB = Math.min(exports.loadCount, menu[options.menuA].items.length)-1;
Expand Down Expand Up @@ -276,10 +283,6 @@ exports.addInteractive = function(menu, options) {
oldMenuItem.removeAllListeners("draw");
menuShowItem(menu[options.menuA].items[options.menuB]);
}
// save the currently showing clock_info
let settings = exports.loadSettings();
settings.apps[appName] = {a:options.menuA,b:options.menuB};
require("Storage").writeJSON("clock_info.json",settings);
// On 2v18+ firmware we can stop other event handlers from being executed since we handled this
E.stopEventPropagation&&E.stopEventPropagation();
}
Expand Down Expand Up @@ -333,6 +336,8 @@ exports.addInteractive = function(menu, options) {
menuShowItem(menu[options.menuA].items[options.menuB]);
// return an object with info that can be used to remove the info
options.remove = function() {
save();
E.removeListener("kill", save);
Bangle.removeListener("swipe",swipeHandler);
if (touchHandler) Bangle.removeListener("touch",touchHandler);
if (lockHandler) Bangle.removeListener("lock", lockHandler);
Expand Down
2 changes: 1 addition & 1 deletion apps/clock_info/metadata.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ "id": "clock_info",
"name": "Clock Info Module",
"shortName": "Clock Info",
"version":"0.08",
"version":"0.09",
"description": "A library used by clocks to provide extra information on the clock face (Altitude, BPM, etc)",
"icon": "app.png",
"type": "module",
Expand Down
2 changes: 2 additions & 0 deletions apps/elapsed_t/ChangeLog
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
0.01: New App!
0.02: Handle AM/PM time in the "set target" menu. Add yesterday/today/tomorrow when showing target date to improve readability.
27 changes: 27 additions & 0 deletions apps/elapsed_t/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Elapsed Time Clock
A clock that calculates the time difference between now (in blue/cyan) and any given target date (in red/orange).

The results is show in years, months, days, hours, minutes, seconds. To save battery life, the seconds are shown only when the watch is unlocked, or can be disabled entirely.

The time difference is positive if the target date is in the past and negative if it is in the future.

![Screenshot 1](screenshot1.png)
![Screenshot 2](screenshot2.png)
![Screenshot 3](screenshot3.png)
![Screenshot 4](screenshot4.png)

# Settings
## Time and date formats:
- time can be shown in 24h or in AM/PM format
- date can be shown in DD/MM/YYYY, MM/DD/YYYY or YYYY-MM-DD format

## Display years and months
You can select if the difference is shown with years, months and days, or just days.

# TODO
- add the option to set an alarm to the target date
- add an offset to said alarm (e.g. x hours/days... before/after)

# Author

paul-arg [github](https://github.com/paul-arg)
1 change: 1 addition & 0 deletions apps/elapsed_t/app-icon.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a444a53

Please sign in to comment.