From 6389b27d41577544a09719c96aad2f9d0138874d Mon Sep 17 00:00:00 2001 From: sir-indy <53864146+sir-indy@users.noreply.github.com> Date: Tue, 29 Mar 2022 10:51:29 +0100 Subject: [PATCH 01/21] Update pebble.app.js First stab at adding theme selection --- apps/pebble/pebble.app.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/pebble/pebble.app.js b/apps/pebble/pebble.app.js index 106e09b82..d4e9110b7 100644 --- a/apps/pebble/pebble.app.js +++ b/apps/pebble/pebble.app.js @@ -12,7 +12,7 @@ const SETTINGS_FILE = "pebble.json"; let settings; function loadSettings() { - settings = require("Storage").readJSON(SETTINGS_FILE,1)|| {'bg': '#0f0', 'color': 'Green'}; + settings = require("Storage").readJSON(SETTINGS_FILE,1)|| {'bg': '#0f0', 'color': 'Green', 'theme':'System'}; } var img = require("heatshrink").decompress(atob("oFAwkEogA/AH4A/AH4A/AH4A/AE8AAAoeXoAfeDQUBmcyD7A+Dh///8QD649CiAfaHwUvD4sEHy0DDYIfEICg+Cn4fHICY+DD4nxcgojOHwgfEIAYfRCIQaDD4ZAFD5r7DH4//kAfRCIZ/GAAnwD5p9DX44fTHgYSBf4ofVDAQEBl4fFUAgfOXoQzBgIfFBAIfPP4RAEAoYAB+cRiK/SG4h/WIBAfXIA7CBAAswD55AHn6fUIBMCD65AHl4gCmcziAfQQJqfQQJpiDgk0IDXxQLRAEECaBM+QgRYRYgUIA0CD4ggSQJiDCiAKBICszAAswD55AHABKBVD7BAFABIqBD5pAFABPxD55AOD6BADiIAJQAyxLABwf/gaAPAH4A/AH4ARA==")); @@ -107,6 +107,17 @@ function getSteps() { return '????'; } +function set_colors() { + if (settings.theme == 'Light') { + pass + } else if (settings.theme == 'Dark') { + pass + } else { + let color_bg = g.theme.bg + let color_fg = g.theme.fg + } +} + g.clear(); Bangle.loadWidgets(); /* @@ -116,6 +127,7 @@ Bangle.loadWidgets(); */ for (let wd of WIDGETS) {wd.draw=()=>{};wd.area="";} loadSettings(); +set_colors(); setInterval(draw, 15000); // refresh every 15s draw(); Bangle.setUI("clock"); From aba96398f17366634a5a84332b0e4dc462dbd486 Mon Sep 17 00:00:00 2001 From: sir-indy <53864146+sir-indy@users.noreply.github.com> Date: Tue, 29 Mar 2022 11:06:29 +0100 Subject: [PATCH 02/21] Update metadata.json Switched on allow emulator --- apps/pebble/metadata.json | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/pebble/metadata.json b/apps/pebble/metadata.json index 4295d7507..68f7d1465 100644 --- a/apps/pebble/metadata.json +++ b/apps/pebble/metadata.json @@ -11,6 +11,7 @@ "type": "clock", "tags": "clock", "supports": ["BANGLEJS", "BANGLEJS2"], + "allow_emulator": true, "storage": [ {"name":"pebble.app.js","url":"pebble.app.js"}, {"name":"pebble.settings.js","url":"pebble.settings.js"}, From 24689a7684dca116e1b8ffee8ed719726b9ca520 Mon Sep 17 00:00:00 2001 From: sir-indy <53864146+sir-indy@users.noreply.github.com> Date: Tue, 29 Mar 2022 12:39:55 +0100 Subject: [PATCH 03/21] Update pebble.settings.js --- apps/pebble/pebble.settings.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/pebble/pebble.settings.js b/apps/pebble/pebble.settings.js index ff408907d..95eecc7e3 100644 --- a/apps/pebble/pebble.settings.js +++ b/apps/pebble/pebble.settings.js @@ -2,7 +2,7 @@ const SETTINGS_FILE = "pebble.json"; // initialize with default settings... - let s = {'bg': '#0f0', 'color': 'Green'} + let s = {'bg': '#0f0', 'color': 'Green', 'theme':'System'} // ...and overwrite them with any saved values // This way saved values are preserved if a new version adds more settings @@ -20,6 +20,7 @@ var color_options = ['Green','Orange','Cyan','Purple','Red','Blue']; var bg_code = ['#0f0','#ff0','#0ff','#f0f','#f00','#00f']; + var theme_options = ['System', 'Light', 'Dark']; E.showMenu({ '': { 'title': 'Pebble Clock' }, @@ -33,6 +34,14 @@ s.bg = bg_code[v]; save(); }, + 'Theme': { + value: 0 | theme_options.indexOf(s.theme), + min: 0, max: theme_options.length - 1, + format: v => theme_options[v], + onchange: v => { + s.theme = theme_options[v]; + save(); + }, } }); }) From 358e8d18c804bb27e1d8307aba7b3a58692101fd Mon Sep 17 00:00:00 2001 From: sir-indy <53864146+sir-indy@users.noreply.github.com> Date: Tue, 29 Mar 2022 12:45:08 +0100 Subject: [PATCH 04/21] Update pebble.app.js --- apps/pebble/pebble.app.js | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/pebble/pebble.app.js b/apps/pebble/pebble.app.js index d4e9110b7..159bc2bf8 100644 --- a/apps/pebble/pebble.app.js +++ b/apps/pebble/pebble.app.js @@ -30,6 +30,8 @@ function draw() { let da = date.toString().split(" "); let timeStr = da[4].substr(0,5); const t = 6; + print('Theme'); + print(theme); // turn the warning on once we have dipped below 30% if (E.getBattery() < 30) @@ -44,7 +46,7 @@ function draw() { g.fillRect(0, 0, w, h2 - t); // contrast bar - g.setColor(g.theme.fg); + g.setColor(theme.fg); g.fillRect(0, h2 - t, w, h2); // day and steps @@ -65,11 +67,11 @@ function draw() { g.setFontLECO1976Regular42(); g.setFontAlign(0, -1); - g.setColor(!batteryWarning ? g.theme.fg : '#fff'); + g.setColor(!batteryWarning ? theme.fg : '#fff'); g.drawString(timeStr, w/2, h2 + 8); // contrast bar - g.setColor(g.theme.fg); + g.setColor(theme.fg); g.fillRect(0, h3, w, h3 + t); // the bottom @@ -83,11 +85,11 @@ function draw() { // at x,y width:wi thicknes:th function drawCalendar(x,y,wi,th,str) { - g.setColor(g.theme.fg); + g.setColor(theme.fg); g.fillRect(x, y, x + wi, y + wi); - g.setColor(g.theme.bg); + g.setColor(theme.bg); g.fillRect(x + th, y + th, x + wi - th, y + wi - th); - g.setColor(g.theme.fg); + g.setColor(theme.fg); let hook_t = 6; // first calendar hook, one third in @@ -107,15 +109,13 @@ function getSteps() { return '????'; } -function set_colors() { - if (settings.theme == 'Light') { - pass - } else if (settings.theme == 'Dark') { - pass - } else { - let color_bg = g.theme.bg - let color_fg = g.theme.fg - } +function loadThemeColors(style) { + if (style === "Dark") + theme = {fg: g.toColor(1,1,1), bg: g.toColor(0,0,0)}; + else if (style === "Light") + theme = {fg: g.toColor(0,0,0), bg: g.toColor(1,1,1)}; + else + theme = {fg: g.theme.fg, bg: g.theme.bg}; } g.clear(); @@ -127,7 +127,7 @@ Bangle.loadWidgets(); */ for (let wd of WIDGETS) {wd.draw=()=>{};wd.area="";} loadSettings(); -set_colors(); +loadThemeColors(settings.theme); setInterval(draw, 15000); // refresh every 15s draw(); Bangle.setUI("clock"); From 4658fb9743aa138d1cd6f7145f0ae2de25e05bbc Mon Sep 17 00:00:00 2001 From: sir-indy <53864146+sir-indy@users.noreply.github.com> Date: Tue, 29 Mar 2022 12:46:07 +0100 Subject: [PATCH 05/21] Update README.md --- apps/pebble/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/pebble/README.md b/apps/pebble/README.md index 4b0233781..15d2bd58c 100644 --- a/apps/pebble/README.md +++ b/apps/pebble/README.md @@ -4,7 +4,7 @@ * Designed specifically for Bangle 2 * A choice of 6 different background colous through its setting menu. Goto Settings, App/Widget settings, Pebble. -* Supports the Light and Dark themes +* Supports the Light and Dark themes (or set theme independently) * Uses pedometer widget to get latest step count * Dependant apps are installed when Pebble installs * Uses the whole screen, widgets are made invisible but still run in the background From f867c68340df0d3d2cc51ba58251c9684e2a5c1a Mon Sep 17 00:00:00 2001 From: sir-indy <53864146+sir-indy@users.noreply.github.com> Date: Tue, 29 Mar 2022 12:55:42 +0100 Subject: [PATCH 06/21] Update pebble.app.js --- apps/pebble/pebble.app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/pebble/pebble.app.js b/apps/pebble/pebble.app.js index 159bc2bf8..36bdf8c31 100644 --- a/apps/pebble/pebble.app.js +++ b/apps/pebble/pebble.app.js @@ -62,7 +62,7 @@ function draw() { // time // white on red for battery warning - g.setColor(!batteryWarning ? g.theme.bg : '#f00'); + g.setColor(!batteryWarning ? theme.bg : '#f00'); g.fillRect(0, h2, w, h3); g.setFontLECO1976Regular42(); From 2330f1f4642ec4912c35352c41db19d64743d3a8 Mon Sep 17 00:00:00 2001 From: sir-indy <53864146+sir-indy@users.noreply.github.com> Date: Tue, 29 Mar 2022 13:00:21 +0100 Subject: [PATCH 07/21] Update ChangeLog --- apps/pebble/ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/pebble/ChangeLog b/apps/pebble/ChangeLog index 0cba5a2b2..c2705b790 100644 --- a/apps/pebble/ChangeLog +++ b/apps/pebble/ChangeLog @@ -5,3 +5,4 @@ 0.05: Fix typo in settings - Purple 0.06: Added dependancy on Pedometer Widget 0.07: Fixed icon and ong file to 48x48 +0.08: Added theme options From 3d9a49a5fba15fa1275d9b6d8d9f927444ea2bad Mon Sep 17 00:00:00 2001 From: sir-indy <53864146+sir-indy@users.noreply.github.com> Date: Tue, 29 Mar 2022 13:00:36 +0100 Subject: [PATCH 08/21] Update metadata.json --- apps/pebble/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/pebble/metadata.json b/apps/pebble/metadata.json index 68f7d1465..eb049e78e 100644 --- a/apps/pebble/metadata.json +++ b/apps/pebble/metadata.json @@ -2,7 +2,7 @@ "id": "pebble", "name": "Pebble Clock", "shortName": "Pebble", - "version": "0.07", + "version": "0.08", "description": "A pebble style clock to keep the rebellion going", "dependencies": {"widpedom":"app"}, "readme": "README.md", From e3db453b44691cd7e84643a7eb612beb92fd06f3 Mon Sep 17 00:00:00 2001 From: sir-indy <53864146+sir-indy@users.noreply.github.com> Date: Tue, 29 Mar 2022 13:00:55 +0100 Subject: [PATCH 09/21] Update pebble.settings.js --- apps/pebble/pebble.settings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/pebble/pebble.settings.js b/apps/pebble/pebble.settings.js index 95eecc7e3..4e235791b 100644 --- a/apps/pebble/pebble.settings.js +++ b/apps/pebble/pebble.settings.js @@ -41,7 +41,7 @@ onchange: v => { s.theme = theme_options[v]; save(); - }, + } } }); }) From 62b3336e6aac21cbd75b978204f63a844936bb10 Mon Sep 17 00:00:00 2001 From: sir-indy <53864146+sir-indy@users.noreply.github.com> Date: Tue, 29 Mar 2022 13:10:48 +0100 Subject: [PATCH 10/21] Update pebble.settings.js --- apps/pebble/pebble.settings.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/pebble/pebble.settings.js b/apps/pebble/pebble.settings.js index 4e235791b..58715750d 100644 --- a/apps/pebble/pebble.settings.js +++ b/apps/pebble/pebble.settings.js @@ -33,7 +33,8 @@ s.color = color_options[v]; s.bg = bg_code[v]; save(); - }, + } + }, 'Theme': { value: 0 | theme_options.indexOf(s.theme), min: 0, max: theme_options.length - 1, From d8b49af3c844d3dcedee49dd52cf1e839db1850f Mon Sep 17 00:00:00 2001 From: sir-indy <53864146+sir-indy@users.noreply.github.com> Date: Tue, 29 Mar 2022 13:28:32 +0100 Subject: [PATCH 11/21] Update pebble.app.js Removed print statements from debugging --- apps/pebble/pebble.app.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/apps/pebble/pebble.app.js b/apps/pebble/pebble.app.js index 36bdf8c31..bbe2596ab 100644 --- a/apps/pebble/pebble.app.js +++ b/apps/pebble/pebble.app.js @@ -30,8 +30,6 @@ function draw() { let da = date.toString().split(" "); let timeStr = da[4].substr(0,5); const t = 6; - print('Theme'); - print(theme); // turn the warning on once we have dipped below 30% if (E.getBattery() < 30) From e60586f13824bbf0c2f9cfba5ed41931581f4ed5 Mon Sep 17 00:00:00 2001 From: sir-indy <53864146+sir-indy@users.noreply.github.com> Date: Tue, 29 Mar 2022 13:58:05 +0100 Subject: [PATCH 12/21] Update pebble.app.js Move day and steps color into loadThemeColors function. Added test lock icon --- apps/pebble/pebble.app.js | 46 +++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/apps/pebble/pebble.app.js b/apps/pebble/pebble.app.js index bbe2596ab..b6aab30d7 100644 --- a/apps/pebble/pebble.app.js +++ b/apps/pebble/pebble.app.js @@ -12,7 +12,7 @@ const SETTINGS_FILE = "pebble.json"; let settings; function loadSettings() { - settings = require("Storage").readJSON(SETTINGS_FILE,1)|| {'bg': '#0f0', 'color': 'Green', 'theme':'System'}; + settings = require("Storage").readJSON(SETTINGS_FILE,1)|| {'bg': '#0f0', 'color': 'Green', 'theme':'System', 'showlock':'false'}; } var img = require("heatshrink").decompress(atob("oFAwkEogA/AH4A/AH4A/AH4A/AE8AAAoeXoAfeDQUBmcyD7A+Dh///8QD649CiAfaHwUvD4sEHy0DDYIfEICg+Cn4fHICY+DD4nxcgojOHwgfEIAYfRCIQaDD4ZAFD5r7DH4//kAfRCIZ/GAAnwD5p9DX44fTHgYSBf4ofVDAQEBl4fFUAgfOXoQzBgIfFBAIfPP4RAEAoYAB+cRiK/SG4h/WIBAfXIA7CBAAswD55AHn6fUIBMCD65AHl4gCmcziAfQQJqfQQJpiDgk0IDXxQLRAEECaBM+QgRYRYgUIA0CD4ggSQJiDCiAKBICszAAswD55AHABKBVD7BAFABIqBD5pAFABPxD55AOD6BADiIAJQAyxLABwf/gaAPAH4A/AH4ARA==")); @@ -48,11 +48,11 @@ function draw() { g.fillRect(0, h2 - t, w, h2); // day and steps - if (settings.color == 'Blue' || settings.color == 'Red') - g.setColor('#fff'); // white on blue or red best contrast - else - g.setColor('#000'); // otherwise black regardless of theme - + //if (settings.color == 'Blue' || settings.color == 'Red') + // g.setColor('#fff'); // white on blue or red best contrast + //else + // g.setColor('#000'); // otherwise black regardless of theme + g.setColor(theme.day); g.setFontLECO1976Regular22(); g.setFontAlign(0, -1); g.drawString(da[0].toUpperCase(), w/4, ha); // day of week @@ -107,15 +107,33 @@ function getSteps() { return '????'; } -function loadThemeColors(style) { - if (style === "Dark") - theme = {fg: g.toColor(1,1,1), bg: g.toColor(0,0,0)}; - else if (style === "Light") - theme = {fg: g.toColor(0,0,0), bg: g.toColor(1,1,1)}; - else - theme = {fg: g.theme.fg, bg: g.theme.bg}; +function loadThemeColors() { + theme = {fg: g.theme.fg, bg: g.theme.bg, day: g.toColor(0,0,0)}; + if (settings.theme === "Dark") { + theme.fg = g.toColor(1,1,1); + theme.bg = g.toColor(0,0,0); + } + else if (settings.theme === "Light") { + theme.fg = g.toColor(0,0,0); + theme.bg = g.toColor(1,1,1); + } + // day and steps + if (settings.color == 'Blue' || settings.color == 'Red') + theme.day = g.toColor(1,1,1); // white on blue or red best contrast } +function drawLock(){ + if(Bangle.isLocked()){ + g.drawImage(atob("DhABH+D/wwMMDDAwwMf/v//4f+H/h/8//P/z///f/g=="), 1, 4); + } else { + g.clearRect(0, 0, 20, 20); + } +} + +Bangle.on('lock', function(isLocked) { + drawLock(); +}); + g.clear(); Bangle.loadWidgets(); /* @@ -125,7 +143,7 @@ Bangle.loadWidgets(); */ for (let wd of WIDGETS) {wd.draw=()=>{};wd.area="";} loadSettings(); -loadThemeColors(settings.theme); +loadThemeColors(); setInterval(draw, 15000); // refresh every 15s draw(); Bangle.setUI("clock"); From 7c697cf74939b4988879e78b9d14838a44994286 Mon Sep 17 00:00:00 2001 From: sir-indy <53864146+sir-indy@users.noreply.github.com> Date: Tue, 29 Mar 2022 14:06:58 +0100 Subject: [PATCH 13/21] Update pebble.app.js --- apps/pebble/pebble.app.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/pebble/pebble.app.js b/apps/pebble/pebble.app.js index b6aab30d7..b6576671c 100644 --- a/apps/pebble/pebble.app.js +++ b/apps/pebble/pebble.app.js @@ -79,6 +79,8 @@ function draw() { g.setColor(settings.bg); g.drawImage(img, w/2 + ((w/2) - 64)/2, 1, { scale: 1 }); drawCalendar(((w/2) - 42)/2, 14, 42, 4, da[2]); + + drawLock(); } // at x,y width:wi thicknes:th @@ -124,9 +126,11 @@ function loadThemeColors() { function drawLock(){ if(Bangle.isLocked()){ + g.setColor(theme.day); g.drawImage(atob("DhABH+D/wwMMDDAwwMf/v//4f+H/h/8//P/z///f/g=="), 1, 4); } else { - g.clearRect(0, 0, 20, 20); + g.setColor(settings.bg); + g.drawRect(0, 0, 20, 20); } } From 181db378678b2d51c216df462440b4f0f076bf3d Mon Sep 17 00:00:00 2001 From: sir-indy <53864146+sir-indy@users.noreply.github.com> Date: Tue, 29 Mar 2022 14:17:13 +0100 Subject: [PATCH 14/21] Update pebble.app.js --- apps/pebble/pebble.app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/pebble/pebble.app.js b/apps/pebble/pebble.app.js index b6576671c..e583f1706 100644 --- a/apps/pebble/pebble.app.js +++ b/apps/pebble/pebble.app.js @@ -130,11 +130,11 @@ function drawLock(){ g.drawImage(atob("DhABH+D/wwMMDDAwwMf/v//4f+H/h/8//P/z///f/g=="), 1, 4); } else { g.setColor(settings.bg); - g.drawRect(0, 0, 20, 20); + g.fillRect(0, 0, 20, 20); } } -Bangle.on('lock', function(isLocked) { +Bangle.on('lock', function(on) { drawLock(); }); From c8e90b1f926d432ce17bc07d8d8115d1e2c47363 Mon Sep 17 00:00:00 2001 From: sir-indy <53864146+sir-indy@users.noreply.github.com> Date: Tue, 29 Mar 2022 15:21:21 +0100 Subject: [PATCH 15/21] Update pebble.app.js --- apps/pebble/pebble.app.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/apps/pebble/pebble.app.js b/apps/pebble/pebble.app.js index e583f1706..28e32354a 100644 --- a/apps/pebble/pebble.app.js +++ b/apps/pebble/pebble.app.js @@ -125,12 +125,15 @@ function loadThemeColors() { } function drawLock(){ - if(Bangle.isLocked()){ - g.setColor(theme.day); - g.drawImage(atob("DhABH+D/wwMMDDAwwMf/v//4f+H/h/8//P/z///f/g=="), 1, 4); - } else { - g.setColor(settings.bg); - g.fillRect(0, 0, 20, 20); + if (settings.showlock == 'true') { + if (Bangle.isLocked()){ + g.setColor(theme.day); + g.setBgColor(settings.bg); + g.drawImage(atob("DhABH+D/wwMMDDAwwMf/v//4f+H/h/8//P/z///f/g=="), 1, 4); + } else { + g.setColor(settings.bg); + g.fillRect(0, 0, 20, 20); + } } } From abdd91b6f1bc84a3fdeb9d77f988aeaf2e5c9814 Mon Sep 17 00:00:00 2001 From: sir-indy <53864146+sir-indy@users.noreply.github.com> Date: Tue, 29 Mar 2022 15:24:13 +0100 Subject: [PATCH 16/21] Update pebble.settings.js --- apps/pebble/pebble.settings.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/pebble/pebble.settings.js b/apps/pebble/pebble.settings.js index 58715750d..3fbf72118 100644 --- a/apps/pebble/pebble.settings.js +++ b/apps/pebble/pebble.settings.js @@ -2,7 +2,7 @@ const SETTINGS_FILE = "pebble.json"; // initialize with default settings... - let s = {'bg': '#0f0', 'color': 'Green', 'theme':'System'} + let s = {'bg': '#0f0', 'color': 'Green', 'theme':'System', 'showlock':'false'} // ...and overwrite them with any saved values // This way saved values are preserved if a new version adds more settings @@ -21,6 +21,7 @@ var color_options = ['Green','Orange','Cyan','Purple','Red','Blue']; var bg_code = ['#0f0','#ff0','#0ff','#f0f','#f00','#00f']; var theme_options = ['System', 'Light', 'Dark']; + var lock_options = ['false', 'true']; E.showMenu({ '': { 'title': 'Pebble Clock' }, @@ -43,6 +44,15 @@ s.theme = theme_options[v]; save(); } + }, + 'Show Lock': { + value: 0 | lock_options.indexOf(s.showlock), + min: 0, max: lock_options.length - 1, + format: v => lock_options[v], + onchange: v => { + s.showlock = lock_options[v]; + save(); + } } }); }) From 4d6773c022c08cbbb337ef4e6eac03a859270ddc Mon Sep 17 00:00:00 2001 From: sir-indy <53864146+sir-indy@users.noreply.github.com> Date: Tue, 29 Mar 2022 15:27:34 +0100 Subject: [PATCH 17/21] Update pebble.settings.js --- apps/pebble/pebble.settings.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/apps/pebble/pebble.settings.js b/apps/pebble/pebble.settings.js index 3fbf72118..8a5fba63b 100644 --- a/apps/pebble/pebble.settings.js +++ b/apps/pebble/pebble.settings.js @@ -2,7 +2,7 @@ const SETTINGS_FILE = "pebble.json"; // initialize with default settings... - let s = {'bg': '#0f0', 'color': 'Green', 'theme':'System', 'showlock':'false'} + let s = {'bg': '#0f0', 'color': 'Green', 'theme':'System', 'showlock':false} // ...and overwrite them with any saved values // This way saved values are preserved if a new version adds more settings @@ -21,7 +21,6 @@ var color_options = ['Green','Orange','Cyan','Purple','Red','Blue']; var bg_code = ['#0f0','#ff0','#0ff','#f0f','#f00','#00f']; var theme_options = ['System', 'Light', 'Dark']; - var lock_options = ['false', 'true']; E.showMenu({ '': { 'title': 'Pebble Clock' }, @@ -46,13 +45,12 @@ } }, 'Show Lock': { - value: 0 | lock_options.indexOf(s.showlock), - min: 0, max: lock_options.length - 1, - format: v => lock_options[v], - onchange: v => { - s.showlock = lock_options[v]; + value: settings.showlock, + format: () => (settings.showlock ? 'Yes' : 'No'), + onchange: () => { + settings.showlock = !settings.showlock; save(); } - } + }, }); }) From 01a868155ebc5dd59eec5b52e70d5875b21b43b6 Mon Sep 17 00:00:00 2001 From: sir-indy <53864146+sir-indy@users.noreply.github.com> Date: Tue, 29 Mar 2022 15:28:42 +0100 Subject: [PATCH 18/21] Update pebble.app.js --- apps/pebble/pebble.app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/pebble/pebble.app.js b/apps/pebble/pebble.app.js index 28e32354a..80243c890 100644 --- a/apps/pebble/pebble.app.js +++ b/apps/pebble/pebble.app.js @@ -12,7 +12,7 @@ const SETTINGS_FILE = "pebble.json"; let settings; function loadSettings() { - settings = require("Storage").readJSON(SETTINGS_FILE,1)|| {'bg': '#0f0', 'color': 'Green', 'theme':'System', 'showlock':'false'}; + settings = require("Storage").readJSON(SETTINGS_FILE,1)|| {'bg': '#0f0', 'color': 'Green', 'theme':'System', 'showlock':false}; } var img = require("heatshrink").decompress(atob("oFAwkEogA/AH4A/AH4A/AH4A/AE8AAAoeXoAfeDQUBmcyD7A+Dh///8QD649CiAfaHwUvD4sEHy0DDYIfEICg+Cn4fHICY+DD4nxcgojOHwgfEIAYfRCIQaDD4ZAFD5r7DH4//kAfRCIZ/GAAnwD5p9DX44fTHgYSBf4ofVDAQEBl4fFUAgfOXoQzBgIfFBAIfPP4RAEAoYAB+cRiK/SG4h/WIBAfXIA7CBAAswD55AHn6fUIBMCD65AHl4gCmcziAfQQJqfQQJpiDgk0IDXxQLRAEECaBM+QgRYRYgUIA0CD4ggSQJiDCiAKBICszAAswD55AHABKBVD7BAFABIqBD5pAFABPxD55AOD6BADiIAJQAyxLABwf/gaAPAH4A/AH4ARA==")); @@ -125,7 +125,7 @@ function loadThemeColors() { } function drawLock(){ - if (settings.showlock == 'true') { + if (settings.showlock) { if (Bangle.isLocked()){ g.setColor(theme.day); g.setBgColor(settings.bg); From b7ba1314b293af0ae61a60c536a4bf1bc73f8bbc Mon Sep 17 00:00:00 2001 From: sir-indy <53864146+sir-indy@users.noreply.github.com> Date: Tue, 29 Mar 2022 15:30:22 +0100 Subject: [PATCH 19/21] Update README.md --- apps/pebble/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/pebble/README.md b/apps/pebble/README.md index 15d2bd58c..953db0ba7 100644 --- a/apps/pebble/README.md +++ b/apps/pebble/README.md @@ -9,6 +9,7 @@ * Dependant apps are installed when Pebble installs * Uses the whole screen, widgets are made invisible but still run in the background * When battery is less than 30% main screen goes Red +* Optionally show a lock symbol when screen is locked (default off, enable in Settings) ![](pebble_screenshot.png) ![](pebble_screenshot2.png) From 6ff39e55843ff96cbafdc1837e90a937e0d8524a Mon Sep 17 00:00:00 2001 From: sir-indy <53864146+sir-indy@users.noreply.github.com> Date: Tue, 29 Mar 2022 15:30:45 +0100 Subject: [PATCH 20/21] Update ChangeLog --- apps/pebble/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/pebble/ChangeLog b/apps/pebble/ChangeLog index c2705b790..01f653f48 100644 --- a/apps/pebble/ChangeLog +++ b/apps/pebble/ChangeLog @@ -5,4 +5,4 @@ 0.05: Fix typo in settings - Purple 0.06: Added dependancy on Pedometer Widget 0.07: Fixed icon and ong file to 48x48 -0.08: Added theme options +0.08: Added theme options and optional lock symbol From d356735bf2f50e7b7ccce8c9193c9639256c391f Mon Sep 17 00:00:00 2001 From: sir-indy <53864146+sir-indy@users.noreply.github.com> Date: Wed, 30 Mar 2022 20:52:13 +0100 Subject: [PATCH 21/21] Update pebble.app.js --- apps/pebble/pebble.app.js | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/pebble/pebble.app.js b/apps/pebble/pebble.app.js index 80243c890..062592e47 100644 --- a/apps/pebble/pebble.app.js +++ b/apps/pebble/pebble.app.js @@ -10,6 +10,7 @@ Graphics.prototype.setFontLECO1976Regular22 = function(scale) { const SETTINGS_FILE = "pebble.json"; let settings; +let theme; function loadSettings() { settings = require("Storage").readJSON(SETTINGS_FILE,1)|| {'bg': '#0f0', 'color': 'Green', 'theme':'System', 'showlock':false};