Skip to content

Commit 29117c5

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 29117c5

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

apps/dsky_clock/app.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ 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+
21+
1722
var layout = new Layout(
1823
{type:"h", c:[
1924
{type:"",width:6},
@@ -54,7 +59,10 @@ var layout = new Layout(
5459
]},
5560
{type:"",width:5},
5661
],
57-
lazy:true});
62+
lazy:true},
63+
{btns:[
64+
{label:"", cb: Bangle.showLauncher}
65+
], lazy:true});
5866
layout.update();
5967

6068
//support functioe_ns
@@ -346,12 +354,6 @@ function queueDraw() {
346354
}, 60000 - (Date.now() % 60000));
347355
}
348356

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-
355357
Bangle.on('lock',on=>{
356358
mode = 0;
357359
drawMain(); // draw immediately

0 commit comments

Comments
 (0)