1
0
Fork 0

Merge branch 'espruino:master' into master

master
smekras 2022-03-17 20:46:47 +01:00 committed by GitHub
commit 5a41e8fb20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 5 deletions

View File

@ -29,7 +29,7 @@ function bangleDownload() {
promise = promise.then(() => { promise = promise.then(() => {
Progress.hide({sticky: true}); Progress.hide({sticky: true});
var percent = n/fileCount; var percent = n/fileCount;
Progress.show({title:`Download ${filename}`,sticky:true,min:percent,max:percent,percent:0}); Progress.show({title:`Download ${filename}`,sticky:true,min:percent,max:percent+(1/fileCount),percent:0});
return Comms.readFile(filename).then(data => zip.file(filename,data)); return Comms.readFile(filename).then(data => zip.file(filename,data));
}); });
}); });
@ -40,7 +40,7 @@ function bangleDownload() {
promise = promise.then(() => { promise = promise.then(() => {
Progress.hide({sticky: true}); Progress.hide({sticky: true});
var percent = (normalFiles.length+n)/fileCount; var percent = (normalFiles.length+n)/fileCount;
Progress.show({title:`Download ${filename}`,sticky:true,min:percent,max:percent,percent:0}); Progress.show({title:`Download ${filename}`,sticky:true,min:percent,max:percent+(1/fileCount),percent:0});
return Comms.readStorageFile(filename).then(data => zipStorageFiles.file(filename,data)); return Comms.readStorageFile(filename).then(data => zipStorageFiles.file(filename,data));
}); });
}); });

2
core

@ -1 +1 @@
Subproject commit 6e94cf77a2b355389dcd5efa55e2249a9b31983c Subproject commit 27c7db6035832837ca3909ea52939f60803df72f

View File

@ -59,6 +59,7 @@ options is an object containing:
* `label` - the text on the button * `label` - the text on the button
* `cb` - a callback function * `cb` - a callback function
* `cbl` - a callback function for long presses * `cbl` - a callback function for long presses
* `back` - a callback function, passed as `back` into Bangle.setUI
If automatic lazy rendering is enabled, calls to `layout.render()` will attempt to automatically If automatic lazy rendering is enabled, calls to `layout.render()` will attempt to automatically
determine what objects have changed or moved, clear their previous locations, and re-render just those objects. determine what objects have changed or moved, clear their previous locations, and re-render just those objects.
@ -89,7 +90,7 @@ function Layout(layout, options) {
options = options || {}; options = options || {};
this.lazy = options.lazy || false; this.lazy = options.lazy || false;
var btnList; var btnList, uiSet;
Bangle.setUI(); // remove all existing input handlers Bangle.setUI(); // remove all existing input handlers
if (process.env.HWVERSION!=2) { if (process.env.HWVERSION!=2) {
// no touchscreen, find any buttons in 'layout' // no touchscreen, find any buttons in 'layout'
@ -104,7 +105,7 @@ function Layout(layout, options) {
this.physBtns = 0; this.physBtns = 0;
this.buttons = btnList; this.buttons = btnList;
this.selectedButton = -1; this.selectedButton = -1;
Bangle.setUI("updown", dir=>{ Bangle.setUI({mode:"updown", back:options.back}, dir=>{
var s = this.selectedButton, l=this.buttons.length; var s = this.selectedButton, l=this.buttons.length;
if (dir===undefined && this.buttons[s]) if (dir===undefined && this.buttons[s])
return this.buttons[s].cb(); return this.buttons[s].cb();
@ -119,8 +120,10 @@ function Layout(layout, options) {
} }
this.selectedButton = s; this.selectedButton = s;
}); });
uiSet = true;
} }
} }
if (options.back && !uiSet) Bangle.setUI({mode: "custom", back: options.back});
if (options.btns) { if (options.btns) {
var buttons = options.btns; var buttons = options.btns;