Handle UI focus and animations?

A place for App developers to hang out / post
Post Reply
MrNorth

Posts: 60
Joined: Sat May 18, 2013 9:46 am
Location:

HTPC Specs: Show details

Handle UI focus and animations?

#1

Post by MrNorth » Wed Feb 19, 2014 8:46 am

Hi!

I ahve been thinking about a problem I have, and found no "good" solution.

The problem is with scrollers, reset of index and animations. It is often that you want to "programmatically" reset index of a scroller, like when you change context in a pivot and want to reload a gallery with new data etc. Then the best way is to invoke a command to the scroller in question,and do a "navigateintoindex" and the scroller get focus, and navigate to index=0 for example. The "problem" then is that I want to do this without the user experiencing that the focus change actually occurs.

Consider;

<pivot menu>

<gallery>

When changing an item in the pivot the following things happen:

1) chosenchanged is invoked
2) in the model I set a flag "galleryloading = true
3) when loading done I set galleryloading=false
4) IN mcml I have a rule that triggers an action when galleryloading changed from false to true
5) I invoke a command "ResetGallery"
6) In the gallery, I set the action of the command to do a navigateintoindex (gallery automatically get focus)
7) After 6 I invoke another command from the gallery that does on the main UI a "pivot.navigateinto", putting focus back to pivot.
8) It all happens so quickly that the user doesn't see anything.

ONE exception. I have animatins that scale the gallery and pivot on focuson and focusoff. Even if the above operation only takes 5 ms, I still see the focusanimations.

What is the best way to handle this, so that animations only occur when it is the user that put focus, not programmatically? I tried with a bool flag as an additional rule when playing animations, but it dodn't work, even if I set the flag before I executed the above commands, the animation still played, because the bool flag wasn't set as it should...
My guess it has something to do with async/sync operations, and the bool flag is set after the animation rule is evaluated.

How would you solve this issue?

/H
PS I will post some screenies of the app soon, just finishing a search UI... DS

Post Reply