diff --git a/apps/90sclk/ChangeLog b/apps/90sclk/ChangeLog index 057d6ff73..9718a652d 100644 --- a/apps/90sclk/ChangeLog +++ b/apps/90sclk/ChangeLog @@ -1,3 +1,4 @@ 0.01: New App! 0.02: Fullscreen settings. 0.03: Tell clock widgets to hide. +0.04: Use widget_utils. diff --git a/apps/90sclk/app.js b/apps/90sclk/app.js index 351c235e0..63a48b27a 100644 --- a/apps/90sclk/app.js +++ b/apps/90sclk/app.js @@ -1,6 +1,7 @@ const SETTINGS_FILE = "90sclk.setting.json"; const locale = require('locale'); const storage = require('Storage'); +const widget_utils = require('widget_utils'); /* @@ -109,7 +110,7 @@ function draw() { // Draw widgets if not fullscreen if(settings.fullscreen){ - for (let wd of WIDGETS) {wd.draw=()=>{};wd.area="";} + widget_utils.hide(); } else { Bangle.drawWidgets(); } diff --git a/apps/90sclk/metadata.json b/apps/90sclk/metadata.json index 59b627427..bfbb6b080 100644 --- a/apps/90sclk/metadata.json +++ b/apps/90sclk/metadata.json @@ -1,7 +1,7 @@ { "id": "90sclk", "name": "90s Clock", - "version": "0.03", + "version": "0.04", "description": "A 90s style watch-face", "readme": "README.md", "icon": "app.png", diff --git a/apps/daisy/ChangeLog b/apps/daisy/ChangeLog index 61a09a18d..751164c07 100644 --- a/apps/daisy/ChangeLog +++ b/apps/daisy/ChangeLog @@ -7,3 +7,4 @@ 0.07: Use default Bangle formatter for booleans 0.08: fix idle timer always getting set to true 0.09: Use 'modules/suncalc.js' to avoid it being copied 8 times for different apps +0.10: Use widget_utils. diff --git a/apps/daisy/app.js b/apps/daisy/app.js index c99b19228..3b3975105 100644 --- a/apps/daisy/app.js +++ b/apps/daisy/app.js @@ -1,6 +1,7 @@ var SunCalc = require("suncalc"); // from modules folder const storage = require('Storage'); const locale = require("locale"); +const widget_utils = require('widget_utils'); const SETTINGS_FILE = "daisy.json"; const LOCATION_FILE = "mylocation.json"; const h = g.getHeight(); @@ -547,8 +548,6 @@ g.clear(); Bangle.loadWidgets(); /* * we are not drawing the widgets as we are taking over the whole screen - * so we will blank out the draw() functions of each widget and change the - * area to the top bar doesn't get cleared. */ -for (let wd of WIDGETS) {wd.draw=()=>{};wd.area="";} +widget_utils.hide(); draw(); diff --git a/apps/daisy/metadata.json b/apps/daisy/metadata.json index 0bad50151..471f8e56f 100644 --- a/apps/daisy/metadata.json +++ b/apps/daisy/metadata.json @@ -1,6 +1,6 @@ { "id": "daisy", "name": "Daisy", - "version":"0.09", + "version":"0.10", "dependencies": {"mylocation":"app"}, "description": "A beautiful digital clock with large ring guage, idle timer and a cyclic information line that includes, day, date, steps, battery, sunrise and sunset times", "icon": "app.png", diff --git a/apps/lcars/ChangeLog b/apps/lcars/ChangeLog index 31ce16903..7deef5a4b 100644 --- a/apps/lcars/ChangeLog +++ b/apps/lcars/ChangeLog @@ -23,3 +23,4 @@ 0.23: Add warning for low flash memory. 0.24: Add ability to disable alarm functionality. 0.25: Add more colors to the settings and add the ability to disable the data charts+Markup. +0.26: Use widget_utils. diff --git a/apps/lcars/lcars.app.js b/apps/lcars/lcars.app.js index e796e84a7..4a5539c7a 100644 --- a/apps/lcars/lcars.app.js +++ b/apps/lcars/lcars.app.js @@ -2,6 +2,7 @@ const TIMER_IDX = "lcars"; const SETTINGS_FILE = "lcars.setting.json"; const locale = require('locale'); const storage = require('Storage') +const widget_utils = require('widget_utils'); let settings = { alarm: -1, dataRow1: "Steps", @@ -552,7 +553,7 @@ function draw(){ // After drawing the watch face, we can draw the widgets if(settings.fullscreen){ - for (let wd of WIDGETS) {wd.draw=()=>{};wd.area="";} + widget_utils.hide(); } else { Bangle.drawWidgets(); } diff --git a/apps/lcars/metadata.json b/apps/lcars/metadata.json index 577621df0..787ca9046 100644 --- a/apps/lcars/metadata.json +++ b/apps/lcars/metadata.json @@ -3,7 +3,7 @@ "name": "LCARS Clock", "shortName":"LCARS", "icon": "lcars.png", - "version":"0.25", + "version":"0.26", "readme": "README.md", "supports": ["BANGLEJS2"], "description": "Library Computer Access Retrieval System (LCARS) clock.", diff --git a/apps/limelight/ChangeLog b/apps/limelight/ChangeLog index 8fe3a0b2c..de8caf9c4 100644 --- a/apps/limelight/ChangeLog +++ b/apps/limelight/ChangeLog @@ -1,2 +1,4 @@ 0.01: first release 0.02: Tell clock widgets to hide. +0.03: Use widget_utils. + diff --git a/apps/limelight/limelight.app.js b/apps/limelight/limelight.app.js index 84ded1039..dbc784e23 100644 --- a/apps/limelight/limelight.app.js +++ b/apps/limelight/limelight.app.js @@ -14,6 +14,7 @@ Bangle.setUI('clock'); g.clear(); +const widget_utils = require('widget_utils'); const SETTINGS_FILE = "limelight.json"; var UPDATE_PERIOD; var drawTimeout; @@ -84,10 +85,8 @@ if (settings.fullscreen) { /* * We load the widgets as some like widpedom accumualte the step count. * we are not drawing the widgets as we are taking over the whole screen - * so we will blank out the draw() functions of each widget and change the - * widgets area to the top bar doesn't get cleared. */ - for (let wd of WIDGETS) {wd.draw=()=>{};wd.area="";} + widget_utils.hide(); } function debug(o) { diff --git a/apps/limelight/metadata.json b/apps/limelight/metadata.json index e484a2825..0e5dfd565 100644 --- a/apps/limelight/metadata.json +++ b/apps/limelight/metadata.json @@ -1,7 +1,7 @@ { "id": "limelight", "name": "Limelight", - "version": "0.02", + "version": "0.03", "description": "Simple analogue clock (with configurable fonts) based on the work of @Andreas_Rozek (Simple_Clock)", "icon": "limelight.png", "readme":"README.md", diff --git a/apps/neonx/ChangeLog b/apps/neonx/ChangeLog index c1a50ecd7..e78686a00 100644 --- a/apps/neonx/ChangeLog +++ b/apps/neonx/ChangeLog @@ -2,4 +2,5 @@ 0.02: Optional fullscreen mode 0.03: Optional show lock status via color 0.04: Ensure that widgets are always hidden in fullscreen mode -0.05: Better lock/unlock animation \ No newline at end of file +0.05: Better lock/unlock animation +0.06: Use widget_utils. diff --git a/apps/neonx/metadata.json b/apps/neonx/metadata.json index ee99f98b8..c273cb05a 100644 --- a/apps/neonx/metadata.json +++ b/apps/neonx/metadata.json @@ -2,7 +2,7 @@ "id": "neonx", "name": "Neon X & IO X Clock", "shortName": "Neon X Clock", - "version": "0.05", + "version": "0.06", "description": "Pebble Neon X & Neon IO X for Bangle.js", "icon": "neonx.png", "type": "clock", diff --git a/apps/neonx/neonx.app.js b/apps/neonx/neonx.app.js index fd30fa30f..7fcf01bde 100644 --- a/apps/neonx/neonx.app.js +++ b/apps/neonx/neonx.app.js @@ -19,6 +19,7 @@ let saved_settings = require('Storage').readJSON('neonx.json', 1) || settings; for (const key in saved_settings) { settings[key] = saved_settings[key] } +let widget_utils = require('widget_utils'); const digits = { @@ -133,7 +134,7 @@ function drawAnimated(){ function _draw(date, xc){ // Depending on the settings, we clear all widgets or draw those. if(settings.fullscreen){ - for (let wd of WIDGETS) {wd.draw=()=>{};wd.area="";} + widget_utils.hide(); } else { Bangle.drawWidgets(); } @@ -210,4 +211,4 @@ g.clear(1); Bangle.setUI("clock"); Bangle.loadWidgets(); -draw(); \ No newline at end of file +draw(); diff --git a/apps/notanalog/ChangeLog b/apps/notanalog/ChangeLog index 07430406a..094125f52 100644 --- a/apps/notanalog/ChangeLog +++ b/apps/notanalog/ChangeLog @@ -2,4 +2,5 @@ 0.02: 12k steps are 360 degrees - improves readability of steps. 0.03: Battery improvements through sleep (no minute updates) and partial updates of drawing. 0.04: Use alarm for timer instead of own alarm implementation. -0.05: Use internal step counter if no widget is available. \ No newline at end of file +0.05: Use internal step counter if no widget is available. +0.06: Use widget_utils. diff --git a/apps/notanalog/metadata.json b/apps/notanalog/metadata.json index 81d79f4f2..319d396a9 100644 --- a/apps/notanalog/metadata.json +++ b/apps/notanalog/metadata.json @@ -3,7 +3,7 @@ "name": "Not Analog", "shortName":"Not Analog", "icon": "notanalog.png", - "version":"0.05", + "version":"0.06", "readme": "README.md", "supports": ["BANGLEJS2"], "description": "An analog watch face for people that can not read analog watch faces.", diff --git a/apps/notanalog/notanalog.app.js b/apps/notanalog/notanalog.app.js index 3c01a921e..29fb1730f 100644 --- a/apps/notanalog/notanalog.app.js +++ b/apps/notanalog/notanalog.app.js @@ -4,6 +4,7 @@ const TIMER_IDX = "notanalog"; const locale = require('locale'); const storage = require('Storage') +const widget_utils = require('widget_utils'); const SETTINGS_FILE = "notanalog.setting.json"; let settings = { alarm: -1, @@ -460,10 +461,8 @@ Bangle.setUI("clock"); Bangle.loadWidgets(); /* * we are not drawing the widgets as we are taking over the whole screen - * so we will blank out the draw() functions of each widget and change the - * area to the top bar doesn't get cleared. */ -for (let wd of WIDGETS) {wd.draw=()=>{};wd.area="";} +widget_utils.hide(); // Clear the screen once, at startup and draw clock // g.setTheme({bg:"#fff",fg:"#000",dark:false}).clear(); diff --git a/apps/thering/ChangeLog b/apps/thering/ChangeLog new file mode 100644 index 000000000..25c572560 --- /dev/null +++ b/apps/thering/ChangeLog @@ -0,0 +1,2 @@ +0.01: Initial release. +0.02: Use widget_utils. diff --git a/apps/thering/app.js b/apps/thering/app.js index f7cfaa015..8767941b2 100644 --- a/apps/thering/app.js +++ b/apps/thering/app.js @@ -1,5 +1,6 @@ const h = g.getHeight(); const w = g.getWidth(); +const widget_utils = require('widget_utils'); // palette for 0-40% const pal1 = new Uint16Array([g.theme.bg, g.toColor("#020"), g.toColor("#0f0"), g.toColor("#00f")]); // palette for 50-100% @@ -215,10 +216,8 @@ Bangle.setUI("clock"); Bangle.loadWidgets(); /* * we are not drawing the widgets as we are taking over the whole screen - * so we will blank out the draw() functions of each widget and change the - * area to the top bar doesn't get cleared. */ -for (let wd of WIDGETS) {wd.draw=()=>{};wd.area="";} +widget_utils.hide(); draw(); setInterval(draw, 60000); diff --git a/apps/thering/metadata.json b/apps/thering/metadata.json index 32b1dae4b..6118a90f9 100644 --- a/apps/thering/metadata.json +++ b/apps/thering/metadata.json @@ -1,6 +1,6 @@ { "id": "thering", "name": "The Ring", - "version":"0.01", + "version":"0.02", "description": "A proof of concept clock with large ring guage for steps using pre-set images, acts as a tutorial piece for discussion", "icon": "app.png", "tags": "clock", diff --git a/apps/widviz/ChangeLog b/apps/widviz/ChangeLog index 9785f4d84..5df89e719 100644 --- a/apps/widviz/ChangeLog +++ b/apps/widviz/ChangeLog @@ -1,3 +1,4 @@ 0.01: New Widget 0.02: swipe left,right update 0.03: Fix widget visibility code to the top bar isn't cleared by drawWidgets +0.04: Use widget_utils. diff --git a/apps/widviz/metadata.json b/apps/widviz/metadata.json index ba9cf793b..4d88c4d5f 100644 --- a/apps/widviz/metadata.json +++ b/apps/widviz/metadata.json @@ -2,7 +2,7 @@ "id": "widviz", "name": "Widget Visibility Widget", "shortName": "Viz Widget", - "version": "0.03", + "version": "0.04", "description": "Swipe left to hide top bar widgets, swipe right to redisplay.", "icon": "eye.png", "type": "widget", diff --git a/apps/widviz/widget.js b/apps/widviz/widget.js index 1490cf11a..7b9f55053 100644 --- a/apps/widviz/widget.js +++ b/apps/widviz/widget.js @@ -1,28 +1,20 @@ (() => { + let widget_utils = require('widget_utils'); - var saved = null; + var saved = false; function hide(){ if (!Bangle.isLCDOn() || saved) return; - saved = []; - for (var wd of WIDGETS) { - saved.push({d:wd.draw,a:wd.area}); - wd.draw=()=>{}; - wd.area=""; - } + saved = true; + widget_utils.hide(); g.setColor(0,0,0); g.fillRect(0,0,g.getWidth(),23); } function reveal(){ if (!Bangle.isLCDOn() || !saved) return; - for (var wd of WIDGETS) { - var o = saved.shift(); - wd.draw = o.d; - wd.area = o.a; - } - Bangle.drawWidgets(); - saved=null; + widget_utils.show(); + saved = false; } function draw(){ diff --git a/apps/widviztime/ChangeLog b/apps/widviztime/ChangeLog index 287061d0c..be95ed81c 100644 --- a/apps/widviztime/ChangeLog +++ b/apps/widviztime/ChangeLog @@ -1 +1,2 @@ 0.01: New Widget, forked from widviz +0.02: Use widget_utils. diff --git a/apps/widviztime/metadata.json b/apps/widviztime/metadata.json index b364bbd74..669c8fc12 100644 --- a/apps/widviztime/metadata.json +++ b/apps/widviztime/metadata.json @@ -2,7 +2,7 @@ "id": "widviztime", "name": "Widget Autohide Widget", "shortName": "Viz Time Widget", - "version": "0.01", + "version": "0.02", "description": "The widgets will be shown for four seconds after the device is unlocked.", "icon": "eye.png", "type": "widget", diff --git a/apps/widviztime/widget.js b/apps/widviztime/widget.js index 5e81af611..8422a3842 100644 --- a/apps/widviztime/widget.js +++ b/apps/widviztime/widget.js @@ -1,32 +1,21 @@ (() => { + let widget_utils = require('widget_utils'); - var saved = null; + var saved = false; function hide() { if (!Bangle.isLCDOn() || saved) return; - saved = []; - for (var wd of WIDGETS) { - saved.push({ - d: wd.draw, - a: wd.area - }); - wd.draw = () => {}; - wd.area = ""; - } + saved = true; + widget_utils.hide(); g.setColor(0, 0, 0); g.fillRect(0, 0, g.getWidth(), 23); } function reveal() { if (!Bangle.isLCDOn() || !saved) return; - for (var wd of WIDGETS) { - var o = saved.shift(); - wd.draw = o.d; - wd.area = o.a; - } - Bangle.drawWidgets(); - saved = null; + widget_utils.show(); + saved = false; } function draw() {