Woops... one thing I just noticed. The if statement in my onDown() method is no longer there. I used to be using onTouch() instead which is why it was there.
On Feb 23, 1:07 am, MagouyaWare <[email protected]> wrote: > I have searched this forum and StackOverflow and wasn't able to come > up with anything for the problem I am facing. > > I have subclassed Gallery because I wanted to be able to implement a > vertical fling of items in the gallery (as a way to remove them). > Obviously I still want the horizontal fling to work > > The problem I am running into is that onFling does not always get > called for some reason when my fling is vertical. Just doing a > straight vertical fling does not enter the onFling method. However, > if I move slightly to the left or right and then fling vertically I > get into the onFling method and everything works as expected. > > I am using the following code in my Gallery subclass to achieve this: > > @Override > public boolean onFling(MotionEvent e1, MotionEvent e2, float > velocityX, float velocityY) > { > if (m_curTouchPos == NO_CURRENT_TOUCH_POS || m_callback == null) > return super.onFling(e1, e2, velocityX, velocityY); > > float e1x = e1.getX(); > float e1y = e1.getY(); > float e2x = e2.getX(); > float e2y = e2.getY(); > > float offPath = Math.abs(e1x - e2x); > float distance = Math.abs(e1y - e2y); > > if (offPath < s_swipeMaxOffPath && > //Math.abs(velocityY) >= s_swipeMinVelocity && > distance >= s_swipeMinDistance) > { > if (e1y > e2y) > { > m_callback.onSwipeUp(m_curTouchPos); > } > else if (e2y > e1y) > { > //TODO: IMPLEMENT THIS > //m_callback.onSwipeDown(m_curTouchPos); > } > } > > m_curTouchPos = NO_CURRENT_TOUCH_POS; > return super.onFling(e1, e2, velocityX, velocityY); > > } > > @Override > public boolean onDown(MotionEvent eve) > { > if (eve.getAction() == MotionEvent.ACTION_DOWN) > m_curTouchPos = pointToPosition((int)eve.getX(), > (int)eve.getY()); > > return super.onDown(eve); > > } > > What am I doing wrong? > > Thanks in advance, > Justin -- 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

