diff --git a/apps/andark/ChangeLog b/apps/andark/ChangeLog index fa89d5618..5541288e8 100644 --- a/apps/andark/ChangeLog +++ b/apps/andark/ChangeLog @@ -7,3 +7,5 @@ 0.06: Fix issue showing widgets when app is fast-loaded into from launcher with widgets disabled 0.07: Enable fast loading and queue updates to the second 0.08: Restore redraw on charging event + fixup for safer fast-loading +0.09: Add setting to show the weekday and not the year + add setting to hide the battery + + changed to follow system them with setting for dark theme diff --git a/apps/andark/README.md b/apps/andark/README.md index 9034677c2..04737a7a2 100644 --- a/apps/andark/README.md +++ b/apps/andark/README.md @@ -7,10 +7,19 @@ * battery percentage (showing charge status with color) * turned off or swipeable widgets (choose in settings) -![logo](andark_screen.png) +![Screenshot of Dark Analog Clock with default settings](andark_screen.png) + +*Default settings* + +![Screenshot of Dark Analog Clock with default settings](andark_screen_light_weekday_nobatt.png) + +*Following system theme, with weekday shown and battery hidden* ## Settings * whether to load widgets, or not; if widgets are loaded, they are swipeable from the top; if not, NO ACTIONS of widgets are available * date and battery can be printed both below hands (as if hands were physical) and above (more readable) * hour hand can be made slighly shorter to improve readability when minute hand is behind a number +* show the weekday and not the year +* hide the battery percentage; the font for the date is increased since there is more space +* dark theme (enabled by default); disable to follow system theme diff --git a/apps/andark/andark_screen_light_weekday_nobatt.png b/apps/andark/andark_screen_light_weekday_nobatt.png new file mode 100644 index 000000000..72fa233b7 Binary files /dev/null and b/apps/andark/andark_screen_light_weekday_nobatt.png differ diff --git a/apps/andark/app.js b/apps/andark/app.js index 81d757ce4..12c836182 100644 --- a/apps/andark/app.js +++ b/apps/andark/app.js @@ -2,10 +2,19 @@ const defaultSettings = { loadWidgets : false, textAboveHands : false, - shortHrHand : false + shortHrHand : false, + weekdayNoYear : false, + noBattery : false, + darkTheme : true }; const settings = Object.assign(defaultSettings, require('Storage').readJSON('andark.json',1)||{}); +const origTheme = g.theme; +if (settings.darkTheme) { + g.setTheme({bg: "#000"}); + g.setTheme({fg: "#FFF"}); +} + const c={"x":g.getWidth()/2,"y":g.getHeight()/2}; const zahlpos=(function() { @@ -36,7 +45,7 @@ const zeiger = function(len,dia,tim) { const drawHands = function(d) { let m=d.getMinutes(), h=d.getHours(), s=d.getSeconds(); - g.setColor(1,1,1); + g.setColor(g.theme.fg); if(h>12){ h=h-12; @@ -62,23 +71,31 @@ const drawHands = function(d) { }; const drawText = function(d) { - g.setFont("Vector",10); - g.setBgColor(0,0,0); - g.setColor(1,1,1); - const dateStr = require("locale").date(d); - g.drawString(dateStr, c.x, c.y+20, true); +//g.setFont("Vector",10); + g.setBgColor(g.theme.bg); + g.setColor(g.theme.fg); + const dateStr = settings.weekdayNoYear + ? require("locale").dow(d, 1)+" "+d.getDate()+" "+require("locale").month(d, 1) + : require("locale").date(d); const batStr = Math.round(E.getBattery()/5)*5+"%"; - if (Bangle.isCharging()) { - g.setBgColor(1,0,0); + if (settings.noBattery) { + g.setFont("Vector",13); + g.drawString(dateStr, c.x, c.y+25, true); + } else { + g.setFont("Vector",10); + g.drawString(dateStr, c.x, c.y+20, true); + if (Bangle.isCharging()) { + g.setBgColor(1,0,0); + } + g.drawString(batStr, c.x, c.y+40, true); } - g.drawString(batStr, c.x, c.y+40, true); }; const drawNumbers = function() { //draws the numbers on the screen g.setFont("Vector",20); - g.setColor(1,1,1); - g.setBgColor(0,0,0); + g.setColor(g.theme.fg); + g.setBgColor(g.theme.bg); for(let i = 0;i<12;i++){ g.drawString(zahlpos[i][0],zahlpos[i][1],zahlpos[i][2],true); } @@ -114,7 +131,7 @@ const queueDraw = function() { const draw = function() { // draw black rectangle in the middle to clear screen from scale and hands - g.setColor(0,0,0); + g.setColor(g.theme.bg); g.fillRect(10,10,2*c.x-10,2*c.x-10); // prepare for drawing the text g.setFontAlign(0,0); @@ -132,7 +149,7 @@ const draw = function() { //draws the scale once the app is startet const drawScale = function() { // clear the screen - g.setBgColor(0,0,0); + g.setBgColor(g.theme.bg); g.clear(); // draw the ticks of the scale for(let i=-14;i<47;i++){ @@ -140,9 +157,9 @@ const drawScale = function() { let d=2; if(i%5==0){d=5;} g.fillPoly(zeiger(300,d,win),true); - g.setColor(0,0,0); + g.setColor(g.theme.bg); g.fillRect(10,10,2*c.x-10,2*c.x-10); - g.setColor(1,1,1); + g.setColor(g.theme.fg); } }; @@ -152,6 +169,7 @@ const drawScale = function() { Bangle.setUI({ mode: "clock", remove: function() { + if (settings.darkTheme) g.setTheme(origTheme); Bangle.removeListener('lcdPower', updateState); Bangle.removeListener('lock', updateState); Bangle.removeListener('charging', draw); diff --git a/apps/andark/metadata.json b/apps/andark/metadata.json index 4bd88b3f5..66b22b2aa 100644 --- a/apps/andark/metadata.json +++ b/apps/andark/metadata.json @@ -1,13 +1,14 @@ { "id": "andark", "name": "Analog Dark", "shortName":"AnDark", - "version":"0.08", + "version":"0.09", "description": "analog clock face without disturbing widgets", "icon": "andark_icon.png", "type": "clock", "tags": "clock", + "allow_emulator": true, "supports" : ["BANGLEJS2"], - "screenshots": [{"url":"andark_screen.png"}], + "screenshots": [{"url":"andark_screen.png"},{"url":"andark_screen_light_weekday_nobatt.png"}], "readme": "README.md", "storage": [ {"name":"andark.app.js","url":"app.js"}, diff --git a/apps/andark/settings.js b/apps/andark/settings.js index 7bbceb2c2..d1cba0e30 100644 --- a/apps/andark/settings.js +++ b/apps/andark/settings.js @@ -2,7 +2,10 @@ const defaultSettings = { loadWidgets : false, textAboveHands : false, - shortHrHand : false + shortHrHand : false, + weekdayNoYear : false, + noBattery : false, + darkTheme : true } let settings = Object.assign(defaultSettings, require('Storage').readJSON('andark.json',1)||{}); @@ -22,6 +25,18 @@ value : !!settings.shortHrHand, onchange : v => { settings.shortHrHand=v; save();} }, + /*LANG*/'Show weekday not year': { + value : !!settings.weekdayNoYear, + onchange : v => { settings.weekdayNoYear=v; save();} + }, + /*LANG*/'Hide the battery': { + value : !!settings.noBattery, + onchange : v => { settings.noBattery=v; save();} + }, + /*LANG*/'Dark theme': { + value : !!settings.darkTheme, + onchange : v => { settings.darkTheme=v; save();} + }, }; E.showMenu(appMenu);