No because the issue is in VelocityTracker :)

On Tue, Mar 31, 2009 at 4:39 PM, focuser <linto...@gmail.com> wrote:
>
> Great!
>
> Will it fix the problem in my app if I pull GestureDetector.java from
> Cupcake and include/use it in my code?
>
> On Mar 31, 4:05 pm, Romain Guy <romain...@google.com> wrote:
>> The problem comes from the VelocityTracker used by the
>> GestureDetector. The tracker has a pool of 1 instance but there's a
>> bug in the pool management which causes both your GestureDetector and
>> ListView to use the *same* VelocityTracker. This means the tracker
>> receives most events twice.
>>
>> I just fixed this issue in Cupcake.
>>
>>
>>
>> On Tue, Mar 31, 2009 at 4:01 PM, focuser <linto...@gmail.com> wrote:
>>
>> > OK, but could you explain briefly why the GestureDetector would have
>> > such side effect?  In the code above I don't see any events being
>> > stolen nor any new events being created.  Original events are just
>> > passed to FrameLayout.dispatchTouchEvent as if there's no
>> > GestureDetector used.
>>
>> > I even tried the following but it makes no difference.
>> >        public boolean dispatchTouchEvent(MotionEvent ev) {
>> >                MotionEvent oldEv = ev.obtain();
>> >                boolean handled = mGestureDetector.onTouchEvent(ev);
>> >                return super.dispatchTouchEvent(oldEv);
>> >        }
>>
>> > On Mar 31, 12:07 pm, Romain Guy <romain...@google.com> wrote:
>> >> Unfortunately I don't see any possible workaround :(
>>
>> >> On Tue, Mar 31, 2009 at 11:40 AM, focuser <linto...@gmail.com> wrote:
>>
>> >> > Thanks Romain,
>>
>> >> > I have just filed 
>> >> > ithttp://code.google.com/p/android/issues/detail?id=2337.
>>
>> >> > But before it's fixed in a new release, is there any workaround or I
>> >> > will have to play with the VelocityTracker myself?
>>
>> >> > On Mar 31, 10:39 am, Romain Guy <romain...@google.com> wrote:
>> >> >> Hi,
>>
>> >> >> It looks like a bug in the VelocityTracker. Can you please file it at
>> >> >> b.android.com? Thanks
>>
>> >> >> On Tue, Mar 31, 2009 at 10:28 AM, focuser <linto...@gmail.com> wrote:
>>
>> >> >> > Hi,
>>
>> >> >> > I'm trying to use a GestureDetector in a subclass of FrameLayout,
>> >> >> > which has a child ListView.
>> >> >> > But it seems the GestureDetector has some side effect which causes
>> >> >> > abnormal scrolling behaviors for the child ListView, e.g. sometime
>> >> >> > when flinging down, the list actually scrolls upwards; when the list
>> >> >> > is being flung (i.e. the scrolling animation is still playing) and 
>> >> >> > you
>> >> >> > press and hold on the list, the scroling stops (which is normal), but
>> >> >> > as soon as you release, the list scrolls.
>>
>> >> >> > The code for the layout is shown below.  Apparently it actually does
>> >> >> > nothing extra but calling GestureDetector.onTouchEvent().  If the 
>> >> >> > line
>> >> >> > "boolean handled = mGestureDetector.onTouchEvent(ev);" is commented
>> >> >> > out, the child ListView will scroll as normal.  Is it because the 
>> >> >> > call
>> >> >> > to onTouchEvent() takes some time that confuses the child ListView?
>>
>> >> >> > Also, it seems this problem only occurs when the list item is 
>> >> >> > complex,
>> >> >> > e.g. consisting of multiple ImageViews, TextView etc.  Everything
>> >> >> > works fine if it's just a list of TextView's.
>>
>> >> >> > public class MyLayout extends FrameLayout implements 
>> >> >> > OnGestureListener
>> >> >> > {
>> >> >> >  ...
>> >> >> >       �...@override
>> >> >> >        public boolean dispatchTouchEvent(MotionEvent ev) {
>> >> >> >                boolean handled = mGestureDetector.onTouchEvent(ev);
>> >> >> >                return super.dispatchTouchEvent(ev);
>> >> >> >        }
>>
>> >> >> >        public void onShowPress(MotionEvent e) {
>> >> >> >        }
>>
>> >> >> >        public boolean onSingleTapUp(MotionEvent e) {
>> >> >> >                return false;
>> >> >> >        }
>>
>> >> >> >        public void onLongPress(MotionEvent e) {
>> >> >> >        }
>>
>> >> >> >        public boolean onDown(MotionEvent e) {
>> >> >> >                return false;
>> >> >> >        }
>>
>> >> >> >        public boolean onFling(MotionEvent e1, MotionEvent e2, float
>> >> >> > velocityX,
>> >> >> >                        float velocityY) {
>> >> >> >                return false;
>> >> >> >        }
>>
>> >> >> >        public boolean onScroll(MotionEvent e1, MotionEvent e2, float
>> >> >> > distanceX,
>> >> >> >                        float distanceY) {
>> >> >> >                return false;
>> >> >> >        }
>> >> >> > }
>>
>> >> >> --
>> >> >> Romain Guy
>> >> >> Android framework engineer
>> >> >> romain...@android.com
>>
>> >> >> Note: please don't send private questions to me, as I don't have time
>> >> >> to provide private support.  All such questions should be posted on
>> >> >> public forums, where I and others can see and answer them
>>
>> >> --
>> >> Romain Guy
>> >> Android framework engineer
>> >> romain...@android.com
>>
>> >> Note: please don't send private questions to me, as I don't have time
>> >> to provide private support.  All such questions should be posted on
>> >> public forums, where I and others can see and answer them
>>
>> --
>> Romain Guy
>> Android framework engineer
>> romain...@android.com
>>
>> Note: please don't send private questions to me, as I don't have time
>> to provide private support.  All such questions should be posted on
>> public forums, where I and others can see and answer them
> >
>



-- 
Romain Guy
Android framework engineer
romain...@android.com

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

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

Reply via email to