diff options
| author | cirakg <cirakg@cirakg.xyz> | 2026-10-20 01:51:05 +0200 |
|---|---|---|
| committer | cirakg <cirakg@cirakg.xyz> | 2026-10-20 01:51:05 +0200 |
| commit | d537f4e154a40075405b0ab2fed14fbe2eeaac81 (patch) | |
| tree | f1fb9b148871901dda96fca11401d6f4d0ee1d59 /source/ui/InfoView.mc | |
| parent | 40d9a1d5c3e85486aea964c1446402a3be6ec05a (diff) | |
feat(settings): apply the Import form from the phone and show results
Import group in the app settings; the processor runs after the first
frame and on settings changes, clears the fields, writes the status,
remembers form hashes and opens the results screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'source/ui/InfoView.mc')
| -rw-r--r-- | source/ui/InfoView.mc | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/source/ui/InfoView.mc b/source/ui/InfoView.mc index 3b75764..cab4b52 100644 --- a/source/ui/InfoView.mc +++ b/source/ui/InfoView.mc @@ -11,6 +11,8 @@ class InfoView extends WatchUi.View { private var _text as Array<String>; private var _screen as String; private var _lines as Array<String>? = null; // wrapped, on first draw + // For each wrapped line: true when it starts one of the text items. + private var _starts as Array<Boolean> = [] as Array<Boolean>; private var _first as Number = 0; private var _visible as Number = 1; private var _shownLogged as Boolean = false; @@ -62,17 +64,31 @@ class InfoView extends WatchUi.View { var width = 2 * Ui.halfWidthBetween(dc, y, bottom) - 8; lines = [] as Array<String>; for (var i = 0; i < _text.size(); i++) { - lines.addAll(Ui.wrap(dc, _text[i], font, width)); + var wrapped = Ui.wrap(dc, _text[i], font, width); + for (var k = 0; k < wrapped.size(); k++) { + _starts.add(k == 0); + } + lines.addAll(wrapped); } _lines = lines; } - _visible = (bottom - y) / lineH; dc.setColor(Ui.fg(), Graphics.COLOR_TRANSPARENT); - for (var i = _first; i < lines.size() && i < _first + _visible; i++) { + // A third of a line between items, so wrapped items stay apart. + var gap = lineH / 3; + var shown = 0; + for (var i = _first; i < lines.size() && y + lineH <= bottom; i++) { + if (_starts[i] && i != _first) { + y += gap; + if (y + lineH > bottom) { + break; + } + } dc.drawText(w / 2, y, font, lines[i], Graphics.TEXT_JUSTIFY_CENTER); y += lineH; + shown++; } - if (_first + _visible < lines.size()) { + _visible = shown > 0 ? shown : 1; + if (_first + shown < lines.size()) { var cx = w / 2; dc.setColor(Ui.dim(), Graphics.COLOR_TRANSPARENT); dc.fillPolygon([[cx - 6, bottom], [cx + 6, bottom], [cx, bottom + 6]] as Array<Graphics.Point2D>); |
