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; } }