imgclock 0.11: Allow fullscreen clock faces with hidden widgets

pull/3143/head
Gordon Williams 2024-01-02 15:05:46 +00:00
parent 6a75df46d1
commit 657e06d824
4 changed files with 25 additions and 12 deletions

View File

@ -9,3 +9,4 @@
0.08: Use Bangle.setUI for button/launcher handling 0.08: Use Bangle.setUI for button/launcher handling
0.09: Bangle.js 2 compatibility 0.09: Bangle.js 2 compatibility
0.10: Tell clock widgets to hide. 0.10: Tell clock widgets to hide.
0.11: Allow fullscreen clock faces with hidden widgets

View File

@ -8,6 +8,7 @@ var inf = require("Storage").readJSON("imgclock.face.json");
var img = require("Storage").read("imgclock.face.img"); var img = require("Storage").read("imgclock.face.img");
var IX = inf.x, IY = inf.y, IBPP = inf.bpp; var IX = inf.x, IY = inf.y, IBPP = inf.bpp;
var IW = 174, IH = 45, OY = 24; var IW = 174, IH = 45, OY = 24;
if (inf.hideWidgets) OY=0;
var bgwidth = img.charCodeAt(0); var bgwidth = img.charCodeAt(0);
var bgoptions; var bgoptions;
if (bgwidth<g.getWidth()) if (bgwidth<g.getWidth())
@ -76,6 +77,8 @@ var secondInterval = setInterval(draw,1000);
Bangle.setUI("clock"); Bangle.setUI("clock");
// load widgets // load widgets
Bangle.loadWidgets(); Bangle.loadWidgets();
if (inf.hideWidgets)
require("widget_utils").swipeOn();
Bangle.drawWidgets(); Bangle.drawWidgets();
// Stop when LCD goes off // Stop when LCD goes off
Bangle.on('lcdPower',on=>{ Bangle.on('lcdPower',on=>{

View File

@ -35,7 +35,7 @@
function onInit(device) { function onInit(device) {
if (device && device.id=="BANGLEJS2") { if (device && device.id=="BANGLEJS2") {
faces = FACES_BANGLE2; faces = FACES_BANGLE2;
recommendedUploadStyle = "176x152 3 bits per pixel (8 color)"; recommendedUploadStyle = "176x152 or 176x176(hidden widgets) 3bpp (8 color)";
defaultBPP = 8; defaultBPP = 8;
defaultImageMode = "web"; defaultImageMode = "web";
defaultPositions = { defaultPositions = {
@ -44,7 +44,7 @@
}; };
} else { } else {
faces = FACES_BANGLE1; faces = FACES_BANGLE1;
recommendedUploadStyle = "240x192 or 240x216 8 bit web palette"; recommendedUploadStyle = "240x192 or 240x216 8bpp web palette";
defaultBPP = 8; defaultBPP = 8;
defaultImageMode = "web"; defaultImageMode = "web";
defaultPositions = { defaultPositions = {
@ -56,7 +56,7 @@
} }
updateFaces(); updateFaces();
} }
hazel
function updateFaces() { function updateFaces() {
document.querySelector(".columns").innerHTML = faces.map((face,facenumber)=>` document.querySelector(".columns").innerHTML = faces.map((face,facenumber)=>`
<div class="column col-6 col-xs-12"> <div class="column col-6 col-xs-12">
@ -81,7 +81,7 @@
</div> </div>
<div class="card-header"> <div class="card-header">
<div class="card-title h5">Custom</div> <div class="card-title h5">Custom</div>
<div class="card-subtitle text-gray">(${recommendedUploadStyle})</div> <div class="card-subtitle text-gray">${recommendedUploadStyle}</div>
</div> </div>
<div class="card-body"> <div class="card-body">
<div class="form-group"> <div class="form-group">
@ -93,11 +93,17 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="form-switch"> <label class="form-switch">
<input type="checkbox" id="cusom16bit"> <input type="checkbox" id="custom16bit">
<i class="form-icon"></i> 16 bit images (look better, slower, not recommended) <i class="form-icon"></i> 16 bit images (look better, slower, not recommended)
</label> </label>
</div> </div>
<div class="form-group">
<label class="form-switch">
<input type="checkbox" id="hideWidgets">
<i class="form-icon"></i> Hide Widgets (use a square image)
</label>
</div>
<div class="form-group"> <div class="form-group">
<label class="form-label" for="customcolor">Clock color</label> <label class="form-label" for="customcolor">Clock color</label>
<select class="form-select" id="customcolor"> <select class="form-select" id="customcolor">
@ -126,16 +132,18 @@
// build app text // build app text
var facenumber = btn.target.getAttribute("face"); var facenumber = btn.target.getAttribute("face");
var face; var face;
var hideWidgets = true;
if (facenumber=="custom") { if (facenumber=="custom") {
var select = document.getElementById("customlocation"); var select = document.getElementById("customlocation");
var pos = select.options[select.selectedIndex].value.split(",").map(x=>parseInt(x)); var pos = select.options[select.selectedIndex].value.split(",").map(x=>parseInt(x));
select = document.getElementById("customcolor"); select = document.getElementById("customcolor");
var col = select.options[select.selectedIndex].value; var col = select.options[select.selectedIndex].value;
hideWidgets = document.getElementById('hideWidgets').checked;
face = { face = {
x : pos[0], x : pos[0],
y : pos[1], y : pos[1],
align: pos[2], align: pos[2],
bpp : document.getElementById('cusom16bit').checked ? 16 : defaultBPP, bpp : document.getElementById('custom16bit').checked ? 16 : defaultBPP,
col : col col : col
}; };
} else { } else {
@ -146,7 +154,8 @@
x : face.x, x : face.x,
y : face.y, y : face.y,
align : face.align, align : face.align,
col : face.col col : face.col,
hideWidgets : hideWidgets
}; };
var imgMode = faceInfo.bpp==16 ? "rgb565" : defaultImageMode; var imgMode = faceInfo.bpp==16 ? "rgb565" : defaultImageMode;
var img = document.querySelector(`img[face='${facenumber}']`); var img = document.querySelector(`img[face='${facenumber}']`);

View File

@ -2,7 +2,7 @@
"id": "imgclock", "id": "imgclock",
"name": "Image background clock", "name": "Image background clock",
"shortName": "Image Clock", "shortName": "Image Clock",
"version": "0.10", "version": "0.11",
"description": "A clock with an image as a background", "description": "A clock with an image as a background",
"icon": "app.png", "icon": "app.png",
"type": "clock", "type": "clock",