Again, answering myself =)

Solution was on the documentation ;-)

I found a method from gallery called:  setCallbackDuringFling (boolean
shouldCallback). That method, when shouldCallback is true, calls the
OnItemSelectedListener. Then, we can 'bounce' there back or forward a
position we want, regarding the actual position we are.

And, ironically I also found a method that leaves you exactly in the
position you want :S. So, there's no need to emulate touchs or events
like so. Just calling: setSelection(position) the adapterview will
jump directly to that item.

So, there was no need to override Gallery. Just set the callback
during fling to true and write something like this on the item
selected listener:

public void  onItemSelected  (AdapterView<?>  parent, View  v, int
position, long id) {
            View sideView = parent.findViewById(last);
            if (sideView != null && last != position) sideView.clearAnimation();

            if (v != null && position != 0 && position != parent.getCount() -
1) v.startAnimation(grow);

            if (position == LEFT_JOG_POSITION)  parent.setSelection(1);

            if (position == RIGHT_JOG_POSITION) parent.setSelection(7);
                
            last = position;
        }
}

Working now,

-- 
If you want freedom, compile the source.

Sebastián Treu
http://labombiya.com.ar

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to