|
16 | 16 | } else { // for fast-load, if we had widgets then we should hide them |
17 | 17 | require("widget_utils").hide(); |
18 | 18 | } |
| 19 | + |
| 20 | + let selectedItem = -1; |
| 21 | + const R = Bangle.appRect; |
| 22 | + const iconSize = 48; |
| 23 | + const appsN = Math.floor(R.w / iconSize); |
| 24 | + const whitespace = Math.floor((R.w - appsN * iconSize) / (appsN + 1)); |
| 25 | + const iconYoffset = Math.floor(whitespace/4)-1; |
| 26 | + const itemSize = iconSize + whitespace; |
| 27 | + |
| 28 | + // show some grey blocks as a loading screen |
| 29 | + g.clearRect(Bangle.appRect).setColor("#888"); |
| 30 | + for (var y=R.y+whitespace/2;y<R.h;y+=itemSize) |
| 31 | + for (var x=R.x+whitespace/2;x<R.w;x+=itemSize) |
| 32 | + g.drawRect(x+16,y+16,x+32,y+32); |
| 33 | + g.flip(); |
| 34 | + |
19 | 35 | let launchCache = s.readJSON("iconlaunch.cache.json", true)||{}; |
20 | 36 | let launchHash = s.hash(/\.info/); |
21 | 37 | if (launchCache.hash!=launchHash) { |
|
38 | 54 | const ICON_MISSING = s.read("iconlaunch.na.img"); |
39 | 55 | let count = 0; |
40 | 56 |
|
41 | | - let selectedItem = -1; |
42 | | - const R = Bangle.appRect; |
43 | | - const iconSize = 48; |
44 | | - const appsN = Math.floor(R.w / iconSize); |
45 | | - const whitespace = Math.floor((R.w - appsN * iconSize) / (appsN + 1)); |
46 | | - const iconYoffset = Math.floor(whitespace/4)-1; |
47 | | - const itemSize = iconSize + whitespace; |
| 57 | + |
48 | 58 |
|
49 | 59 | launchCache.items = {}; |
50 | 60 | for (let c of launchCache.apps){ |
|
82 | 92 | drawText(itemI, r.y, selectedApp); |
83 | 93 | texted=itemI; |
84 | 94 | } |
| 95 | + if (firstRun) g.flip(); // at startup |
85 | 96 | }; |
86 | | - |
| 97 | + let firstRun = true; |
87 | 98 | let drawText = function(i, appY, selectedApp) { |
88 | 99 | const idy = (selectedItem - (selectedItem % 3)) / 3; |
89 | 100 | if (i != idy) return; |
|
150 | 161 | } |
151 | 162 |
|
152 | 163 | let scroller = E.showScroller(options); |
| 164 | + firstRun = false; // this stops us flipping the screen after each line we draw |
153 | 165 |
|
154 | 166 | let timeout; |
155 | 167 | const updateTimeout = function(){ |
156 | | - if (settings.timeOut!="Off"){ |
| 168 | + if (settings.timeOut!="Off"){ |
157 | 169 | let time=parseInt(settings.timeOut); //the "s" will be trimmed by the parseInt |
158 | 170 | if (timeout) clearTimeout(timeout); |
159 | 171 | timeout = setTimeout(Bangle.showClock,time*1000); |
|
0 commit comments