einsatzprotokoll/source/MenuDelegate.mc
EiSiMo 902121bd42 Phase 4: history view with reverse geocoding
3-section layout (15/70/15) for browsing recorded events.
Reverse-geocodes coordinates via Photon API with Haversine
distance check and address caching. Also adds simulator GPS
polling fallback (Position.getInfo) since the simulator does
not fire location event callbacks.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 14:31:44 +02:00

43 lines
1.1 KiB
MonkeyC

import Toybox.Lang;
import Toybox.WatchUi;
// Routes menu input. UP/DOWN rotate the ring. START/STOP dispatches:
// - event types (arrest, start, …) push the GPS LoadingView
// - history / delete are stubbed until later phases
class MenuDelegate extends WatchUi.BehaviorDelegate {
private var _view as MenuView;
function initialize(view as MenuView) {
BehaviorDelegate.initialize();
_view = view;
}
function onNextPage() as Boolean {
_view.rotateNext();
return true;
}
function onPreviousPage() as Boolean {
_view.rotatePrev();
return true;
}
function onSelect() as Boolean {
var item = _view.selectedItem();
var key = item[:key] as String;
if (key.equals(Config.ACTION_HISTORY)) {
var view = new HistoryView();
WatchUi.pushView(view, new HistoryDelegate(view), WatchUi.SLIDE_LEFT);
return true;
}
if (key.equals(Config.ACTION_DELETE)) {
// Phase 5
return true;
}
WatchUi.pushView(new LoadingView(key), null, WatchUi.SLIDE_IMMEDIATE);
return true;
}
}