Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Developer
jetstreamblue
Posts: 121
Registered: ‎01-21-2011
My Device: Z10 LE #00055

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?

VENTURCON
For BB10: e-Mmanuel Bible Reader, e-Mmanuel Audio Bible, PM Assist
For PlayBook: e-Mmanuel Bible Reader, Business Analysis Toolbox
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

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.
Developer
jetstreamblue
Posts: 121
Registered: ‎01-21-2011
My Device: Z10 LE #00055

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).

Here's the link for the user experience requirements:

https://developer.blackberry.com/builtforblackberry/documentation/criteria/userexperience.html

VENTURCON
For BB10: e-Mmanuel Bible Reader, e-Mmanuel Audio Bible, PM Assist
For PlayBook: e-Mmanuel Bible Reader, Business Analysis Toolbox
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: Implementing Peek/Flow

If you do have components that slides in/up/right/down/etc, then you need to track the gesture of the finger. Listen to TransformGestureEvent.GESTURE_SWIPE events and that should get you going.
Developer
jetstreamblue
Posts: 121
Registered: ‎01-21-2011
My Device: Z10 LE #00055

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.

VENTURCON
For BB10: e-Mmanuel Bible Reader, e-Mmanuel Audio Bible, PM Assist
For PlayBook: e-Mmanuel Bible Reader, Business Analysis Toolbox
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

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.

 

///////////////////////////////////////////////////////////////////////
private function LeftLeafPan( event : TransformGestureEvent ) : void
{
	if( event.phase == 'begin' )
	{
		this.left_swipe_x = event.stageX;
	}
	else if( event.phase == 'update'  && ( event.stageX - this.left_swipe_x ) < -0.25*this.left_leaf.width )
	{
		this.hideLeftLeaf();
	}
}

 You have to play around with the values and the desire action.

Developer
jetstreamblue
Posts: 121
Registered: ‎01-21-2011
My Device: Z10 LE #00055

Re: Implementing Peek/Flow

Thanks jtegen!  That is helpful!

 

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?

VENTURCON
For BB10: e-Mmanuel Bible Reader, e-Mmanuel Audio Bible, PM Assist
For PlayBook: e-Mmanuel Bible Reader, Business Analysis Toolbox
Developer
jetstreamblue
Posts: 121
Registered: ‎01-21-2011
My Device: Z10 LE #00055

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!

VENTURCON
For BB10: e-Mmanuel Bible Reader, e-Mmanuel Audio Bible, PM Assist
For PlayBook: e-Mmanuel Bible Reader, Business Analysis Toolbox
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: Implementing Peek/Flow

If you have not done it, it is most efficient to only start listening to the "move" and "end" when the "begin" is first fired, and then remove those when "end" is fired.
Developer
apman
Posts: 194
Registered: ‎11-12-2010
My Device: Not Specified

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 ...

 


My app : Get set - Get up!   Get ready for the snooze revolution.