M Mickego Member Licensed User Longtime User Apr 15, 2013 #1 I tried the Gesture Library and Catched the X-Value when Pressing a ListView. No Problem getting the Value Problem is that the Gesture Catching kind of Locks the Press of the item in my ListView (ids). My Purpose to catch the xvalue is to use it in the Function for ids_ItemClick Sub ids_ItemClick(Position As Int,Value As Object) I can see the X-Value in a ToastMessage, but the "ids_ItemClick" is never Fired. Is it not possible to use it like I want ?
I tried the Gesture Library and Catched the X-Value when Pressing a ListView. No Problem getting the Value Problem is that the Gesture Catching kind of Locks the Press of the item in my ListView (ids). My Purpose to catch the xvalue is to use it in the Function for ids_ItemClick Sub ids_ItemClick(Position As Int,Value As Object) I can see the X-Value in a ToastMessage, but the "ids_ItemClick" is never Fired. Is it not possible to use it like I want ?
agraham Expert Licensed User Longtime User Apr 15, 2013 #2 Are you returning False from your OnTouchListener? If you return True the event is consumed and not propagated to the ClickListener. Upvote 0
Are you returning False from your OnTouchListener? If you return True the event is consumed and not propagated to the ClickListener.
M Mickego Member Licensed User Longtime User Apr 16, 2013 #3 Tried with both True and False Return now , but No success :-( thx Anyway for trying to help me Upvote 0
agraham Expert Licensed User Longtime User Apr 16, 2013 #4 Strange, returning False works for me and produces a Click event on a Panel. Maybe a ListView acts differently. Upvote 0
Strange, returning False works for me and produces a Click event on a Panel. Maybe a ListView acts differently.
M Mickego Member Licensed User Longtime User Apr 17, 2013 #5 Sometimes a "LongClick" produces a "ShortClick" but I can not Use it that way :-( I have different actions on the ListView depending on Long or Short Click Upvote 0
Sometimes a "LongClick" produces a "ShortClick" but I can not Use it that way :-( I have different actions on the ListView depending on Long or Short Click
Informatix Expert Licensed User Longtime User Sep 12, 2013 #6 Rick Harris said: Great library. I prefer it to GesturesDetector. Click to expand... It would be interesting (for me at least) to know why. As both libraries use the same code for the main part, and as Gesture Detector has more features and does not seem to me more difficult to use, I can't see why Gestures would be a better library but your message proves that I missed something. Upvote 0
Rick Harris said: Great library. I prefer it to GesturesDetector. Click to expand... It would be interesting (for me at least) to know why. As both libraries use the same code for the main part, and as Gesture Detector has more features and does not seem to me more difficult to use, I can't see why Gestures would be a better library but your message proves that I missed something.
Informatix Expert Licensed User Longtime User Sep 12, 2013 #7 Rick Harris said: Maybe I overlooked something, but with Gestures I can read the X and Y values at "Action Down" and "Action Up" and events are directly passed on to the relevant Object. With GestureDetector I did not succeed to pass short and long press events to the underlying object (especially a Listview). Moving the listview vertically was OK with Gesture Detector and also a horizontal swipe worked (which was one of my wishes). Having to use reflector routines to pass on press events is something I also did not like with Gesture Detector. All my Listview problems have now been solved with Gestures. I can scroll horizontally and vertically and short and long click events also are OK. Click to expand... Thank you for your feedback. Here's the declaration of the Down event in GestureDetector: Code: Copy onDown(X As Float, Y As Float, MotionEvent As Object) ...of the SingleTapUp event (you could also use SingleTapUpConfirmed): Code: Copy onSingleTapUp(X As Float, Y As Float, MotionEvent As Object) ...and of the LongPress event: Code: Copy onLongPress(X As Float, Y As Float, MotionEvent As Object) I can't see where the problem is to get the X and Y coordinates. I'd like to understand what you mean by "passing events to the object", because Gestures and GestureDetector work the same way (they listen to events; they do not trigger events) and are bound to a specific view (to get its events). Concerning the delegation of events, GestureDetector provides a way to send a MotionEvent to another view as it exports this information; it's impossible with Gestures, which only return basic data. Even in its first stage, my library never required the Reflection library, so there's maybe a confusion with another library because I don't recognize it here. Upvote 0
Rick Harris said: Maybe I overlooked something, but with Gestures I can read the X and Y values at "Action Down" and "Action Up" and events are directly passed on to the relevant Object. With GestureDetector I did not succeed to pass short and long press events to the underlying object (especially a Listview). Moving the listview vertically was OK with Gesture Detector and also a horizontal swipe worked (which was one of my wishes). Having to use reflector routines to pass on press events is something I also did not like with Gesture Detector. All my Listview problems have now been solved with Gestures. I can scroll horizontally and vertically and short and long click events also are OK. Click to expand... Thank you for your feedback. Here's the declaration of the Down event in GestureDetector: Code: Copy onDown(X As Float, Y As Float, MotionEvent As Object) ...of the SingleTapUp event (you could also use SingleTapUpConfirmed): Code: Copy onSingleTapUp(X As Float, Y As Float, MotionEvent As Object) ...and of the LongPress event: Code: Copy onLongPress(X As Float, Y As Float, MotionEvent As Object) I can't see where the problem is to get the X and Y coordinates. I'd like to understand what you mean by "passing events to the object", because Gestures and GestureDetector work the same way (they listen to events; they do not trigger events) and are bound to a specific view (to get its events). Concerning the delegation of events, GestureDetector provides a way to send a MotionEvent to another view as it exports this information; it's impossible with Gestures, which only return basic data. Even in its first stage, my library never required the Reflection library, so there's maybe a confusion with another library because I don't recognize it here.
Informatix Expert Licensed User Longtime User Sep 12, 2013 #8 Rick Harris said: Now I am struggling with Gestures and a Webview. Scrolling up and down of a webpage works as well as passing on events except for horizontal scroll which works once but then the listener remains death (events no longer fire). In Gestures there are a number of strange routines like using an event counter (something to do with "touchscreen noise" (?!)) and strange behaviour depending on whether or not Return True or Return False is used. Also I needed to use CallSubDelayed routine to do webview1.visible = false. Otherwise my App crashes. This is where I am now. If you have some suggestions regarding my webview problem then please let me know. All I want is the webview to act as normal and to use a horizontal swipe to hide the webview (or do something else like Page forward and Page back depending on the swipe direction). Click to expand... Unfortunately, I never found a use for Webview in my applications so I'm totally incompetent to help you with. I really wonder whether we talk of the same libraries because there's no "touchscreen noise" property in the Agraham's Gestures library (version 1.2). Upvote 0
Rick Harris said: Now I am struggling with Gestures and a Webview. Scrolling up and down of a webpage works as well as passing on events except for horizontal scroll which works once but then the listener remains death (events no longer fire). In Gestures there are a number of strange routines like using an event counter (something to do with "touchscreen noise" (?!)) and strange behaviour depending on whether or not Return True or Return False is used. Also I needed to use CallSubDelayed routine to do webview1.visible = false. Otherwise my App crashes. This is where I am now. If you have some suggestions regarding my webview problem then please let me know. All I want is the webview to act as normal and to use a horizontal swipe to hide the webview (or do something else like Page forward and Page back depending on the swipe direction). Click to expand... Unfortunately, I never found a use for Webview in my applications so I'm totally incompetent to help you with. I really wonder whether we talk of the same libraries because there's no "touchscreen noise" property in the Agraham's Gestures library (version 1.2).
Informatix Expert Licensed User Longtime User Sep 12, 2013 #9 Ok I see. Both libraries cannot catch some events because they are intercepted by the view. You can disable this interception by a listview or a scrollview with the following code: Code: Copy Dim r As Reflector r.Target = Your_List r.RunMethod2("requestDisallowInterceptTouchEvent", False, "java.lang.boolean") You have to call this for any touch event with Action = 2 (drag). Maybe that works also for a WebView. I looked to the demo of Gestures. Movecount is just there to reduce the number of events to handle. You can safely ignore it. I've heard it was necessary with Android 1.x to limit the number of input events but I have no old device to verify and these early versions have almost disappeared. About returning True or False: when you get a touchdown event (Action = 0), you have to decide whether your code will process the event and consume it (Return True; the event is not passed to the view). Upvote 0
Ok I see. Both libraries cannot catch some events because they are intercepted by the view. You can disable this interception by a listview or a scrollview with the following code: Code: Copy Dim r As Reflector r.Target = Your_List r.RunMethod2("requestDisallowInterceptTouchEvent", False, "java.lang.boolean") You have to call this for any touch event with Action = 2 (drag). Maybe that works also for a WebView. I looked to the demo of Gestures. Movecount is just there to reduce the number of events to handle. You can safely ignore it. I've heard it was necessary with Android 1.x to limit the number of input events but I have no old device to verify and these early versions have almost disappeared. About returning True or False: when you get a touchdown event (Action = 0), you have to decide whether your code will process the event and consume it (Return True; the event is not passed to the view).
Informatix Expert Licensed User Longtime User Sep 12, 2013 #10 And I see now what's missing in my library. You cannot return True or False for touch events. And I understand now why you used the reflection library to return this boolean. My library has been designed at the beginning to detect gestures like double tap or fling, which is complicated or impossible to do with the Gestures library. Upvote 0
And I see now what's missing in my library. You cannot return True or False for touch events. And I understand now why you used the reflection library to return this boolean. My library has been designed at the beginning to detect gestures like double tap or fling, which is complicated or impossible to do with the Gestures library.
Informatix Expert Licensed User Longtime User Oct 28, 2013 #11 I added a return value to the onTouch event of the Gesture Detector library. Upvote 0