Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion apps/ultrainfo/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
0.01: New app
0.01: New app.
0.02: Add lock icon since it's not shown in widget bar, bug fixes and performance improvements.
0.03: Fix clkinfo progress bar not taking info.min and info.v into account, use the colorpicker module for settings.
11 changes: 7 additions & 4 deletions apps/ultrainfo/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,17 @@ let drawRectClockInfo = function (itm, info, options, top) {
1,
settings.mainColor
);
if (info.max) {

if (info.max&&info.v) {
let min=info.min?info.min:0;
let val=(info.v-min) / (info.max-min);
val=Math.max(0,val);
val=Math.min(1,val);
drawProgBar(
options.x + 3,
top ? options.y + options.h - 3 : options.y + 3,
options.w - 6,
+parseFloat(("" + info.text).match(/[\d.]+/)) / info.max,
val,
settings.accentColor
);
}
Comment thread
RKBoss6 marked this conversation as resolved.
Expand Down Expand Up @@ -198,5 +203,3 @@ Bangle.setUI({
if (brClkInfo && brClkInfo.remove) brClkInfo.remove();
}
});


3 changes: 2 additions & 1 deletion apps/ultrainfo/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Ultra Info Clock",
"shortName":"Ultra Info",
"icon": "icon.png",
"version":"0.02",
"version":"0.03",
"description": "The ultimate information clock with not 2, not 4, but <i>6 ClockInfos</i> - for those who crave as much information as possible on their wrists.",
"type":"clock",
"tags": "clock,clkinfo",
Expand All @@ -19,6 +19,7 @@
{"url":"screenshot4.png"},
{"url":"screenshot5.png"}
],

"storage": [
{"name":"ultrainfo.app.js","url":"app.js"},
{"name":"ultrainfo.settings.js","url":"settings.js"},
Expand Down
68 changes: 16 additions & 52 deletions apps/ultrainfo/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,67 +9,31 @@
function writeSettings() {
require('Storage').writeJSON(FILE, settings);
}

// same as in clock_bg
function getColorsImage(cols) {
var bpp = 1;
if (cols.length>4) bpp=4;
else if (cols.length>2) bpp=2;
var w = (cols.length>8)?8:16;
var b = Graphics.createArrayBuffer(w*cols.length,16,bpp);
b.palette = new Uint16Array(1<<bpp);
cols.forEach((c,i)=>{
b.setColor(i).fillRect(i*w,0,i*w+w-1,15);
b.palette[i] = g.toColor(c);
});
return "\0"+b.asImage("string");
}
function showAccentColor(){
var menu={
"" : { "title" : "Accent Color" },
"< Back" : showMainMenu,

}
var cols = ["#F00","#0F0","#FF0",
"#00F","#F0F","#0FF",
"#000","#888","#fff",];
cols.forEach(col => {
menu[" "+getColorsImage([col])] = () => {
settings.accentColor=col;
function showClMenu(settingsKey){
require("colorpicker").show({
onSelect:function(color){
settings[settingsKey]=color;
writeSettings();
showMainMenu();
};
});
E.showMenu(menu);
}

function showMainColor(){
var menu={
"" : { "title" : "Main Color" },
"< Back" : showMainMenu,
},
showPreview:true,
back:function(){
showMainMenu()
}

}
var cols = ["#F00","#0F0","#FF0",
"#00F","#F0F","#0FF",
"#000","#888","#fff",];
cols.forEach(col => {
menu[" "+getColorsImage([col])] = () => {
settings.mainColor=col;
writeSettings();
showMainMenu();
};
});
E.showMenu(menu);
}

function showMainMenu(){
// Show the menu
E.showMenu({
"" : { "title" : "Ultra Info" },
"< Back" : () => back(),
'Main Color': showMainColor,
'Accent Color': showAccentColor
'Main Color': function(){
showClMenu("mainColor")
},
'Accent Color': function(){
showClMenu("accentColor")
},
Comment thread
RKBoss6 marked this conversation as resolved.
});
}
showMainMenu()
})
})
Loading