summaryrefslogtreecommitdiff
path: root/source/ui
diff options
context:
space:
mode:
Diffstat (limited to 'source/ui')
-rw-r--r--source/ui/InfoView.mc24
-rw-r--r--source/ui/ListView.mc15
-rw-r--r--source/ui/MainMenu.mc6
3 files changed, 37 insertions, 8 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>);
diff --git a/source/ui/ListView.mc b/source/ui/ListView.mc
index ab0e594..cc4e5f3 100644
--- a/source/ui/ListView.mc
+++ b/source/ui/ListView.mc
@@ -119,6 +119,8 @@ class ListView extends WatchUi.View {
var mode = vault.hasPin() ? PinView.MODE_UNLOCK : PinView.MODE_CREATE;
WatchUi.pushView(new PinView(mode, null), new PinDelegate(), WatchUi.SLIDE_LEFT);
}
+ // Settings forms are applied after the first frame (README 10.3).
+ AppState.processSettings();
}
// One-shot timer: start-up checks after the first frame, and further
@@ -149,7 +151,7 @@ class ListView extends WatchUi.View {
var titleFont = Graphics.FONT_XTINY;
var titleY = Ui.isRound() ? h / 12 : 4;
dc.setColor(Ui.accent(), Graphics.COLOR_TRANSPARENT);
- dc.drawText(w / 2, titleY, titleFont, "OTP Wallet", Graphics.TEXT_JUSTIFY_CENTER);
+ dc.drawText(w / 2, titleY, titleFont, title(), Graphics.TEXT_JUSTIFY_CENTER);
var listTop = titleY + dc.getFontHeight(titleFont) + 2;
var listBottom = Ui.isRound() ? h - h / 12 : h - 4;
@@ -176,6 +178,17 @@ class ListView extends WatchUi.View {
}
}
+ // "Importing… 40%" while an import runs, "Results ready" when settings
+ // results haven't been looked at, else the app name.
+ private function title() as String {
+ var p = AppState.processor;
+ var busy = p != null ? p.busyText() : null;
+ if (busy != null) {
+ return busy;
+ }
+ return Results.unseen() ? "Results ready (menu)" : "OTP Wallet";
+ }
+
private function drawEmpty(dc as Graphics.Dc, top as Number, bottom as Number) as Void {
var w = dc.getWidth();
var y = (top + bottom) / 2 - dc.getFontHeight(Graphics.FONT_SMALL);
diff --git a/source/ui/MainMenu.mc b/source/ui/MainMenu.mc
index b827784..3d13180 100644
--- a/source/ui/MainMenu.mc
+++ b/source/ui/MainMenu.mc
@@ -117,9 +117,9 @@ class MainMenuDelegate extends WatchUi.Menu2InputDelegate {
WatchUi.pushView(new WatchUi.Confirmation("Erase locked entries and set a new PIN?"), new ResetPinConfirmation(),
WatchUi.SLIDE_LEFT);
} else if (id == :results) {
- WatchUi.switchToView(new InfoView("Settings results",
- ["Nothing yet. Results appear here after you add or change entries in the phone settings."], "results"),
- new InfoDelegate(), WatchUi.SLIDE_LEFT);
+ WatchUi.switchToView(new InfoView("Results", Results.lines(), "results"), new InfoDelegate(),
+ WatchUi.SLIDE_LEFT);
+ Results.markSeen();
} else if (id == :ids) {
WatchUi.switchToView(new InfoView("Entry IDs", MainMenu.entryIdLines(), "ids"), new InfoDelegate(), WatchUi.SLIDE_LEFT);
} else if (id == :clock) {