diff options
Diffstat (limited to 'source/ui/ListDelegate.mc')
| -rw-r--r-- | source/ui/ListDelegate.mc | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/source/ui/ListDelegate.mc b/source/ui/ListDelegate.mc index a7c8bf0..ca7cee9 100644 --- a/source/ui/ListDelegate.mc +++ b/source/ui/ListDelegate.mc @@ -14,14 +14,43 @@ class ListDelegate extends WatchUi.BehaviorDelegate { } function onNextPage() as Boolean { - AppState.activity(); - _view.move(1); + if (!Gesture.recent()) { + AppState.activity(); + _view.move(1); + } return true; } function onPreviousPage() as Boolean { + if (!Gesture.recent()) { + AppState.activity(); + _view.move(-1); + } + return true; + } + + // The Forerunner 70 sends no page behaviour for a vertical swipe, so the + // swipe and the drag scroll here; Gesture makes a gesture count once. + function onSwipe(event as WatchUi.SwipeEvent) as Boolean { + if (!Gesture.isVertical(event)) { + return BehaviorDelegate.onSwipe(event); + } + var step = Gesture.swipeStep(event); + if (step != 0) { + AppState.activity(); + _view.move(step); + } + return true; + } + + // A drag scrolls by the rows it covered, at least one. + function onDrag(event as WatchUi.DragEvent) as Boolean { + var step = Gesture.dragStep(event, _view.rowHeight()); + if (step == 0) { + return false; + } AppState.activity(); - _view.move(-1); + _view.move(step); return true; } @@ -55,6 +84,9 @@ class ListDelegate extends WatchUi.BehaviorDelegate { // A tap opens the row under the finger. function onTap(event as WatchUi.ClickEvent) as Boolean { AppState.activity(); + if (Gesture.tapIgnored()) { + return true; + } var index = _view.rowAt(event.getCoordinates()[1]); if (index < 0) { return true; |
