diff options
Diffstat (limited to 'spike/settings/source/SpikeDelegate.mc')
| -rw-r--r-- | spike/settings/source/SpikeDelegate.mc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/spike/settings/source/SpikeDelegate.mc b/spike/settings/source/SpikeDelegate.mc new file mode 100644 index 0000000..94b3ece --- /dev/null +++ b/spike/settings/source/SpikeDelegate.mc @@ -0,0 +1,35 @@ +// Author: cirakg & claude ai +// Summary: Input of the spike screen: UP/DOWN or swipes scroll, START/tap jumps back to the top. + +import Toybox.Lang; +import Toybox.WatchUi; + +class SpikeDelegate extends WatchUi.BehaviorDelegate { + + // Lines moved per button press or swipe. + private const SCROLL_STEP = 3; + // Large enough to reach the first line from anywhere. + private const TO_TOP = -1000; + + private var _view as SpikeView; + + function initialize(view as SpikeView) { + BehaviorDelegate.initialize(); + _view = view; + } + + function onNextPage() as Boolean { + _view.scroll(SCROLL_STEP); + return true; + } + + function onPreviousPage() as Boolean { + _view.scroll(-SCROLL_STEP); + return true; + } + + function onSelect() as Boolean { + _view.scroll(TO_TOP); + return true; + } +} |
