diff --git a/apps/clockcal/ChangeLog b/apps/clockcal/ChangeLog index 6780313ce0..f2365fab73 100644 --- a/apps/clockcal/ChangeLog +++ b/apps/clockcal/ChangeLog @@ -8,3 +8,4 @@ 0.08: Fixed typo in settings.js for DRAGDOWN to make option work 0.09: You can now back out of the calendar using the button 0.10: Fix linter warnings +0.11: Added option to show prior weeks on clock calendar diff --git a/apps/clockcal/app.js b/apps/clockcal/app.js index 185f2adeaa..06436420ad 100644 --- a/apps/clockcal/app.js +++ b/apps/clockcal/app.js @@ -2,7 +2,8 @@ Bangle.setUI("clock"); Bangle.loadWidgets(); var s = Object.assign({ - CAL_ROWS: 4, //number of calendar rows.(weeks) Shouldn't exceed 5 when using widgets. + CAL_ROWS: 4, //total number of calendar rows.(weeks) Shouldn't exceed 5 when using widgets. + CAL_ROWS_PRIOR: 0, //number of calendar rows.(weeks) that show above the current week BUZZ_ON_BT: true, //2x slow buzz on disconnect, 2x fast buzz on connect. Will be extra widget eventually MODE24: true, //24h mode vs 12h mode FIRSTDAY: 6, //First day of the week: mo, tu, we, th, fr, sa, su @@ -178,7 +179,7 @@ function drawWatch() { const dow = (s.FIRSTDAY + d.getDay()) % 7; //MO=0, SU=6 const today = d.getDate(); var rD = new Date(d.getTime()); - rD.setDate(rD.getDate() - dow); + rD.setDate(rD.getDate() - dow - s.CAL_ROWS_PRIOR * 7); var rDate = rD.getDate(); g.setFontAlign(1, 1); for (var y = 1; y <= s.CAL_ROWS; y++) { @@ -187,7 +188,7 @@ function drawWatch() { bottomrightY = y * CELL_H + CAL_Y; g.setFont("Vector", 16); var fg = ((s.REDSUN && rD.getDay() == 0) || (s.REDSAT && rD.getDay() == 6)) ? '#f00' : '#fff'; - if (y == 1 && today == rDate) { + if (y == s.CAL_ROWS_PRIOR + 1 && today == rDate) { g.setColor('#0f0'); g.fillRect(bottomrightX - CELL_W + 1, bottomrightY - CELL_H - 1, bottomrightX, bottomrightY - 2); g.setColor('#000'); diff --git a/apps/clockcal/metadata.json b/apps/clockcal/metadata.json index b84b085756..189d68597d 100644 --- a/apps/clockcal/metadata.json +++ b/apps/clockcal/metadata.json @@ -1,7 +1,7 @@ { "id": "clockcal", "name": "Clock & Calendar", - "version": "0.10", + "version": "0.11", "description": "Clock with Calendar", "readme":"README.md", "icon": "app.png", diff --git a/apps/clockcal/settings.js b/apps/clockcal/settings.js index ddacb4a161..c3abe6f1c8 100644 --- a/apps/clockcal/settings.js +++ b/apps/clockcal/settings.js @@ -1,7 +1,8 @@ (function (back) { var FILE = "clockcal.json"; const defaults={ - CAL_ROWS: 4, //number of calendar rows.(weeks) Shouldn't exceed 5 when using widgets. + CAL_ROWS: 4, //total number of calendar rows.(weeks) Shouldn't exceed 5 when using widgets. + CAL_ROWS_PRIOR: 0, //number of calendar rows.(weeks) that show above the current week BUZZ_ON_BT: true, //2x slow buzz on disconnect, 2x fast buzz on connect. Will be extra widget eventually MODE24: true, //24h mode vs 12h mode FIRSTDAY: 6, //First day of the week: mo, tu, we, th, fr, sa, su @@ -39,6 +40,14 @@ writeSettings(); } }, + '#Cal Rows Prior': { + value: settings.CAL_ROWS_PRIOR, + min: 0, max: 4, + onchange: v => { + settings.CAL_ROWS_PRIOR = v; + writeSettings(); + } + }, 'Clock mode': { value: settings.MODE24, format: v => v ? "24h" : "12h",