From de40f314c7037b5ff5cf01078c17d98552d31adf Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Fri, 27 Jan 2023 13:33:46 +0000 Subject: [PATCH] Moved clock_info to a module --- apps/aiclock/ChangeLog | 3 +- apps/aiclock/metadata.json | 3 +- apps/bwclk/ChangeLog | 3 +- apps/bwclk/app.js | 1 + apps/bwclk/metadata.json | 3 +- apps/circlesclock/ChangeLog | 1 + apps/circlesclock/app.js | 1 + apps/circlesclock/metadata.json | 4 +- apps/clock_info/ChangeLog | 1 + apps/clock_info/README.md | 99 ++++++++++++ apps/clock_info/app-icon.js | 1 + apps/clock_info/app.png | Bin 0 -> 390 bytes .../clock_info.js => apps/clock_info/lib.js | 153 +++++++++--------- apps/clock_info/metadata.json | 18 +++ apps/clock_info/settings.js | 30 ++++ apps/lato/ChangeLog | 2 + apps/lato/metadata.json | 3 +- apps/lcdclock/ChangeLog | 1 + apps/lcdclock/metadata.json | 3 +- apps/linuxclock/ChangeLog | 3 +- apps/linuxclock/metadata.json | 4 +- apps/simplestpp/ChangeLog | 1 + apps/simplestpp/metadata.json | 3 +- apps/slopeclockpp/ChangeLog | 1 + apps/slopeclockpp/app.js | 4 +- apps/slopeclockpp/metadata.json | 3 +- 26 files changed, 257 insertions(+), 92 deletions(-) create mode 100644 apps/clock_info/ChangeLog create mode 100644 apps/clock_info/README.md create mode 100644 apps/clock_info/app-icon.js create mode 100644 apps/clock_info/app.png rename modules/clock_info.js => apps/clock_info/lib.js (76%) create mode 100644 apps/clock_info/metadata.json create mode 100644 apps/clock_info/settings.js create mode 100644 apps/lato/ChangeLog diff --git a/apps/aiclock/ChangeLog b/apps/aiclock/ChangeLog index 6d6eeb55e..43236015e 100644 --- a/apps/aiclock/ChangeLog +++ b/apps/aiclock/ChangeLog @@ -4,4 +4,5 @@ 0.04: Use widget_utils module. 0.05: Support for clkinfo. 0.06: ClockInfo Fix: Use .get instead of .show as .show is not implemented for weather etc. -0.07: Use clock_info.addInteractive instead of a custom implementation \ No newline at end of file +0.07: Use clock_info.addInteractive instead of a custom implementation +0.08: Use clock_info module as an app diff --git a/apps/aiclock/metadata.json b/apps/aiclock/metadata.json index 4c01ecaa9..d8d1e9d68 100644 --- a/apps/aiclock/metadata.json +++ b/apps/aiclock/metadata.json @@ -3,9 +3,10 @@ "name": "AI Clock", "shortName":"AI Clock", "icon": "aiclock.png", - "version":"0.07", + "version":"0.08", "readme": "README.md", "supports": ["BANGLEJS2"], + "dependencies" : { "clock_info":"module" }, "description": "A watch face that was designed by an AI (stable diffusion) and implemented by a human.", "type": "clock", "tags": "clock", diff --git a/apps/bwclk/ChangeLog b/apps/bwclk/ChangeLog index 8b82f6843..06f94854e 100644 --- a/apps/bwclk/ChangeLog +++ b/apps/bwclk/ChangeLog @@ -29,4 +29,5 @@ clkinfo.addInteractive that would cause ReferenceError. 0.28: Option to show (1) time only and (2) week of year. 0.29: use setItem of clockInfoMenu to change the active item -0.30: Use widget_utils. +0.30: Use widget_utils +0.31: Use clock_info module as an app diff --git a/apps/bwclk/app.js b/apps/bwclk/app.js index de7c7d510..770c053c2 100644 --- a/apps/bwclk/app.js +++ b/apps/bwclk/app.js @@ -132,6 +132,7 @@ clockInfoItems[0].items.unshift({ name : "nop", let clockInfoMenu = clock_info.addInteractive(clockInfoItems, { + app: "bwclk", x : 0, y: 135, w: W, diff --git a/apps/bwclk/metadata.json b/apps/bwclk/metadata.json index 39106c827..430f466b2 100644 --- a/apps/bwclk/metadata.json +++ b/apps/bwclk/metadata.json @@ -1,7 +1,7 @@ { "id": "bwclk", "name": "BW Clock", - "version": "0.30", + "version": "0.31", "description": "A very minimalistic clock.", "readme": "README.md", "icon": "app.png", @@ -9,6 +9,7 @@ "type": "clock", "tags": "clock,clkinfo", "supports": ["BANGLEJS2"], + "dependencies" : { "clock_info":"module" }, "allow_emulator": true, "storage": [ {"name":"bwclk.app.js","url":"app.js"}, diff --git a/apps/circlesclock/ChangeLog b/apps/circlesclock/ChangeLog index 01a51e094..9838ae409 100644 --- a/apps/circlesclock/ChangeLog +++ b/apps/circlesclock/ChangeLog @@ -41,3 +41,4 @@ 0.22: Fixed crash if item has no image and cutting long overflowing text 0.23: Setting circles colours per clkinfo and not position 0.24: Using suggested color from clock_info if set as default and available +0.25: Use clock_info module as an app diff --git a/apps/circlesclock/app.js b/apps/circlesclock/app.js index 583763af1..6f76ff013 100644 --- a/apps/circlesclock/app.js +++ b/apps/circlesclock/app.js @@ -356,6 +356,7 @@ for(var i=0;i Apps -> Clock Info` + +* `Defocus on Lock` - (default=on) when the watch screen auto-locks, defocus +and previously focussed Clock Infos +* `HRM` - (default=always) when does the HRM stay on? + * `Always` - When a HRM ClockInfo is shown, keep the HRM on + * `Tap` - When a HRM ClockInfo is shown, turn HRM on for 1 minute. Turn on again when tapped. +* `Max Altitude` - on clocks like [Circles Clock](https://banglejs.com/apps/?id=circlesclock) a + progress/percent indicator may be shown. The percentage for altitude will be how far towards + the Max Altitude you are. If you go higher than `Max Altitude` the correct altitude will still + be shown - the percent indicator will just read 100% + +## API (Software development) + +See http://www.espruino.com/Bangle.js+Clock+Info for details on using +this module inside your apps (or generating your own Clock Info +extensions). + +`load()` returns an array of menu objects, where each object contains a list of menu items: +* `name` : text to display and identify menu object (e.g. weather) +* `img` : a 24x24px image +* `dynamic` : if `true`, items are not constant but are sorted (e.g. calendar events sorted by date) +* `items` : menu items such as temperature, humidity, wind etc. + +Note that each item is an object with: + +* `item.name` : friendly name to identify an item (e.g. temperature) +* `item.hasRange` : if `true`, `.get` returns `v/min/max` values (for progress bar/guage) +* `item.get` : function that returns an object: + +```JS +{ + 'text' // the text to display for this item + 'short' // optional: a shorter text to display for this item (at most 6 characters) + 'img' // optional: a 24x24px image to display for this item + 'color' // optional: a color string (like "#f00") to color the icon in compatible clocks + 'v' // (if hasRange==true) a numerical value + 'min','max' // (if hasRange==true) a minimum and maximum numerical value (if this were to be displayed as a guage) +} +``` + +* `item.show` : called when item should be shown. Enables updates. Call BEFORE 'get' +* `item.hide` : called when item should be hidden. Disables updates. +* `.on('redraw', ...)` : event that is called when 'get' should be called again (only after 'item.show') +* `item.run` : (optional) called if the info screen is tapped - can perform some action. Return true if the caller should feedback the user. + +See the bottom of `lib.js` for example usage... + +example.clkinfo.js : + +```JS +(function() { + return { + name: "Bangle", + img: atob("GBiBAAD+AAH+AAH+AAH+AAH/AAOHAAYBgAwAwBgwYBgwYBgwIBAwOBAwOBgYIBgMYBgAYAwAwAYBgAOHAAH/AAH+AAH+AAH+AAD+AA==") }), + items: [ + { name : "Item1", + get : () => ({ text : "TextOfItem1", v : 10, min : 0, max : 100, + img : atob("GBiBAAD+AAH+AAH+AAH+AAH/AAOHAAYBgAwAwBgwYBgwYBgwIBAwOBAwOBgYIBgMYBgAYAwAwAYBgAOHAAH/AAH+AAH+AAH+AAD+AA==") + }), + show : () => {}, + hide : () => {} + // run : () => {} optional (called when tapped) + } + ] + }; +}) // must not have a semi-colon! +``` diff --git a/apps/clock_info/app-icon.js b/apps/clock_info/app-icon.js new file mode 100644 index 000000000..49232b838 --- /dev/null +++ b/apps/clock_info/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwwJC/AH4A/AH4AgA==")) diff --git a/apps/clock_info/app.png b/apps/clock_info/app.png new file mode 100644 index 0000000000000000000000000000000000000000..4013f353f4f119645e6bb68fdfb4240fd410ece7 GIT binary patch literal 390 zcmV;10eSw3P)@B~%TF zv2@8pwxyl=3`8bj2?>9Sh)wkSq#MApeIIuq8Os6y0000O&uf+~{78PVDE(ovEKLkQ zmIaH`T;kpkL3qcpOG zj1!<627`c&3Y3$ykY62`Wp!-R{gkQeNExNyvp&@Ok$i6ms9zOIqOQd3eyg10aZ#ES z)=*|I;0EDWpM~8(>|glqVd(m5jvI)5uRXZ<94z4R?Q@%i%f+9^!({NnjeWx8xYqUL kowsl^b{_x$0KhVl131S^@fGTWKL7v#07*qoM6N<$f{1sfZ2$lO literal 0 HcmV?d00001 diff --git a/modules/clock_info.js b/apps/clock_info/lib.js similarity index 76% rename from modules/clock_info.js rename to apps/clock_info/lib.js index 0e4e2a8b6..7251f1b00 100644 --- a/modules/clock_info.js +++ b/apps/clock_info/lib.js @@ -1,54 +1,4 @@ -/* Module that allows for loading of clock 'info' displays -that can be scrolled through on the clock face. - -`load()` returns an array of menu objects, where each object contains a list of menu items: -* `name` : text to display and identify menu object (e.g. weather) -* `img` : a 24x24px image -* `dynamic` : if `true`, items are not constant but are sorted (e.g. calendar events sorted by date) -* `items` : menu items such as temperature, humidity, wind etc. - -Note that each item is an object with: - -* `item.name` : friendly name to identify an item (e.g. temperature) -* `item.hasRange` : if `true`, `.get` returns `v/min/max` values (for progress bar/guage) -* `item.get` : function that returns an object: - -{ - 'text' // the text to display for this item - 'short' // optional: a shorter text to display for this item (at most 6 characters) - 'img' // optional: a 24x24px image to display for this item - 'color' // optional: a color string (like "#ffffff") to color the icon in compatible clocks - 'v' // (if hasRange==true) a numerical value - 'min','max' // (if hasRange==true) a minimum and maximum numerical value (if this were to be displayed as a guage) -} - -* `item.show` : called when item should be shown. Enables updates. Call BEFORE 'get' -* `item.hide` : called when item should be hidden. Disables updates. -* `.on('redraw', ...)` : event that is called when 'get' should be called again (only after 'item.show') -* `item.run` : (optional) called if the info screen is tapped - can perform some action. Return true if the caller should feedback the user. - -See the bottom of this file for example usage... - -example.clkinfo.js : - -(function() { - return { - name: "Bangle", - img: atob("GBiBAAD+AAH+AAH+AAH+AAH/AAOHAAYBgAwAwBgwYBgwYBgwIBAwOBAwOBgYIBgMYBgAYAwAwAYBgAOHAAH/AAH+AAH+AAH+AAD+AA==") }), - items: [ - { name : "Item1", - get : () => ({ text : "TextOfItem1", v : 10, min : 0, max : 100, - img : atob("GBiBAAD+AAH+AAH+AAH+AAH/AAOHAAYBgAwAwBgwYBgwYBgwIBAwOBAwOBgYIBgMYBgAYAwAwAYBgAOHAAH/AAH+AAH+AAH+AAD+AA==") - }), - show : () => {}, - hide : () => {} - // run : () => {} optional (called when tapped) - } - ] - }; -}) // must not have a semi-colon! - -*/ +/* See the README for more info... */ let storage = require("Storage"); let stepGoal = undefined; @@ -60,7 +10,21 @@ if (stepGoal == undefined) { stepGoal = d != undefined && d.settings != undefined ? d.settings.goal : 10000; } +// Load the settings, with defaults +exports.loadSettings = function() { + return Object.assign({ + hrmOn : 0, // 0(Always), 1(Tap) + defocusOnLock : true, + maxAltitude : 3000, + apps : {} + }, + require("Storage").readJSON("clock_info.json",1)||{} + ); +}; + exports.load = function() { + var settings = exports.loadSettings(); + delete settings.apps; // keep just the basic settings in memory // info used for drawing... var hrm = 0; var alt = "--"; @@ -111,8 +75,31 @@ exports.load = function() { text : (hrm||"--") + " bpm", v : hrm, min : 40, max : 200, img : atob("GBiBAAAAAAAAAAAAAAAAAAAAAADAAADAAAHAAAHjAAHjgAPngH9n/n82/gA+AAA8AAA8AAAcAAAYAAAYAAAAAAAAAAAAAAAAAAAAAA==") }}, - show : function() { Bangle.setHRMPower(1,"clkinfo"); Bangle.on("HRM", hrmUpdateHandler); hrm = Math.round(Bangle.getHealthStatus().bpm||Bangle.getHealthStatus("last").bpm); hrmUpdateHandler(); }, - hide : function() { Bangle.setHRMPower(0,"clkinfo"); Bangle.removeListener("HRM", hrmUpdateHandler); hrm = 0; }, + run : function() { + Bangle.setHRMPower(1,"clkinfo"); + if (settings.hrmOn==1/*Tap*/) { + /* turn off after 1 minute. If Health HRM monitoring is + enabled we will still get HRM events every so often */ + this.timeout = setTimeout(function() { + this.timeout = undefined; + Bangle.setHRMPower(0,"clkinfo"); + }, 60000); + } + }, + show : function() { + Bangle.on("HRM", hrmUpdateHandler); + hrm = Math.round(Bangle.getHealthStatus().bpm||Bangle.getHealthStatus("last").bpm); hrmUpdateHandler(); + this.run(); // start HRM + }, + hide : function() { + Bangle.setHRMPower(0,"clkinfo"); + Bangle.removeListener("HRM", hrmUpdateHandler); + if (this.timeout) { + clearTimeout(this.timeout); + this.timeout = undefined; + } + hrm = 0; + }, } ], }]; @@ -123,7 +110,7 @@ exports.load = function() { hasRange : true, get : () => ({ text : alt, v : parseInt(alt), - min : 0, max : 3000, + min : 0, max : settings.maxAltitude, img : atob("GBiBAAAAAAAAAAAAAAAAAAAAAAACAAAGAAAPAAEZgAOwwAPwQAZgYAwAMBgAGBAACDAADGAABv///////wAAAAAAAAAAAAAAAAAAAA==") }), show : function() { this.interval = setInterval(altUpdateHandler, 60000); alt = "--"; altUpdateHandler(); }, @@ -148,9 +135,18 @@ exports.load = function() { return menu; }; + /** Adds an interactive menu that could be used on a clock face by swiping. Simply supply the menu data (from .load) and a function to draw the clock info. +options = { + app : "str", // optional: app ID used when saving clock_info positions + // if defined, your app will remember its own positions, + // otherwise all apps share the same ones + x : 20, y: 20, w: 80, h:80, // dimensions of area used for clock_info + draw : (itm, info, options) // draw function +} + For example: let clockInfoItems = require("clock_info").load(); @@ -181,7 +177,7 @@ clockInfoMenu is the 'options' parameter, with the following added: * `redraw` : function - force a redraw * `focus` : function - bool to show if menu is focused or not -You can have more than one clock_info at once as well, sfor instance: +You can have more than one clock_info at once as well, for instance: let clockInfoDraw = (itm, info, options) => { g.reset().setBgColor(options.bg).setColor(options.fg).clearRect(options.x, options.y, options.x+options.w-2, options.y+options.h-1); @@ -201,19 +197,19 @@ exports.addInteractive = function(menu, options) { options.index = 0|exports.loadCount; exports.loadCount = options.index+1; options.focus = options.index==0 && options.x===undefined; // focus if we're the first one loaded and no position has been defined - const appName = "default:"+options.index; + const appName = (options.app||"default")+":"+options.index; - { // load the currently showing clock_infos - let settings = require("Storage").readJSON("clock_info.json",1)||{}; - if (settings[appName]) { - let a = settings[appName].a|0; - let b = settings[appName].b|0; - if (menu[a] && menu[a].items[b]) { // all ok - options.menuA = a; - options.menuB = b; - } + // load the currently showing clock_infos + let settings = exports.loadSettings() + if (settings.apps[appName]) { + let a = settings.apps[appName].a|0; + let b = settings.apps[appName].b|0; + if (menu[a] && menu[a].items[b]) { // all ok + options.menuA = a; + options.menuB = b; } } + if (options.menuA===undefined) options.menuA = 0; if (options.menuB===undefined) options.menuB = Math.min(exports.loadCount, menu[options.menuA].items.length)-1; function drawItem(itm) { @@ -262,21 +258,13 @@ exports.addInteractive = function(menu, options) { menuShowItem(menu[options.menuA].items[options.menuB]); } // save the currently showing clock_info - let settings = require("Storage").readJSON("clock_info.json",1)||{}; - settings[appName] = {a:options.menuA,b:options.menuB}; + let settings = exports.loadSettings(); + settings.apps[appName] = {a:options.menuA,b:options.menuB}; require("Storage").writeJSON("clock_info.json",settings); } Bangle.on("swipe",swipeHandler); - var touchHandler; - var lockHandler; + let touchHandler, lockHandler; if (options.x!==undefined && options.y!==undefined && options.w && options.h) { - lockHandler = function() { - if(options.focus) { - options.focus=false; - delete Bangle.CLKINFO_FOCUS; - options.redraw(); - } - }; touchHandler = function(_,e) { if (e.x(options.x+options.w) || e.y>(options.y+options.h)) { @@ -300,7 +288,16 @@ exports.addInteractive = function(menu, options) { } }; Bangle.on("touch",touchHandler); - Bangle.on("lock", lockHandler); + if (settings.defocusOnLock) { + lockHandler = function() { + if(options.focus) { + options.focus=false; + delete Bangle.CLKINFO_FOCUS; + options.redraw(); + } + }; + Bangle.on("lock", lockHandler); + } } // draw the first item menuShowItem(menu[options.menuA].items[options.menuB]); @@ -333,6 +330,8 @@ exports.addInteractive = function(menu, options) { return true; } + + delete settings; // don't keep settings in RAM - save space return options; }; diff --git a/apps/clock_info/metadata.json b/apps/clock_info/metadata.json new file mode 100644 index 000000000..457180588 --- /dev/null +++ b/apps/clock_info/metadata.json @@ -0,0 +1,18 @@ +{ "id": "clock_info", + "name": "Clock Info Module", + "shortName": "Clock Info", + "version":"0.01", + "description": "A library used by clocks to provide extra information on the clock face (Altitude, BPM, etc)", + "icon": "app.png", + "type": "module", + "tags": "clkinfo", + "supports" : ["BANGLEJS2"], + "provides_modules" : ["clock_info"], + "readme": "README.md", + "storage": [ + {"name":"clock_info","url":"lib.js"}, + {"name":"clock_info.settings.js","url":"settings.js"} + ], "data": [ + {"name":"clock_info.json","url":"lib.js"} + ] +} diff --git a/apps/clock_info/settings.js b/apps/clock_info/settings.js new file mode 100644 index 000000000..5844e812a --- /dev/null +++ b/apps/clock_info/settings.js @@ -0,0 +1,30 @@ +(function(back) { + let settings = require("clock_info").loadSettings(); + + function save(key, value) { + settings[key] = value; + require('Storage').write("clock_info.json", settings); + } + + let menu ={ + '': { 'title': 'Clock Info' }, + /*LANG*/'< Back': back, + /*LANG*/'Defocus on Lock': { + value: !!settings.defocusOnLock, + onchange: x => save('defocusOnLock', x), + }, + /*LANG*/'HRM': { + value: settings.hrmOn, + min: 0, max: 1, step: 1, + format: v => ["Always","Tap"][v], + onchange: x => save('hrmOn', x), + }, + /*LANG*/'Max Altitude': { + value: settings.maxAltitude, + min: 500, max: 10000, step: 500, + format: v => v+"m", + onchange: x => save('maxAltitude', x), + } + }; + E.showMenu(menu); +})() diff --git a/apps/lato/ChangeLog b/apps/lato/ChangeLog new file mode 100644 index 000000000..7e6c3b0d5 --- /dev/null +++ b/apps/lato/ChangeLog @@ -0,0 +1,2 @@ +0.01: first release +0.02: Use clock_info module as an app diff --git a/apps/lato/metadata.json b/apps/lato/metadata.json index 0b5e4a0f3..e4def2df9 100644 --- a/apps/lato/metadata.json +++ b/apps/lato/metadata.json @@ -1,7 +1,7 @@ { "id": "lato", "name": "Lato", - "version": "0.01", + "version": "0.02", "description": "A Lato Font clock with fast load and clock_info", "readme": "README.md", "icon": "app.png", @@ -9,6 +9,7 @@ "type": "clock", "tags": "clock", "supports": ["BANGLEJS2"], + "dependencies" : { "clock_info":"module" }, "storage": [ {"name":"lato.app.js","url":"app.js"}, {"name":"lato.img","url":"icon.js","evaluate":true} diff --git a/apps/lcdclock/ChangeLog b/apps/lcdclock/ChangeLog index 5560f00bc..220369925 100644 --- a/apps/lcdclock/ChangeLog +++ b/apps/lcdclock/ChangeLog @@ -1 +1,2 @@ 0.01: New App! +0.02: Use clock_info module as an app diff --git a/apps/lcdclock/metadata.json b/apps/lcdclock/metadata.json index d7d09b106..e286dc017 100644 --- a/apps/lcdclock/metadata.json +++ b/apps/lcdclock/metadata.json @@ -1,12 +1,13 @@ { "id": "lcdclock", "name": "LCD Clock", - "version":"0.01", + "version":"0.02", "description": "A Casio-style clock, with ClockInfo areas at the top and bottom. Tap them and swipe up/down to toggle between different information", "icon": "app.png", "screenshots": [{"url":"screenshot.png"}], "type": "clock", "tags": "clock,clkinfo", "supports" : ["BANGLEJS2"], + "dependencies" : { "clock_info":"module" }, "storage": [ {"name":"lcdclock.app.js","url":"app.js"}, {"name":"lcdclock.img","url":"app-icon.js","evaluate":true} diff --git a/apps/linuxclock/ChangeLog b/apps/linuxclock/ChangeLog index 71ca3afbb..5529034be 100644 --- a/apps/linuxclock/ChangeLog +++ b/apps/linuxclock/ChangeLog @@ -1,4 +1,5 @@ 0.01: New App. 0.02: Performance improvements. 0.03: Update clock_info to avoid a redraw -0.04: Fix clkinfo -- use .get instead of .show \ No newline at end of file +0.04: Fix clkinfo -- use .get instead of .show +0.05: Use clock_info module as an app diff --git a/apps/linuxclock/metadata.json b/apps/linuxclock/metadata.json index 68915b832..412fd53b4 100644 --- a/apps/linuxclock/metadata.json +++ b/apps/linuxclock/metadata.json @@ -1,7 +1,7 @@ { "id": "linuxclock", "name": "Linux Clock", - "version": "0.04", + "version": "0.05", "description": "A Linux inspired clock.", "readme": "README.md", "icon": "app.png", @@ -9,7 +9,7 @@ "type": "clock", "tags": "clock", "supports": ["BANGLEJS2"], - "allow_emulator": true, + "dependencies" : { "clock_info":"module" }, "storage": [ {"name":"linuxclock.app.js","url":"app.js"}, {"name":"linuxclock.img","url":"app-icon.js","evaluate":true}, diff --git a/apps/simplestpp/ChangeLog b/apps/simplestpp/ChangeLog index 4db8559c8..51186fbdb 100644 --- a/apps/simplestpp/ChangeLog +++ b/apps/simplestpp/ChangeLog @@ -1,2 +1,3 @@ 0.01: first release 0.02: removed fast load, minimalism is useful for narrowing down on issues +0.03: Use clock_info module as an app diff --git a/apps/simplestpp/metadata.json b/apps/simplestpp/metadata.json index 145bf7309..93ae72bbe 100644 --- a/apps/simplestpp/metadata.json +++ b/apps/simplestpp/metadata.json @@ -2,7 +2,7 @@ "id": "simplestpp", "name": "Simplest++ Clock", "shortName": "Simplest++", - "version": "0.02", + "version": "0.03", "description": "The simplest working clock, with clock_info, acts as a tutorial piece", "readme": "README.md", "icon": "app.png", @@ -10,6 +10,7 @@ "type": "clock", "tags": "clock", "supports": ["BANGLEJS2"], + "dependencies" : { "clock_info":"module" }, "storage": [ {"name":"simplestpp.app.js","url":"app.js"}, {"name":"simplestpp.img","url":"icon.js","evaluate":true} diff --git a/apps/slopeclockpp/ChangeLog b/apps/slopeclockpp/ChangeLog index 58299b236..c9fb0de7a 100644 --- a/apps/slopeclockpp/ChangeLog +++ b/apps/slopeclockpp/ChangeLog @@ -9,3 +9,4 @@ 0.07: README file update as UI interaction was not easy to understand 0.08: Stability improvements - ensure we continue even if a flat string can't be allocated Stop ClockInfo text drawing outside the allocated area +0.09: Use clock_info module as an app diff --git a/apps/slopeclockpp/app.js b/apps/slopeclockpp/app.js index dca4a84e4..b57650f9e 100644 --- a/apps/slopeclockpp/app.js +++ b/apps/slopeclockpp/app.js @@ -141,8 +141,8 @@ let clockInfoDraw = (itm, info, options) => { g.setClipRect(0,0,g.getWidth()-1, g.getHeight()-1); }; let clockInfoItems = require("clock_info").load(); -let clockInfoMenu = require("clock_info").addInteractive(clockInfoItems, { x:126, y:24, w:50, h:40, draw : clockInfoDraw, bg : g.theme.bg, fg : g.theme.fg, hl : "#f00"/*red*/ }); -let clockInfoMenu2 = require("clock_info").addInteractive(clockInfoItems, { x:0, y:115, w:50, h:40, draw : clockInfoDraw, bg : bgColor, fg : g.theme.bg, hl : (bgColor=="#000")?"#f00"/*red*/:g.theme.fg }); +let clockInfoMenu = require("clock_info").addInteractive(clockInfoItems, { app:"slopeclockpp",x:126, y:24, w:50, h:40, draw : clockInfoDraw, bg : g.theme.bg, fg : g.theme.fg, hl : "#f00"/*red*/ }); +let clockInfoMenu2 = require("clock_info").addInteractive(clockInfoItems, { app:"slopeclockpp",x:0, y:115, w:50, h:40, draw : clockInfoDraw, bg : bgColor, fg : g.theme.bg, hl : (bgColor=="#000")?"#f00"/*red*/:g.theme.fg }); // Show launcher when middle button pressed Bangle.setUI({ diff --git a/apps/slopeclockpp/metadata.json b/apps/slopeclockpp/metadata.json index fbab02fca..30bc2ea3e 100644 --- a/apps/slopeclockpp/metadata.json +++ b/apps/slopeclockpp/metadata.json @@ -1,12 +1,13 @@ { "id": "slopeclockpp", "name": "Slope Clock ++", - "version":"0.08", + "version":"0.09", "description": "A clock where hours and minutes are divided by a sloping line. When the minute changes, the numbers slide off the screen. This is a clone of the original Slope Clock which shows extra information and allows the colors to be selected.", "icon": "app.png", "screenshots": [{"url":"screenshot.png"}], "type": "clock", "tags": "clock", "supports" : ["BANGLEJS2"], + "dependencies" : { "clock_info":"module" }, "readme": "README.md", "storage": [ {"name":"slopeclockpp.app.js","url":"app.js"},