mirror of https://github.com/espruino/BangleApps
Fix widgets that clear too low, and make widget swipeOn have a 2px border at the bottom
parent
1c95dacc26
commit
6bdb7dc0ad
|
@ -1,2 +1,3 @@
|
||||||
0.01: New widget
|
0.01: New widget
|
||||||
0.02: Make color depend on level
|
0.02: Make color depend on level
|
||||||
|
0.03: Stop battery widget clearing too far down
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "widbatv",
|
"id": "widbatv",
|
||||||
"name": "Battery Level Widget (Vertical)",
|
"name": "Battery Level Widget (Vertical)",
|
||||||
"version": "0.02",
|
"version": "0.03",
|
||||||
"description": "Slim, vertical battery widget that only takes up 14px",
|
"description": "Slim, vertical battery widget that only takes up 14px",
|
||||||
"icon": "widget.png",
|
"icon": "widget.png",
|
||||||
"type": "widget",
|
"type": "widget",
|
||||||
|
|
|
@ -12,7 +12,7 @@ WIDGETS["batv"]={area:"tr",width:14,draw:function() {
|
||||||
if (Bangle.isCharging()) {
|
if (Bangle.isCharging()) {
|
||||||
g.setColor("#0f0").drawImage(atob("DhgBHOBzgc4HOP////////////////////3/4HgB4AeAHgB4AeAHgB4AeAHg"),x,y);
|
g.setColor("#0f0").drawImage(atob("DhgBHOBzgc4HOP////////////////////3/4HgB4AeAHgB4AeAHgB4AeAHg"),x,y);
|
||||||
} else {
|
} else {
|
||||||
g.clearRect(x,y,x+14,y+24);
|
g.clearRect(x,y,x+14,y+23);
|
||||||
g.setColor(g.theme.fg).fillRect(x+2,y+2,x+12,y+22).clearRect(x+4,y+4,x+10,y+20).fillRect(x+5,y+1,x+9,y+2);
|
g.setColor(g.theme.fg).fillRect(x+2,y+2,x+12,y+22).clearRect(x+4,y+4,x+10,y+20).fillRect(x+5,y+1,x+9,y+2);
|
||||||
var battery = E.getBattery();
|
var battery = E.getBattery();
|
||||||
if (battery < 20) {g.setColor("#f00");}
|
if (battery < 20) {g.setColor("#f00");}
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
0.01: New Widget!
|
0.01: New Widget!
|
||||||
0.02: Now use an app ID (to avoid conflicts with clocks that also use ClockInfo)
|
0.02: Now use an app ID (to avoid conflicts with clocks that also use ClockInfo)
|
||||||
|
0.03: Fix widget clearing too far down
|
|
@ -1,6 +1,6 @@
|
||||||
{ "id": "widclkinfo",
|
{ "id": "widclkinfo",
|
||||||
"name": "Clock Info Widget",
|
"name": "Clock Info Widget",
|
||||||
"version":"0.02",
|
"version":"0.03",
|
||||||
"description": "Use 'Clock Info' in the Widget bar. Tap on the widget to select, then drag up/down/left/right to choose what information is displayed.",
|
"description": "Use 'Clock Info' in the Widget bar. Tap on the widget to select, then drag up/down/left/right to choose what information is displayed.",
|
||||||
"icon": "widget.png",
|
"icon": "widget.png",
|
||||||
"screenshots" : [ { "url":"screenshot.png" }],
|
"screenshots" : [ { "url":"screenshot.png" }],
|
||||||
|
|
|
@ -32,7 +32,7 @@ if (!require("clock_info").loadCount) { // don't load if a clock_info was alread
|
||||||
// indicate focus - make background reddish
|
// indicate focus - make background reddish
|
||||||
//if (clockInfoMenu.focus) g.setBgColor(g.blendColor(g.theme.bg, "#f00", 0.25));
|
//if (clockInfoMenu.focus) g.setBgColor(g.blendColor(g.theme.bg, "#f00", 0.25));
|
||||||
if (clockInfoMenu.focus) g.setColor("#f00");
|
if (clockInfoMenu.focus) g.setColor("#f00");
|
||||||
g.clearRect(o.x, o.y, o.x+o.w-1, o.y+o.h);
|
g.clearRect(o.x, o.y, o.x+o.w-1, o.y+o.h-1);
|
||||||
if (clockInfoInfo) {
|
if (clockInfoInfo) {
|
||||||
var x = o.x;
|
var x = o.x;
|
||||||
if (clockInfoInfo.img) {
|
if (clockInfoInfo.img) {
|
||||||
|
|
|
@ -70,13 +70,13 @@ exports.swipeOn = function(autohide) {
|
||||||
// force app rect to be fullscreen
|
// force app rect to be fullscreen
|
||||||
Bangle.appRect = { x: 0, y: 0, w: g.getWidth(), h: g.getHeight(), x2: g.getWidth()-1, y2: g.getHeight()-1 };
|
Bangle.appRect = { x: 0, y: 0, w: g.getWidth(), h: g.getHeight(), x2: g.getWidth()-1, y2: g.getHeight()-1 };
|
||||||
// setup offscreen graphics for widgets
|
// setup offscreen graphics for widgets
|
||||||
let og = Graphics.createArrayBuffer(g.getWidth(),24,16,{msb:true});
|
let og = Graphics.createArrayBuffer(g.getWidth(),26,16,{msb:true});
|
||||||
og.theme = g.theme;
|
og.theme = g.theme;
|
||||||
og._reset = og.reset;
|
og._reset = og.reset;
|
||||||
og.reset = function() {
|
og.reset = function() {
|
||||||
return this._reset().setColor(g.theme.fg).setBgColor(g.theme.bg);
|
return this._reset().setColor(g.theme.fg).setBgColor(g.theme.bg);
|
||||||
};
|
};
|
||||||
og.reset().clearRect(0,0,og.getWidth(),og.getHeight());
|
og.reset().clearRect(0,0,og.getWidth(),23).fillRect(0,24,og.getWidth(),25);
|
||||||
let _g = g;
|
let _g = g;
|
||||||
let offset = -24; // where on the screen are we? -24=hidden, 0=full visible
|
let offset = -24; // where on the screen are we? -24=hidden, 0=full visible
|
||||||
|
|
||||||
|
@ -146,4 +146,4 @@ exports.swipeOn = function(autohide) {
|
||||||
};
|
};
|
||||||
Bangle.on("swipe", exports.swipeHandler);
|
Bangle.on("swipe", exports.swipeHandler);
|
||||||
Bangle.drawWidgets();
|
Bangle.drawWidgets();
|
||||||
};
|
};
|
Loading…
Reference in New Issue