How to retain layer during transition

Hi,

I'd have a widget app with multiple views and would like to implement a page indicator, similar to the one Garmin has for their widgets. However there is one aspect that I cannot replicate. Garmin widgets use SLIDE_UP or SLIDE_DOWN for the transition, however, their page indicator is not transitioning but staying visible in the same place during the transition.

Is there a way to implement something like this with the Connect IQ SDK?

I put my page indicator on a separate layer, and tried to use the same layer object for all views, but that did not help, the indicator is always transitioning with the view.

Here is how my indicator looks like:

Regards, Robert

  • what's the layout's structure?

  • I have not used layouts so far. The main code of my widget just draws on the Dc passed into the onUpdate function. The page indicator draws on a separate layer on top of that, with transparent background. 

  • OK, so I don't even understand what you're asking for... Every time there's a change in just 1 pixel on the whole screen you need to redraw the whole screen (unless you just change that 1 pixel, but that's another story, and trying to do that can cause strange bugs, if you think you only need to redraw it, but in fact something else was drawn over the screen so you have to redraw the whole screen)

  • Basically I‘d like the page indicator layer to stay in place during the animated transition from one view to another. 

    Garmin does this with their own widgets, but I could not yet figure out a way to do it with the SDK.

    I was wondering if having a separate view for the page indicator would be a way? If there are two views in the view stack, and the upper one has transparent background, will the lower one be seen through it?

  • I never used layers, in all of my apps I use dc. If I understand correctly then that's what you do too. It's hard to guess things without seeing your relevant code, but I guess you need to draw the page indicator as the last thing and make sure it's drawn on DC relative to the screen and not to the "layer" below it that is being moved.

  • Basically when a view is switched, everything moves, the DC as well as all layers. So wherever I draw the page indicator, I cannot prevent it from being moved as part of the transition to another view. What I am looking for is a kind of „global“ layer/overlay, that stays in place when views are switched. But I am afraid there is no such thing in the Garmin SDK. 

  • One thing to consider is to simplify things and not use different views.  I know you've used my WU widget.  It's got 2 or 3 different screens depending on device but only one view..  If you go to the menu, that pushes a Menu2, but it is popped when you leave the menu.  One of my apps has about a dozen screens and works the same.

    I have a class variable in the view for the page number.  In the delegate, I move through the possible page numbers, and then in onUpdate, what's displayed is based on the page number.  In the WU widget, I also use a timer to automatically rotate through the pages.

    No layers, no SLIDE_UP, SLIDE_DOWN, etc

  • Hi Jim, yes, I saw how you did it in the WU app. This could also be done with views, SLIDE_IMMEDIATE works the same visually, and would leave my page indicator in place. But somehow I do like those sliding transitions, I think they provide intuitive visual feedback to the user. And it makes for a more coherent user experience, matching what people are used to from the Garmin widgets.

    I guess one way to solve it technically is to use your approach, have everything in one view, but work with two layers, one for the main content, and one for the indicator, and then implement a custom sliding effect that can be applied to one layer only, the one with the main content. However, frankly, that to me is a bit too much effort for too little gain.

  • I have exactly the same problem... I would like to implement an overlay layer (or view, or whatever) that remains visible during transitions between views. No matter how much I think about it, I can't seem to find a viable solution that meets the functionality we see in Garmin's native applications.

    If anyone comes up with any ideas about this, I would be very grateful if they were shared.

    Thank you in advance