Switching between views

Hi,

I'd like to write a widget that has multiple views. In the SDK samples I only found one that processes the user input and pushes the views. Is there a more advanced standard implementation available that for example shows the dots visually representing the number of views and which one is active, and that handles different types of user inputs, like up/down key press and touch screen swipes? Like the out-of-the-box widgets from Garmin? Or do I have to implement that all by myself?

Regards, Robert

  • Already found the SDK sample for the ViewLoop, and it works well, very neat!

  • I now tested the implementation on my Epix 2. It works, but it seems that the bar indicating the active view is notably lagging behind. The view itself switches reasonably fast, just the bar is much slower. Is that normal/to be expected, or might there be something wrong with my implementation? On the simulator I did not see this issue, only on the real watch.

    Here is a video of it:Click here to play this video

  • Another issue I see is with the ViewLoopFactory.getView() method. While according to the documentation and method specification, the delegate should be optional, I get an Array Out Of Bound Error if I do not specify a delegate:

    function getView( page as Number ) as [View] or [View, BehaviorDelegate] {
        var views = _views as Array<EvccWidgetView>;
        var view = views[page] as EvccWidgetView;
        Storage.setValue( EvccApp.STORAGE_ACTIVESITE, view.getStateRequest().getSite() );
        return [view]; // Array Out Of Bounds Error
        //return [view, new EvccViewLoopDelegate()]; // this works
    }

    The error looks like this:

    Error: Array Out Of Bounds Error
    Details: Failed to start CIQ Application
    Stack: 
    
    Encountered app crash.