No one is able to offer any guidance on this? Mark? Dianne? Romain? Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware
On Mon, Mar 7, 2011 at 11:25 PM, Justin Anderson <[email protected]>wrote: > I started a post on StackOverflow as well without much luck... There is > now a bounty of 50 points on this question at StackOverflow if someone knows > the answer: > > > http://stackoverflow.com/questions/5187173/simpleongesturelistener-code-not-working-in-android-2-2 > > This problem has now been a major showstopper for the next update of my app > for about two weeks... > > > On Thu, Mar 3, 2011 at 8:59 AM, Justin Anderson <[email protected]>wrote: > >> Has no one ever tried to get swipe gestures and clicks working together on >> the same view? Pre-Android 2 everything worked fine. Starting with Android >> 2 I can only seem to get one or the other but not both... >> >> >> On Wed, Mar 2, 2011 at 12:22 AM, MagouyaWare <[email protected]>wrote: >> >>> I have some code that I wrote to implement a vertical swipe on a >>> Gallery widget. It works great in Android 1.5 and 1.6 but does not >>> work in Android 2.2 (I have yet to try it with 2.1). >>> >>> public class SwipeUpDetector extends SimpleOnGestureListener >>> implements OnTouchListener >>> { >>> private GestureDetector m_detector; >>> >>> public SwipeUpDetector() >>> { >>> m_detector = new GestureDetector(m_context, this); >>> } >>> >>> @Override >>> public boolean onFling(MotionEvent e1, MotionEvent e2, float >>> velocityX, float velocityY) >>> { >>> if (Math.abs(e1.getX() - e2.getX()) < s_swipeMaxOffPath && >>> e1.getY() - e2.getY() >= s_swipeMinDistance && >>> Math.abs(velocityY) >= s_swipeMinVelocity) >>> { >>> int pos = >>> m_gallery.pointToPosition((int)e1.getX(), >>> (int)e2.getY()); >>> startAnimation(pos); >>> >>> return true; >>> } >>> >>> return false; >>> } >>> >>> @Override >>> public boolean onTouch(View v, MotionEvent event) >>> { >>> return m_detector == null ? false : >>> m_detector.onTouchEvent(event); >>> } >>> } >>> >>> And to be able to get my gallery to detect the onFling I have the >>> following: >>> m_gallery.setOnTouchListener(new SwipeUpDetector()); >>> >>> In Android 1.5 and 1.6 this works great. In Android 2.2 onFling() is >>> never called. In looking around on Google and StackOverflow I found >>> one possible solution was to implement onDown() and return true. >>> >>> However, I am also listening to single clicks and have a context menu >>> listener set up on this gallery. When I implement onDown() and return >>> true I do indeed get the swipe to work. But when I do this the >>> context menu doesn't display on a long click and the single clicks >>> don't work either... Clicking on items in the gallery cause the >>> gallery to jump around and I don't get any feedback when I click on an >>> item in the gallery. It just immediately makes that item the selected >>> item and moves it to the center. >>> >>> I looked at the API differences report between 1.6, 2.1, and 2.2 and >>> didn't see anthing of significance that could have caused this to >>> break... >>> >>> What am I doing wrong? >>> >>> -- >>> 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 >> >> >> > -- 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

