Phase 3: event creation flow (GPS + success / error)

GpsService runs a single-shot position request with a hard timeout
and early-exit when Config.GPS_TARGET_ACCURACY_M is reached.
LoadingView renders a circular progress bar around the edge plus the
"Standort wird bestimmt" prompt; on callback it persists a new Event
via EventStore.add and transitions to SuccessView (green checkmark,
short vibration, auto-close) or ErrorView (red alert, 3× vibration,
German message, longer hold). TextUtils extracts the shared
multi-line centered text rendering so MenuView, LoadingView and
ErrorView all render wrapped German text consistently. Positioning
permission added to manifest.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
EiSiMo 2026-04-11 20:36:22 +02:00
parent d3494acc0d
commit 025d3007db
9 changed files with 332 additions and 17 deletions

52
source/SuccessView.mc Normal file
View file

@ -0,0 +1,52 @@
import Toybox.Attention;
import Toybox.Graphics;
import Toybox.Lang;
import Toybox.Timer;
import Toybox.WatchUi;
// Green checkmark flash after a successful event save. Vibrates
// briefly, holds for Config.SUCCESS_DISPLAY_MS, then closes the app.
class SuccessView extends WatchUi.View {
private var _timer as Timer.Timer;
function initialize() {
View.initialize();
_timer = new Timer.Timer();
}
function onShow() as Void {
if (Attention has :vibrate) {
Attention.vibrate([new Attention.VibeProfile(75, 200)] as Array<Attention.VibeProfile>);
}
_timer.start(method(:_dismiss), Config.SUCCESS_DISPLAY_MS, false);
}
function onHide() as Void {
_timer.stop();
}
function _dismiss() as Void {
System.exit();
}
function onUpdate(dc as Dc) as Void {
dc.setColor(Config.COLOR_FG, Config.COLOR_BG);
dc.clear();
var cx = LayoutMetrics.centerX(dc);
var cy = LayoutMetrics.centerY(dc);
var min = LayoutMetrics.minDim(dc);
var size = (min * 0.35).toNumber();
dc.setColor(Config.COLOR_SUCCESS, Config.COLOR_BG);
dc.setPenWidth((min * 0.035).toNumber());
// Checkmark: two line segments forming a tick.
var left = cx - size / 2;
var right = cx + size / 2;
var midX = cx - size / 6;
dc.drawLine(left, cy, midX, cy + size / 3);
dc.drawLine(midX, cy + size / 3, right, cy - size / 2);
}
}