Merge remote-tracking branch 'upstream/master'

pull/3018/head
Hugh Barney 2023-09-18 21:50:43 +01:00
commit b469b0ba01
10 changed files with 56 additions and 32 deletions

View File

@ -10,3 +10,4 @@
0.28: More config options for cleaner look, enabled fast loading
0.29: Fixed a bug that would leave old font files in storage.
0.30: Added options to show widgets and date on twist and tap. New fonts.
0.31: Bugfix, no more freeze.

View File

@ -34,9 +34,12 @@
extrasTimeout = undefined;
hideExtras();
}, 5000);
extrasShown = false;
};
let drawExtras = function() { //draw date, day of the week and widgets
let date = new Date();
g.reset();
g.clearRect(0, 138, g.getWidth() - 1, 176);
g.setFont("Teletext10x18Ascii").setFontAlign(0, 1);
if (settings.weekday) g.drawString(require("locale").dow(date).toUpperCase(), g.getWidth() / 2, g.getHeight() - 18);
if (settings.date) g.drawString(require('locale').date(date, 1), g.getWidth() / 2, g.getHeight());
@ -45,21 +48,23 @@
};
let hideExtras = function() {
if (extrasTimeout) clearTimeout(extrasTimeout);
extrasTimeout = undefined; //NEW
g.reset();
g.clearRect(0, 138, g.getWidth() - 1, 176);
require("widget_utils").hide();
extrasShown = false;
extrasShown = false; ///NEW
};
let draw = function() {
if (drawTimeout) clearTimeout(drawTimeout); //NEW
drawTimeout = setTimeout(function() {
drawTimeout = undefined;
draw();
}, 60000 - (Date.now() % 60000));
let date = new Date();
g.reset();
if (extrasShown) drawExtras();
else hideExtras();
require('contourclock').drawClock(settings.fontIndex);
if (drawTimeout) clearTimeout(drawTimeout);
drawTimeout = setTimeout(function() {
drawTimeout = undefined;
draw();
}, 60000 - (Date.now() % 60000));
};
if (settings.hideWhenLocked) {
onLock = locked => {
@ -83,6 +88,8 @@
Bangle.removeListener('twist', showExtras);
if (drawTimeout) clearTimeout(drawTimeout);
if (extrasTimeout) clearTimeout(extrasTimeout);
drawTimeout = undefined;
extrasTimeout = undefined;
if (settings.hideWhenLocked) require("widget_utils").show();
g.reset();
g.clear();
@ -91,7 +98,7 @@
g.clear();
if (settings.widgets) {
Bangle.loadWidgets();
Bangle.drawWidgets();
setTimeout(Bangle.drawWidgets,0); //NEW
}
draw();
}

View File

@ -1,7 +1,7 @@
{ "id": "contourclock",
"name": "Contour Clock",
"shortName" : "Contour Clock",
"version":"0.30",
"version":"0.31",
"icon": "app.png",
"readme": "README.md",
"description": "A Minimalist clockface with large Digits.",

View File

@ -1,3 +1,4 @@
0.01: New app!
0.02-0.04: Bug fixes
0.05: Submitted to the app loader
0.05: Submitted to the app loader
0.06: Added setting to show clock after start/resume

View File

@ -1,3 +1,5 @@
g.clear();
Bangle.POMOPLUS_ACTIVE = true; //Prevent the boot code from running. To avoid having to reload on every interaction, we'll control the vibrations from here when the user is in the app.
const storage = require("Storage");
@ -13,32 +15,36 @@ if (
}
function drawButtons() {
let w = g.getWidth();
let h = g.getHeight();
//Draw the backdrop
const BAR_TOP = g.getHeight() - 24;
const BAR_TOP = h - 24;
g.setColor(0, 0, 1).setFontAlign(0, -1)
.clearRect(0, BAR_TOP, g.getWidth(), g.getHeight())
.fillRect(0, BAR_TOP, g.getWidth(), g.getHeight())
.clearRect(0, BAR_TOP, w, h)
.fillRect(0, BAR_TOP, w, h)
.setColor(1, 1, 1);
if (!common.state.wasRunning) { //If the timer was never started, only show a play button
g.drawImage(common.BUTTON_ICONS.play, g.getWidth() / 2, BAR_TOP);
g.drawImage(common.BUTTON_ICONS.play, w / 2, BAR_TOP);
} else {
g.drawLine(g.getWidth() / 2, BAR_TOP, g.getWidth() / 2, g.getHeight());
g.drawLine(w / 2, BAR_TOP, w / 2, h);
if (common.state.running) {
g.drawImage(common.BUTTON_ICONS.pause, g.getWidth() / 4, BAR_TOP)
.drawImage(common.BUTTON_ICONS.skip, g.getWidth() * 3 / 4, BAR_TOP);
g.drawImage(common.BUTTON_ICONS.pause, w / 4, BAR_TOP)
.drawImage(common.BUTTON_ICONS.skip, w * 3 / 4, BAR_TOP);
} else {
g.drawImage(common.BUTTON_ICONS.reset, g.getWidth() / 4, BAR_TOP)
.drawImage(common.BUTTON_ICONS.play, g.getWidth() * 3 / 4, BAR_TOP);
g.drawImage(common.BUTTON_ICONS.reset, w / 4, BAR_TOP)
.drawImage(common.BUTTON_ICONS.play, w * 3 / 4, BAR_TOP);
}
}
}
function drawTimerAndMessage() {
let w = g.getWidth();
let h = g.getHeight();
g.reset()
.setFontAlign(0, 0)
.setFont("Vector", 36)
.clearRect(0, 24, 176, 152)
.clearRect(w / 2 - 60, h / 2 - 34, w / 2 + 60, h / 2 + 34)
//Draw the timer
.drawString((() => {
@ -53,7 +59,7 @@ function drawTimerAndMessage() {
if (hours >= 1) return `${parseInt(hours)}:${pad(minutes)}:${pad(seconds)}`;
else return `${parseInt(minutes)}:${pad(seconds)}`;
})(), g.getWidth() / 2, g.getHeight() / 2)
})(), w / 2, h / 2)
//Draw the phase label
.setFont("Vector", 12)
@ -63,7 +69,7 @@ function drawTimerAndMessage() {
else if (currentPhase == common.PHASE_SHORT_BREAK) return `Short break ${numShortBreaks + 1}/${common.settings.numShortBreaks}`;
else return "Long break!";
})(common.state.phase, common.state.numShortBreaks),
g.getWidth() / 2, g.getHeight() / 2 + 18);
w / 2, h / 2 + 18);
//Update phase with vibation if needed
if (common.getTimeLeft() <= 0) {
@ -91,6 +97,7 @@ Bangle.on("touch", (button, xy) => {
};
setupTimerInterval();
drawButtons();
if (common.settings.showClock) Bangle.showClock();
} else if (common.state.running) {
//If we are running, there are two buttons: pause and skip
@ -127,6 +134,7 @@ Bangle.on("touch", (button, xy) => {
drawTimerAndMessage();
setupTimerInterval();
drawButtons();
if (common.settings.showClock) Bangle.showClock();
}
}
});
@ -154,4 +162,4 @@ E.on('kill', () => {
});
Bangle.loadWidgets();
Bangle.drawWidgets();
Bangle.drawWidgets();

