diff --git a/apps/coin_info/app.js b/apps/coin_info/app.js index 3b164e4cd..9c73f920b 100644 --- a/apps/coin_info/app.js +++ b/apps/coin_info/app.js @@ -2,16 +2,53 @@ Bangle.loadWidgets(); Bangle.drawWidgets(); + const settings = require("Storage").readJSON("coin_info.settings.json", 1) || {}; + const db = require("Storage").readJSON("coin_info.cmc_key.json", 1) || {}; + let ticker = 0; + var Layout = require("Layout"); - var layout = new Layout( { + var layout = new Layout({ type:"v", c: [ - {type:"txt", font:"20%", label:"12:00", id:"time" }, - {type:"txt", font:"6x8", label:"The Date", id:"date" } + {type:"h", + c: [ + {type:"txt", id:"tknName", label:"Load...", halign:"left"}, + {type:"btn", label:"...", halign:"right", cb: l=>{}} + ] + }, + {type:"txt", id:"tknGraph", font:"20%", label:"12:00", id:"time" }, + {type:"h", + c: [ + {type:"btn", label:"07", cb: l=>{}}, + {type:"btn", label:"14", cb: l=>{}}, + {type:"btn", label:"30", cb: l=>{}}, + {type:"btn", label:"60", cb: l=>{}} + ] + } ] - }); + }, { lazy:true }); + layout.update(); + + // timeout used to update every minute + var drawTimeout; + // update the screen + function draw() { + // + layout.tknName.label = settings.tokenSelected[ticker]; + layout.render(); + + // schedule a draw for the next minute + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = setTimeout(function() { + drawTimeout = undefined; + draw(); + }, 60000 - (Date.now() % 60000)); + } + + // update time and draw g.clear(); - layout.render(); - + draw(); + + // Bangle.setUI({ mode : 'custom', back : Bangle.showClock, diff --git a/apps/coin_info/metadata.json b/apps/coin_info/metadata.json index 01ffef3c9..bb53a56b5 100644 --- a/apps/coin_info/metadata.json +++ b/apps/coin_info/metadata.json @@ -1,7 +1,7 @@ { "id": "coin_info", "name": "Crypto-Coins Info", "shortName":"Coins Info", - "version": "0.06.00", + "version": "0.06.01", "description": "Crypto-Coins Infos with the help of the Binance API", "icon": "app.png", "tags": "clkinfo",