Implementing Peek/Flow

It seems that implementing peek/flow gestures is a requirement for Built for Blackberry certification. Are there any examples of how to implement this in AIR, so that it's consistent in behaviour with native apps?

Re: Implementing Peek/Flow

I believe it is only a requirement if you are using the invocation framework. There are many types of apps that would not need to use this feature. I think it is one of many types of capabilities that would be needed to be considered certified. If you know otherwise, please post the link.

Re: Implementing Peek/Flow

I was on the 10k commitment webcast today, and they went through a sample app that qualifies. Basically, to meet the gestures requirement, they added a peek gesture to a save screen (which I thought was kind of forcefully adding a gesture where it wasn't really needed).

Re: Implementing Peek/Flow

Finally got around to trying to implement this. It seems that GESTURE_SWIPE is not the right one to listen for to implement peek, since its offset values are only -1 or 1 (ie. only directional, not the actual movement distance).

I've tried to use GESTURE_PAN instead, but I'm not picking up any events at all as I move my finger across the screen. Anybody with more ideas? I hope I'm not the only one trying to implement peek on AIR.

Re: Implementing Peek/Flow

Use GESTURE_SWIPE and in the listener record the initial condition so later events, you can measure the difference. In this example, if the swipe moves more than 25% of the item being swiped, it gets closed.

Re: Implementing Peek/Flow

I'm trying to use the "update" events to have the window slide along with the finger, and then using the "end" event to check where the window ends up, and either pop it back open or closed depending on how far it went.

However, my testing shows that the "end" events are not consistently fired, often leaving my window hanging open halfway.

In fact, it looks like "end" events are only fired if you do a quick swipe (like a page change gesture in a book reader), but not if you slide your finger on the screen and then lift (which is how one would do a peek move). Any ideas?

Re: Implementing Peek/Flow

Figured it out! For what I want to do, the proper events to use are the TouchEvents. I just need to set up listener functions for TouchEvent.TOUCH_BEGIN, TouchEvent.TOUCH_MOVE, and TouchEvent.TOUCH_END. Moves very smoothly now!

Re: Implementing Peek/Flow

Has RIM published any guidelines regarding how far to the right a screen should need to be dragged before it is no longer a 'peek' but gets hidden altogether?

I would imagine that a consistent peeking experience accross apps would be a big benefit to how the gesture is generally received by users. It would be quite annoying if your thumb gets used to a certain movement to go back in your most-used app, but in some other apps that movement is still interpreted as a peek (so when you try to go back to the parent page, the current page only moves a bit and then flips back into view) or the other way round, where some apps may only have a fairly short peek range and you keep going back when you only meant to peek ...