Skip to content

Commit e10a703

Browse files
author
thyttan
committed
dsky_clock: hide widgets before building layout
so that the layout doesn't account for the widget bar when `dsky_clock` is fast loaded into. Also handle the hardware button trough the layout library instead of `Bangle.setUI`. Also set `Bangle.CLOCK` directly.
1 parent ebb2f7d commit e10a703

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

apps/dsky_clock/app.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ const LightFont='Teletext5x9Ascii';
1414
const DataFont='7x11Numeric7Seg:2';
1515
var mode = 0;
1616

17+
Bangle.CLOCK = 1;
18+
Bangle.loadWidgets();
19+
require("widget_utils").swipeOn(); // hide widgets, make them visible with a swipe
20+
1721
var layout = new Layout(
1822
{type:"h", c:[
1923
{type:"",width:6},
@@ -54,7 +58,10 @@ var layout = new Layout(
5458
]},
5559
{type:"",width:5},
5660
],
57-
lazy:true});
61+
lazy:true},
62+
{btns:[
63+
{label:"", cb: Bangle.showLauncher}
64+
], lazy:true});
5865
layout.update();
5966

6067
//support functioe_ns
@@ -346,12 +353,6 @@ function queueDraw() {
346353
}, 60000 - (Date.now() % 60000));
347354
}
348355

349-
// Show launcher when middle button pressed
350-
Bangle.setUI("clock");
351-
352-
Bangle.loadWidgets();
353-
require("widget_utils").swipeOn(); // hide widgets, make them visible with a swipe
354-
355356
Bangle.on('lock',on=>{
356357
mode = 0;
357358
drawMain(); // draw immediately

0 commit comments

Comments
 (0)