einsatzprotokoll/source/MenuDelegate.mc
EiSiMo eea1a835cd Phase 5: delete last event with confirmation countdown
Two-step delete: navigate to "Letzten löschen", press START/STOP
to open confirmation, press again to start 2.5s red arc countdown.
BACK cancels at any point. Currently uses click-to-start instead
of press-and-hold due to simulator key event limitations.

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

44 lines
1.2 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)) {
var view = new DeleteView();
WatchUi.pushView(view, new DeleteDelegate(view), WatchUi.SLIDE_LEFT);
return true;
}
WatchUi.pushView(new LoadingView(key), null, WatchUi.SLIDE_IMMEDIATE);
return true;
}
}