Merge pull request #2492 from thyttan/add-widget-utils

[lcars/notanalog/limelight/daisy/thering/widviz/90sclk/widviztime/neonx] Add widget utils
pull/2494/head
Gordon Williams 2023-01-12 13:22:49 +00:00 committed by GitHub
commit 46dca3a686
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 49 additions and 58 deletions

View File

@ -1,3 +1,4 @@
0.01: New App!
0.02: Fullscreen settings.
0.03: Tell clock widgets to hide.
0.04: Use widget_utils.

View File

@ -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();
}

View File

@ -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",

View File

@ -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.

View File

@ -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();

View File

@ -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",

View File

@ -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.

View File

@ -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();
}

View File

@ -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.",

View File

@ -1,2 +1,4 @@
0.01: first release
0.02: Tell clock widgets to hide.
0.03: Use widget_utils.

View File

@ -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) {

View File

@ -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",

View File

@ -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
0.05: Better lock/unlock animation
0.06: Use widget_utils.

View File

@ -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",

View File

@ -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();
draw();

View File

@ -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.
0.05: Use internal step counter if no widget is available.
0.06: Use widget_utils.

View File

@ -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.",

View File

@ -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();

2
apps/thering/ChangeLog Normal file
View File

@ -0,0 +1,2 @@
0.01: Initial release.
0.02: Use widget_utils.

View File

@ -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);

View File

@ -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",

View File

@ -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.

View File

@ -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",

View File

@ -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(){

View File

@ -1 +1,2 @@
0.01: New Widget, forked from widviz
0.02: Use widget_utils.

View File

@ -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",

View File

@ -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() {