diff --git a/apps/patriotclk/ChangeLog b/apps/patriotclk/ChangeLog new file mode 100644 index 000000000..5560f00bc --- /dev/null +++ b/apps/patriotclk/ChangeLog @@ -0,0 +1 @@ +0.01: New App! diff --git a/apps/patriotclk/app-icon.js b/apps/patriotclk/app-icon.js new file mode 100644 index 000000000..49232b838 --- /dev/null +++ b/apps/patriotclk/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwwJC/AH4A/AH4AgA==")) diff --git a/apps/patriotclk/app-preview-btm.png b/apps/patriotclk/app-preview-btm.png new file mode 100644 index 000000000..98008996b Binary files /dev/null and b/apps/patriotclk/app-preview-btm.png differ diff --git a/apps/patriotclk/app-preview.png b/apps/patriotclk/app-preview.png new file mode 100644 index 000000000..b79009c94 Binary files /dev/null and b/apps/patriotclk/app-preview.png differ diff --git a/apps/patriotclk/app.js b/apps/patriotclk/app.js new file mode 100644 index 000000000..4c3ed2d0f --- /dev/null +++ b/apps/patriotclk/app.js @@ -0,0 +1,71 @@ +Graphics.prototype.setFontAudiowide = function() { + // Actual height 33 (36 - 4) + return this.setFontCustom( + E.toString(require('heatshrink').decompress(atob('AB/wAgcB/AFVgFgHbkYAok4AogvEgYFEg4FEj4FEn4FE//gKQf/4AcD/4QDh/8Djf+DhN/T4YcFgYcKh4cEh68Eh4cDAoOAAocORYkMf1JxBIYcf/6PDn//MIYEB/5KBOIIABKwIFFO4V/UQMHEIMfFQMHAQP3AQJ3BDIKABh/ggf7ApHAg/5AonxAocPAokf8IFE4IFDn4FEv+BAokBAof/AofB/wFE/gFD4YFE4/4AohgBAoXPAonvMAIFD4AFCVgIFBQYX3wCGCR4T+CTYqtLX4rLC/zXIcYoAQQYIFiJoR9CArgAlToIpDRQIFDSwI7C4CiBApN/Apb1D4F+Av4Fd8H+Aof/AoaTB/gFIgaBBAoSrB+AFCgF/8AFDAESP/Av3wv0HZYYABYoYAB+AFGZYIAB8DLCAAPAZYQFBZUhHC/gFE/wFaAAN+Av4Fqv53EboYFdAFIvB4EBGofwAon4Aon8ApX+AofAAot+Av4Fev8DAojFDAo0/S4IFGAAMf//gV4mAAoUD/zYgFwP8AoRGB/4FCAgI1CgIFC4A5BAoRHBg4FCKYMH/l+n5fC+F+g5rC8F+PoYFFZf7XVw7XNAALXNTYLXCVoYAQF4IFZjAFEnAFELIZCBAojRDAoMfAol/AohrCAoJfBNYIFBNYOAAoUf/xBDv/8AoXBRAcP4aCDh/PDgSNCDgQFCHIIFDUoafFAoJ3EGYQFCDgYFBXgZuBGYQAba4pDEhzvE/4ABKoMBAogbBAAJKBg4EBw4FEX4Z9BgIFC8AFE4F+Av5HFKYhfFAoRxCO4qDFgF/AokATYgfCZwcD/zTdAAV/Z4RBCHIZNBJYI5D/gFFOJEP+DF/a7N+ZYQFG+F+g7XFRYIFFbobLBboajCAoTRCcYTiEUQYAdgYCBsACBMwJlCAqUHJYLxDAAMgHSQ'))), + 46, + atob("CiAsESQjJSQkHyQkDA=="), + 48|65536 + ); +}; + +{ + + let img = require("Storage").read("patriotclk.bg.img"); + let options = require("Storage").readJSON("patriotclk.opts",1)||{}; + + // timeout used to update every minute + let drawTimeout; + + // draw everything + let draw = function() { + var x = g.getWidth()/2; + var y; + if (options.bottomText) + y = g.getHeight() - 24; + else + y = 4+(g.getHeight())/2; // middle + g.reset(); + g.drawImage(img,0,0); + // work out locale-friendly date/time + var date = new Date(); + var timeStr = require("locale").time(date,1); + var dateStr = require("locale").date(date); + // draw time + g.setFontAlign(0,0).setFont("Audiowide"); + // draw a shadow by shifting left/right/up/down + g.drawString(timeStr,x-6,y); + g.drawString(timeStr,x+6,y); + g.drawString(timeStr,x,y-6); + g.drawString(timeStr,x,y+6); + g.drawString(timeStr,x-4,y+4); + g.drawString(timeStr,x+4,y+4); + g.drawString(timeStr,x-4,y-4); + g.drawString(timeStr,x+4,y-4); + // finally draw in the foreground color + g.setColor(g.theme.bg).drawString(timeStr,x,y); + // draw date + //y += 35; + //g.setFontAlign(0,0).setFont("6x8").g.setColor(g.theme.fg); + //g.drawString(dateStr,x,y); + // queue draw in one minute + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = setTimeout(function() { + drawTimeout = undefined; + draw(); + }, 60000 - (Date.now() % 60000)); + }; + + // Clear the screen once, at startup + g.clear(); + // draw immediately at first, queue update + draw(); + // Show launcher when middle button pressed + Bangle.setUI({mode:"clock", remove:function() { //f ree memory + if (drawTimeout) clearTimeout(drawTimeout); + delete Graphics.prototype.setFontAudiowide; + require("widget_utils").cleanup(); + }}); + // Load widgets (make them swipeable) + Bangle.loadWidgets(); + require("widget_utils").swipeOn(); +} \ No newline at end of file diff --git a/apps/patriotclk/app.png b/apps/patriotclk/app.png new file mode 100644 index 000000000..781ab8c60 Binary files /dev/null and b/apps/patriotclk/app.png differ diff --git a/apps/patriotclk/custom.html b/apps/patriotclk/custom.html new file mode 100644 index 000000000..a8d0ba4a6 --- /dev/null +++ b/apps/patriotclk/custom.html @@ -0,0 +1,133 @@ + +
+ + + + +Please choose your country's flag:
+ +Is your flag not here? Please add it here!
+Click
+ + + + + + + + + + + \ No newline at end of file diff --git a/apps/patriotclk/img/README.md b/apps/patriotclk/img/README.md new file mode 100644 index 000000000..53c26165c --- /dev/null +++ b/apps/patriotclk/img/README.md @@ -0,0 +1,9 @@ +Flags +------ + +These flags come from https://icons8.com/icon/set/flags/color and are 480x480px + +If you want to add your own flag ensure it's in the same style and then also list the image file in custom.html in the root directory. + +If your flag is listed in https://icons8.com/icon/set/flags/color and you can't download it in the right size, please file an issue and we'll download it with our account. + diff --git a/apps/patriotclk/img/icons8-australia-480.png b/apps/patriotclk/img/icons8-australia-480.png new file mode 100644 index 000000000..edf34cdee Binary files /dev/null and b/apps/patriotclk/img/icons8-australia-480.png differ diff --git a/apps/patriotclk/img/icons8-belgium-480.png b/apps/patriotclk/img/icons8-belgium-480.png new file mode 100644 index 000000000..395fef8d1 Binary files /dev/null and b/apps/patriotclk/img/icons8-belgium-480.png differ diff --git a/apps/patriotclk/img/icons8-england-480.png b/apps/patriotclk/img/icons8-england-480.png new file mode 100644 index 000000000..5c9a836a6 Binary files /dev/null and b/apps/patriotclk/img/icons8-england-480.png differ diff --git a/apps/patriotclk/img/icons8-flag-of-europe-480.png b/apps/patriotclk/img/icons8-flag-of-europe-480.png new file mode 100644 index 000000000..654da87ba Binary files /dev/null and b/apps/patriotclk/img/icons8-flag-of-europe-480.png differ diff --git a/apps/patriotclk/img/icons8-france-480.png b/apps/patriotclk/img/icons8-france-480.png new file mode 100644 index 000000000..e3cb56348 Binary files /dev/null and b/apps/patriotclk/img/icons8-france-480.png differ diff --git a/apps/patriotclk/img/icons8-germany-480.png b/apps/patriotclk/img/icons8-germany-480.png new file mode 100644 index 000000000..0f86aa568 Binary files /dev/null and b/apps/patriotclk/img/icons8-germany-480.png differ diff --git a/apps/patriotclk/img/icons8-great-britain-480.png b/apps/patriotclk/img/icons8-great-britain-480.png new file mode 100644 index 000000000..0acdcc191 Binary files /dev/null and b/apps/patriotclk/img/icons8-great-britain-480.png differ diff --git a/apps/patriotclk/img/icons8-greece-480.png b/apps/patriotclk/img/icons8-greece-480.png new file mode 100644 index 000000000..319cf93cb Binary files /dev/null and b/apps/patriotclk/img/icons8-greece-480.png differ diff --git a/apps/patriotclk/img/icons8-hungary-480.png b/apps/patriotclk/img/icons8-hungary-480.png new file mode 100644 index 000000000..ab838afea Binary files /dev/null and b/apps/patriotclk/img/icons8-hungary-480.png differ diff --git a/apps/patriotclk/img/icons8-italy-480.png b/apps/patriotclk/img/icons8-italy-480.png new file mode 100644 index 000000000..f917cd85a Binary files /dev/null and b/apps/patriotclk/img/icons8-italy-480.png differ diff --git a/apps/patriotclk/img/icons8-lgbt-flag-480.png b/apps/patriotclk/img/icons8-lgbt-flag-480.png new file mode 100644 index 000000000..10f869a0a Binary files /dev/null and b/apps/patriotclk/img/icons8-lgbt-flag-480.png differ diff --git a/apps/patriotclk/img/icons8-scotland-480.png b/apps/patriotclk/img/icons8-scotland-480.png new file mode 100644 index 000000000..991652211 Binary files /dev/null and b/apps/patriotclk/img/icons8-scotland-480.png differ diff --git a/apps/patriotclk/img/icons8-switzerland-480.png b/apps/patriotclk/img/icons8-switzerland-480.png new file mode 100644 index 000000000..801ba4776 Binary files /dev/null and b/apps/patriotclk/img/icons8-switzerland-480.png differ diff --git a/apps/patriotclk/img/icons8-ukraine-480.png b/apps/patriotclk/img/icons8-ukraine-480.png new file mode 100644 index 000000000..3762c1112 Binary files /dev/null and b/apps/patriotclk/img/icons8-ukraine-480.png differ diff --git a/apps/patriotclk/img/icons8-usa-480.png b/apps/patriotclk/img/icons8-usa-480.png new file mode 100644 index 000000000..d6288404e Binary files /dev/null and b/apps/patriotclk/img/icons8-usa-480.png differ diff --git a/apps/patriotclk/img/icons8-wales-480.png b/apps/patriotclk/img/icons8-wales-480.png new file mode 100644 index 000000000..6c2941342 Binary files /dev/null and b/apps/patriotclk/img/icons8-wales-480.png differ diff --git a/apps/patriotclk/metadata.json b/apps/patriotclk/metadata.json new file mode 100644 index 000000000..7c8752000 --- /dev/null +++ b/apps/patriotclk/metadata.json @@ -0,0 +1,18 @@ +{ "id": "patriotclk", + "name": "Patriotic Clock", + "shortName":"Patriot", + "version":"0.01", + "description": "Show your Patriotism with your Country's flag as a clock face (configurable)", + "icon": "app.png", + "screenshots": [{"url":"screenshot.png"}], + "type": "clock", + "tags": "clock,flag", + "supports" : ["BANGLEJS2"], + "custom": "custom.html", + "storage": [ + {"name":"patriotclk.app.js","url":"app.js"}, + {"name":"patriotclk.bg.img"}, + {"name":"patriotclk.opts"}, + {"name":"patriotclk.img","url":"app-icon.js","evaluate":true} + ] +} diff --git a/apps/patriotclk/screenshot.png b/apps/patriotclk/screenshot.png new file mode 100644 index 000000000..1f8b1f5f5 Binary files /dev/null and b/apps/patriotclk/screenshot.png differ