View File

@ -105,14 +105,13 @@ exports.nextPhase = function (vibrate) {
if (vibrate) {
if (exports.state.phase == exports.PHASE_WORKING) {
Bangle.buzz(750, 1);
Bangle.buzz(800, 1);
} else if (exports.state.phase == exports.PHASE_SHORT_BREAK) {
Bangle.buzz();
setTimeout(Bangle.buzz, 400);
} else {
Bangle.buzz();
setTimeout(Bangle.buzz, 400);
setTimeout(Bangle.buzz, 600);
setTimeout(Bangle.buzz, 400, 400);
}
}
}
}

View File

@ -1,7 +1,7 @@
{
"id": "pomoplus",
"name": "Pomodoro Plus",
"version": "0.05",
"version": "0.06",
"description": "A configurable pomodoro timer that runs in the background.",
"icon": "icon.png",
"type": "app",

View File

@ -10,7 +10,8 @@ const storage = require("Storage");
longBreak: 900000, //15 minute long break
numShortBreaks: 3, //3 short breaks for every long break
pausedTimerExpireTime: 21600000, //If the timer was left paused for >6 hours, reset it on next launch
widget: false //If a widget is added in the future, whether the user wants it
showClock: false, //Show clock after start/resume
widget: false, //If a widget is added in the future, whether the user wants it
};
}
@ -89,6 +90,13 @@ const storage = require("Storage");
else return `${Math.floor(value / 3600000)}h ${(value % 3600000) / 60000}m`
}
},
'Show clock': {
value: settings.showClock,
onchange: function(value) {
settings.showClock = value;
save();
},
},
};
E.showMenu(menu)
})
})

View File

@ -823,7 +823,7 @@ function showAppSettings(app) {
try {
appSettings = eval(appSettings);
} catch (e) {
console.log(`${app.name} settings error:`, e)
console.log(`${app.name} settings error:`, e);
return showError(/*LANG*/'Error in settings');
}
if (typeof appSettings !== "function") {
@ -833,7 +833,7 @@ function showAppSettings(app) {
// pass showAppSettingsMenu as "back" argument
appSettings(()=>showAppSettingsMenu());
} catch (e) {
console.log(`${app.name} settings error:`, e)
console.log(`${app.name} settings error:`, e);
return showError(/*LANG*/'Error in settings');
}
}

2
core

@ -1 +1 @@
Subproject commit 71813fe2eaf19987cec07db850ab9d1959694f96
Subproject commit 11f8e16d2ebb726bb92f29d812dc3ccba4f362a9