mirror of https://github.com/espruino/BangleApps
minor readability tweak when checking for messages
parent
3e09813143
commit
097730245a
|
@ -149,11 +149,11 @@ function drawHSeg(x1,y1,x2,y2,Num,Color,Size) {
|
|||
if (Color == "fg") {
|
||||
g.setColor(g.theme.fg);
|
||||
} else {
|
||||
g.setColor(mColor[0],mColor[1],mColor[2]);
|
||||
g.setColor(mColor[0],mColor[1],mColor[2]);
|
||||
}
|
||||
g.fillCircle(x1+Dx+(i-1)*(x2-x1)/7,y1+Dy+(j-1)*(y2-y1)/7,Size);
|
||||
} else {
|
||||
g.setColor(bColor[0],bColor[1],bColor[2]);
|
||||
g.setColor(bColor[0],bColor[1],bColor[2]);
|
||||
g.fillCircle(x1+Dx+(i-1)*(x2-x1)/7,y1+Dy+(j-1)*(y2-y1)/7,1);
|
||||
}
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ function drawSSeg(x1,y1,x2,y2,Num,Color,Size) {
|
|||
for (let j = 1; j < 8; j++) {
|
||||
if (Font[Num][j-1][i-1] == 1) {
|
||||
if (Color == "fg") {
|
||||
g.setColor(sColor[0],sColor[1],sColor[2]);
|
||||
g.setColor(sColor[0],sColor[1],sColor[2]);
|
||||
} else {
|
||||
g.setColor(g.theme.fg);
|
||||
//g.setColor(0.7,0.7,0.7);
|
||||
|
@ -253,8 +253,8 @@ function actions(v){
|
|||
if(BTN1.read() === true) {
|
||||
print("BTN pressed");
|
||||
Bangle.showLauncher();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(v==-1){
|
||||
print("up swipe event");
|
||||
if(settings.swupApp != "") load(settings.swupApp);
|
||||
|
@ -269,7 +269,7 @@ function actions(v){
|
|||
}
|
||||
|
||||
// Get Messages status
|
||||
var messages_installed = require("Storage").list(/^messages$/).length > 0;
|
||||
var messages_installed = require("Storage").read("messages") !== undefined;
|
||||
|
||||
//var BTconnected = NRF.getSecurityStatus().connected;
|
||||
//NRF.on('connect',BTconnected = NRF.getSecurityStatus().connected);
|
||||
|
@ -289,27 +289,27 @@ function drawWidgeds() {
|
|||
g.setColor((g.getBPP()>8) ? "#07f" : (g.theme.dark ? "#0ff" : "#00f"));
|
||||
else
|
||||
g.setColor(g.theme.dark ? "#666" : "#999");
|
||||
g.drawImage(atob("CxQBBgDgFgJgR4jZMawfAcA4D4NYybEYIwTAsBwDAA=="),x1Bt,y1Bt);
|
||||
g.drawImage(atob("CxQBBgDgFgJgR4jZMawfAcA4D4NYybEYIwTAsBwDAA=="),x1Bt,y1Bt);
|
||||
|
||||
|
||||
|
||||
//Battery
|
||||
//print(E.getBattery());
|
||||
//print(Bangle.isCharging());
|
||||
|
||||
|
||||
var x1B = 130;
|
||||
var y1B = 2;
|
||||
var x2B = x1B + 20;
|
||||
var y2B = y1B + 15;
|
||||
|
||||
|
||||
g.setColor(g.theme.bg);
|
||||
g.clearRect(x1B,y1B,x2B,y2B);
|
||||
|
||||
|
||||
g.setColor(g.theme.fg);
|
||||
g.drawRect(x1B,y1B,x2B,y2B);
|
||||
g.fillRect(x1B,y1B,x1B+(E.getBattery()*(x2B-x1B)/100),y2B);
|
||||
g.fillRect(x2B,y1B+(y2B-y1B)/2-3,x2B+4,y1B+(y2B-y1B)/2+3);
|
||||
|
||||
|
||||
|
||||
|
||||
//Messages
|
||||
|
||||
|
@ -325,18 +325,18 @@ function drawWidgeds() {
|
|||
g.drawLine(x1M,y1M,x1M+(x2M-x1M)/2,y1M+(y2M-y1M)/2);
|
||||
g.drawLine(x1M+(x2M-x1M)/2,y1M+(y2M-y1M)/2,x2M,y1M);
|
||||
}
|
||||
|
||||
|
||||
var strDow = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];
|
||||
var d = new Date();
|
||||
var dow = d.getDay(),day = d.getDate(), month = d.getMonth() + 1, year = d.getFullYear();
|
||||
|
||||
print(strDow[dow] + ' ' + day + '.' + month + ' ' + year);
|
||||
|
||||
|
||||
g.setColor(g.theme.fg);
|
||||
g.setFontAlign(-1, -1,0);
|
||||
g.setFont("Vector", 20);
|
||||
g.drawString(strDow[dow] + ' ' + day, 0, 0, true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -354,7 +354,7 @@ function SetFull(on) {
|
|||
} else {
|
||||
Ys = 30;
|
||||
Bangle.setUI("updown",actions);
|
||||
Bangle.on('swipe', function(direction) {
|
||||
Bangle.on('swipe', function(direction) {
|
||||
switch (direction) {
|
||||
case 1:
|
||||
print("swipe left event");
|
||||
|
@ -362,7 +362,7 @@ function SetFull(on) {
|
|||
print(settings.swleftApp);
|
||||
break;
|
||||
case -1:
|
||||
print("swipe right event");
|
||||
print("swipe right event");
|
||||
if(settings.swrightApp != "") load(settings.swrightApp);
|
||||
print(settings.swrightApp);
|
||||
break;
|
||||
|
@ -374,7 +374,7 @@ function SetFull(on) {
|
|||
|
||||
SegH = (Ye-Ys)/2;
|
||||
Dy = SegH/16;
|
||||
|
||||
|
||||
draw();
|
||||
|
||||
if (on != true) {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// Numbers Rect order (left, top, right, bottom)
|
||||
// Each number defines a set of rects to draw
|
||||
|
||||
const numbers =
|
||||
const numbers =
|
||||
[
|
||||
[// Zero
|
||||
[0, 0, 1, 0.2],
|
||||
|
@ -64,7 +64,7 @@ const numbers =
|
|||
[0, 0.8, 1, 1],
|
||||
[0, 0, 0.1, 0.6],
|
||||
[0.9, 0, 1, 1]
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
const months = [ "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" ];
|
||||
|
@ -103,7 +103,7 @@ function updateTime()
|
|||
let mo = now.getMonth();
|
||||
let y = now.getFullYear();
|
||||
let d = now.getDate();
|
||||
|
||||
|
||||
if(h != hour)
|
||||
{
|
||||
hour = h;
|
||||
|
@ -127,7 +127,7 @@ function updateTime()
|
|||
day = d;
|
||||
g.setFont("6x8", 2);
|
||||
g.setFontAlign(0, -1, 0);
|
||||
g.drawString(fmtDate(d,mo,y,hour), 120, 120);
|
||||
g.drawString(fmtDate(d,mo,y,hour), 120, 120);
|
||||
}
|
||||
drawMessages();
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ function drawDigits(x, value)
|
|||
{
|
||||
if(!Bangle.isLCDOn()) // No need to draw when LCD Off
|
||||
return;
|
||||
|
||||
|
||||
drawChar(Math.floor(value/10), 15, x, 115, x+50);
|
||||
if(value%10 == 1)
|
||||
drawChar(value%10, 55, x, 155, x+50);
|
||||
|
@ -228,7 +228,7 @@ function flipColors()
|
|||
// MESSAGE HANDLING()
|
||||
//
|
||||
|
||||
let messages_installed = require("Storage").list(/^messages$/).length > 0;
|
||||
let messages_installed = require("Storage").read("messages") !== undefined;
|
||||
|
||||
function handleMessages()
|
||||
{
|
||||
|
@ -255,7 +255,7 @@ function drawMessages()
|
|||
g.setFont("6x8", 2);
|
||||
g.setFontAlign(0, -1, 0);
|
||||
g.drawString(">", 224, 216);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g.setColor(0,0,0);
|
||||
|
|
Loading…
Reference in New Issue