MR.Gestures handles ALL touch gestures

15681011

Posts

  • Hi,
    I would like to use in my application the basic functionalities of your library - those that do not require a valid license key.
    Have I to buy the license in any case, or can I use your library without license?

    Thank you!
    Mike

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭

    @AlessioIafrate
    I have not been able to do that in a extensible way cross platform so you have to check yourself which image is on top. If the two images overlap only partly, then you can check the exact position of the tap in the Touches property of the TapEventArgs.

    @mikewhite2731
    Currently you can use it without license if you don't need the EventArgs. I may change that in the future.

  • Thanks for your response, but touches have relative position, how can i have absolute position?

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭

    @AlessioIafrate
    You can either handle Down and Panning on the Page too or you search in this forum how to get the coordinates of any element on the screen. This is no MR.Gestures specific problem.

  • DarioOrgazDarioOrgaz USMember ✭✭

    Is there any way to combine ffimageloading with mr.Image?

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭

    @DarioOrgaz

    The easiest way would be to place the image in a container from MR.Gestures.

    If you really want to combine both in one control, you'd have to repeat the code from one in your custom control as you cannot inherit from two classes. But that would be quite some effort.

  • DarioOrgazDarioOrgaz USMember ✭✭

    @MichaelRumpler said:
    @DarioOrgaz

    The easiest way would be to place the image in a container from MR.Gestures.

    If you really want to combine both in one control, you'd have to repeat the code from one in your custom control as you cannot inherit from two classes. But that would be quite some effort.

    Thank you!

  • IgorPerunovicIgorPerunovic USUniversity

    I'm having some troubles on UWP. I'm using MR.StackLayout for handling tapping events, but when I place a picker inside a SL, selecting an item causes the StackLayout's tapping event to trigger as well (if the selected item was above the SL, but not directly above the picker itself, as it's a drop-down picker)

    Also, in a MasterDetailPage, my menu has MR.StackLayouts for menu items, but even when the menu is not visible (it slides back), the tapping events for the menu items trigger when I tap where they used to be (as if the menu were still here, but it isn't).

    Do you know what could be causing this? (the same menu problem doesn't come up when I use simple buttons in place of MR.StackLayouts, so I'm assuming the problem is SL related)

  • IgorPerunovicIgorPerunovic USUniversity

    I've tried this out in a test app with just a MasterDetail page, and it still happens on a StackLayout on UWP, so it's definitely not a problem specific to my app. The menu shows up, closes, and the SLs from the menu still trigger on tapping on where they used to be (even though they are hidden at the time).

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭

    @IgorPerunovic
    MR.Gestures adds native event handlers to the native controls which are used by the XF controls and forwards those events to the events you can handle. I don't know how the MasterDetailPage is implemented on UWP. Maybe they just hide the Master page and its position is still on the visible screen. I also saw problems when elements are moved with TranslationX/Y or animated. Then sometimes the original positions are used for gesture calculations. This would explain the behavior you saw.

    Multiple overlapping elements which handle touch gestures are a big problem. Elements with some functionality (like the Picker) must still work even if the touch gestures are handled by MR.Gestures. So I strive to keep the gestures on all overlapping elements working. The user can then decide, which gestures he wants to ignore.

    Originally I wanted to use the Handled flag in the event handlers to skip other handlers in overlapping elements, but I couldn't find a reliable way on every platform to implement that. So I raise the events on all touched elements.

    In your case you could just check if the Master page is visible when the StackLayout in your Master page is tapped.

  • bdlbdl DKMember ✭✭

    I'm having some problems with MR Gestures on iOS. I have two views on top of each other. Both uses MR Gesture. The top element listens to tapped but it will only do so once. The second time I press it, it will no longer fire the event. But if I open a modal page, it will work again but still only once. It seems to work if I replace the command after every tap. Do you have any idea why this is needed?

    Thanks in advance

  • bdlbdl DKMember ✭✭

    Up and Down seems to work every time though. It's just tapped (and tapping it would seem)

  • SamOh.4060SamOh.4060 USMember

    My current status is, using your MR Gestures iOS, I've added up/down event in the AbsoluteLayout, and I've also added Clicked event to Button within the AbsoluteLayout.

    In this current situation, whenever up/down event occurs, the Button Clicked event does not work properly. What can I do to make this work, or workaround it? Please help!

  • SamOh.4060SamOh.4060 USMember

    Also, I have another question:

    I have added pan event in AbsoluteLayout (calling A), and added another AbsoluteLayout (calling B) with pan event within A. In this case, whenever I touch A, the pan event in A is being called (which is expected). However, whenever I touch B, I was expecting the pan event in B to be called, but the pan event in A is being called.

    Is this a bug? or intended?

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭

    @BentDalgaardLarsen Overlapping views sometimes cause troubles but I didn't see the problem you described yet. Could you please make a repro project or even better: add a repro page to the GestureSample?

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭
    edited November 2016

    @SamOh.4060 This is also described on my web page in the compatibility table for the Button:

    If Down/Up are handled, then the Xamarin Clicked event does not work anymore. Tapping, Tapped, DoubleTapped are handled by the Button itself.

    Apple "optimized" the touch events for some controls (UIButton, UISlider and UIStepper). They try to do what they think that the user wants. The result is, that some events are consumed and the control in question is not notified anymore. I searched for a workaround for quite long, but couldn't find anything.

    Regarding your second question, as I just wrote, overlapping views sometimes cause troubles. I always try not to consume any events but to send them to all overlapping controls, but sometimes the native platform does not do it. There may be a workaround if you know, that there is another overlapping control which handles touch events. But as MR.Gestures is an abstraction, I cannot know that. So my general advice is to prevent overlapping controls which handle touch gestures wherever possible.

  • Hi Michael,

    For Panned event handler PanEventArgs parameter contains TotalDistance property, but there is no such property for SwipeEventArgs. Is it possible to add this property for SwipeEventArgs as well, as when handling the swiped event I need to know not only the swipe direction, but also whether it was a "short" or a "long swipe".

    Thank you.

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭

    @AndriiKaplanovskyi

    Yes, I wanted to add these for quite some time but didn't do it yet. I hope to find some time for MR.Gestures in the next couple of days.

  • @MichaelRumpler

    Could you please let me know when this feature is available. Thank you very much for your effort.

  • bdlbdl DKMember ✭✭

    Hi Michael,

    I have managed to reproduce the problem in your (unchanged) sample app. If I go to the Layout/ContentView demo and start panning and pinching a lot(!), then at some point it will only recognize Down, Up, Tapping, Tapped, Pressing and Pressed. All the others stop working. I have tested it on an iPhone 5s, and it seems like the problems occurs more often on an iPhone (compared to iPad). Down and Up recognizes more than one finger.

    In my app, if I change page and go back, it starts to work again. If that helps :)

    Thanks in advance

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭

    @AndriiKaplanovskyi If the last Xamarin update would've worked then you'd have it already. Unfortunately I cannot deploy to Android anymore. So be patient.

    @BentDalgaardLarsen I only have two iPads, but no iPhone anymore (my 3DS stopped working). I never saw that on the iPads and I dragged my cat around a lot! I'll try to reproduce, but it doesn't sound like that's easy.

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭

    I released MR.Gestures 1.4.0.

    • SwipeEventArgs is a PanEventArgs and therefore also contains DeltaDistance, TotalDistance and Velocity

    As @AndriiKaplanovskyi requested.

    • add controls for AppCompat (MR.Gestures.AppCompat*)

    The ExportRendererAttribute only allows for one renderer per control, but Xamarin has separate renderers for AppCompat for Button, Frame, Picker and Switch. Therefore I added MR.Gestures.AppCompatButton, AppCompatFrame, AppCompatPicker and AppCompatSwitch. Their respective renderers inherit from Xamarin.Forms.Platform.Android.AppCompat.*Renderer.
    I also added a GestureSample.DroidAppCompat project to the GestureSample which uses an AppCompat theme. And there are now also some test pages which use those now controls.

    • no events are raised if InputTransparent == true (on iOS there are also no events if any container has InputTransparent)

    @JohnEeckhout requested this and I rejected it first because it is a breaking change. But as I raised the minor version now, I think it is ok.

    • [iOS] the Panned and Swiped events contain the last Touches before the finger was raised

    iOS just didn't return the touch position with LocationOfTouch when the gesture was already ended and all fingers left the screen. But as all other gestures on all other platforms did return the position of the fingers which just left the screen and it is really unintuitive I added my own logic to return that.

    • [Windows] the LongPressed event contain the last Touches before the finger was raised

    On Windows I messed up the LongPressed event. I fixed this too now.

  • ShawnCastrianni.5092ShawnCastrianni.5092 US ✭✭✭
    edited December 2016

    I think gestures like Pan need a StartPoint argument in the PanEventArgs. Since a pan does not start right away (due to a minimum delta needed to detect a pan is happening), some apps will need to know where the user originally touched to start the pan. Take a drawing app that has symbols on the screen. Say the user wants to drag that symbol around. The user touches the symbol on the screen and starts a pan. By the time the Panning event is fired for the very first time, the information in the PanEventArgs only specifies where the finger is NOW, not where it was originally placed to start the drag. Therefore, the user's finger may no longer be on the symbol on the screen anymore so the logic to detect if the user is trying to drag a symbol would fail.

    This seems like a pretty important issue so I wonder if anyone else has encountered this. Maybe a StartPoint argument in the PanEventArgs is not the best way. I thought maybe the very first Panning event that is fired will have a non-zero Delta and non-zero Total so that I can back calculate the original starting point myself.

    Or maybe I can use the Down event and remember the starting point myself, although I would then have to augment the Delta and Total in the PanEventArgs to correct for where I really wanted to start my pan??

  • ShawnCastrianni.5092ShawnCastrianni.5092 US ✭✭✭
    edited December 2016

    @MichaelRumpler Sometimes after I lift my finger from a Pan gesture, sometimes I also get a Tapped event. Not always, but sometimes. What might cause a Tapped event to fire at the end of a Pan?

    You can recreate this with your own GestureSample on the ContentPage Sample. Just try to pan the image around and occasionally you will see event occur AFTER the Panned event, like LongPressed or Tapped. This is a big issue for my app. Am I doing something wrong or is this a bug?

  • MichaelEickMichaelEick USMember

    First, it's good to have MR actively working on this important missing feature; thanks!
    Second, I am pretty new to gesture handling so the answer to my issue may be obvious to you but ...

    I am using Xamarin.Forms targeting Android and IOS, not using XAML but rather coding everything.
    I have a page containing a ViewList with custom data bound ViewCells that contain a grid, some labels, and a image. This Viewlist is in a ScrollView on the page.

    My objective is to be able to use gestures (say drag and drop) to reorder items in the ViewList. I have tried a number of approaches to no avail (using LongPress, Up, and/or the Pan events). Some issues I run into are:

    • Gestures on a view in the grid (the Image, for instance) seem to have the X/Y constrained to the view.
    • Gestures on the Grid or ViewList seem to consume the IsSelected for my custom ViewCell.
    • Gestures on the ScrollView seem sort of OK and I can get good X/Y delta information, but translating the X/Y to the source element so far has eluded me
    • Also the fact that I have a ScrollView at all seems to make a vertical Drag/Drop unlikely to be useful. I would have to be able to disable the scroll after the drag started.

    Anyway, just now I am thinking this may not be viable but hate to give up. Any thoughts?

    Thanks!

  • bdlbdl DKMember ✭✭

    Android NullReferenceException Swipe-gesture:

    Anyone else getting a Nullreference exception using the Swipe MR.Gesture?

    I have so far experienced it in AbsolutLayout and Grid, haven't testet it on other layouts.

    android.runtime.JavaProxyThrowable: System.NullReferenceException: Object reference not set to an instance of an object.
      at MR.Gestures.Android.EventArgs.AndroidSwipeEventArgs..ctor (Android.Views.MotionEvent previous, Android.Views.MotionEvent current, MR.Gestures.PanEventArgs prevArgs, Android.Views.View view, MR.Gestures.Direction direction) [0x0004d] in <572caafff32c4efebfe30e5e0d32916a>:0 
      at MR.Gestures.Android.SimpleGestureListener.OnFling (Android.Views.MotionEvent down, Android.Views.MotionEvent up, System.Single velocityX, System.Single velocityY) [0x000b2] in <572caafff32c4efebfe30e5e0d32916a>:0 
      at Android.Views.GestureDetector+SimpleOnGestureListener.n_OnFling_Landroid_view_MotionEvent_Landroid_view_MotionEvent_FF (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_e1, System.IntPtr native_e2, System.Single velocityX, System.Single velocityY) [0x00019] in /Users/builder/data/lanes/3819/96c7ba6c/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.Views.GestureDetector.cs:1120 
      at (wrapper dynamic-method) System.Object:f0c8bbb1-6aaa-4c81-b1b4-cdc9d93090a0 (intptr,intptr,intptr,intptr,single,single)
        at md52e2717e09da627326f0f75edf149a116.SimpleGestureListener.n_onFling(Native Method)
        at md52e2717e09da627326f0f75edf149a116.SimpleGestureListener.onFling(SimpleGestureListener.java:47)
        at android.view.GestureDetector.onTouchEvent(GestureDetector.java:620)
        at md5297669650d848324368d2f140a00ba63.AbsoluteLayoutRenderer.n_dispatchTouchEvent(Native Method)
        at md5297669650d848324368d2f140a00ba63.AbsoluteLayoutRenderer.dispatchTouchEvent(AbsoluteLayoutRenderer.java:45)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425)
        at md5b60ffeb829f638581ab2bb9b1a7f4f3f.PlatformRenderer.n_dispatchTouchEvent(Native Method)
        at md5b60ffeb829f638581ab2bb9b1a7f4f3f.PlatformRenderer.dispatchTouchEvent(PlatformRenderer.java:55)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425)
        at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2568)
        at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1776)
        at android.app.Activity.dispatchTouchEvent(Activity.java:2866)
        at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
        at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
        at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2529)
        at android.view.View.dispatchPointerEvent(View.java:9186)
        at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4706)
        at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4544)
        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4068)
        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4121)
        at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4087)
        at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4201)
        at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4095)
        at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4258)
        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4068)
        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4121)
        at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4087)
        at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4095)
        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4068)
        at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6564)
        at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6454)
        at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6425)
        at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6654)
        at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
        at android.os.MessageQueue.nativePollOnce(Native Method)
        at android.os.MessageQueue.next(MessageQueue.java:143)
        at android.os.Looper.loop(Looper.java:130)
        at android.app.ActivityThread.main(ActivityThread.java:5951)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
    
  • bdlbdl DKMember ✭✭

    Android NullReferenceException Swipe-gesture:

    Anyone else getting a Nullreference exception using the Swipe MR.Gesture?

    I have so far experienced it in AbsolutLayout and Grid, haven't testet it on other layouts.

    Xamarin caused by: android.runtime.JavaProxyThrowable: System.NullReferenceException: Object reference not set to an instance of an object.
    at MR.Gestures.Android.EventArgs.AndroidSwipeEventArgs..ctor (Android.Views.MotionEvent previous, Android.Views.MotionEvent current, MR.Gestures.PanEventArgs prevArgs, Android.Views.View view, MR.Gestures.Direction direction) [0x0004d] in <572caafff32c4efebfe30e5e0d32916a>:0
    at MR.Gestures.Android.SimpleGestureListener.OnFling (Android.Views.MotionEvent down, Android.Views.MotionEvent up, System.Single velocityX, System.Single velocityY) [0x000b2] in <572caafff32c4efebfe30e5e0d32916a>:0
    at Android.Views.GestureDetector+SimpleOnGestureListener.n_OnFling_Landroid_view_MotionEvent_Landroid_view_MotionEvent_FF (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_e1, System.IntPtr native_e2, System.Single velocityX, System.Single velocityY) [0x00019] in /Users/builder/data/lanes/3819/96c7ba6c/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.Views.GestureDetector.cs:1120
    at (wrapper dynamic-method) System.Object:f0c8bbb1-6aaa-4c81-b1b4-cdc9d93090a0 (intptr,intptr,intptr,intptr,single,single)
    at md52e2717e09da627326f0f75edf149a116.SimpleGestureListener.n_onFling(Native Method)
    at md52e2717e09da627326f0f75edf149a116.SimpleGestureListener.onFling(SimpleGestureListener.java:47)
    at android.view.GestureDetector.onTouchEvent(GestureDetector.java:620)
    at md5297669650d848324368d2f140a00ba63.AbsoluteLayoutRenderer.n_dispatchTouchEvent(Native Method)
    at md5297669650d848324368d2f140a00ba63.AbsoluteLayoutRenderer.dispatchTouchEvent(AbsoluteLayoutRenderer.java:45)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425)
    at md5b60ffeb829f638581ab2bb9b1a7f4f3f.PlatformRenderer.n_dispatchTouchEvent(Native Method)
    at md5b60ffeb829f638581ab2bb9b1a7f4f3f.PlatformRenderer.dispatchTouchEvent(PlatformRenderer.java:55)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425)
    at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2568)
    at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1776)
    at android.app.Activity.dispatchTouchEvent(Activity.java:2866)
    at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
    at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
    at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2529)
    at android.view.View.dispatchPointerEvent(View.java:9186)
    at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4706)
    at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4544)
    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4068)
    at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4121)
    at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4087)
    at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4201)
    at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4095)
    at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4258)
    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4068)
    at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4121)
    at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4087)
    at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4095)
    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4068)
    at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6564)
    at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6454)
    at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6425)
    at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6654)
    at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
    at android.os.MessageQueue.nativePollOnce(Native Method)
    at android.os.MessageQueue.next(MessageQueue.java:143)
    at android.os.Looper.loop(Looper.java:130)
    at android.app.ActivityThread.main(ActivityThread.java:5951)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)

  • bdlbdl DKMember ✭✭

    Android NullReferenceException Swipe-gesture:

    Anyone else getting a Nullreference exception using the Swipe MR.Gesture?

    I have so far experienced it in AbsolutLayout and Grid, haven't testet it on other layouts.

    android.runtime.JavaProxyThrowable: System.NullReferenceException: Object reference not set to an instance of an object. at MR.Gestures.Android.EventArgs.AndroidSwipeEventArgs..ctor (Android.Views.MotionEvent previous, Android.Views.MotionEvent current, MR.Gestures.PanEventArgs prevArgs, Android.Views.View view, MR.Gestures.Direction direction) [0x0004d] in <572caafff32c4efebfe30e5e0d32916a>:0 at MR.Gestures.Android.SimpleGestureListener.OnFling (Android.Views.MotionEvent down, Android.Views.MotionEvent up, System.Single velocityX, System.Single velocityY) [0x000b2] in <572caafff32c4efebfe30e5e0d32916a>:0 at Android.Views.GestureDetector+SimpleOnGestureListener.n_OnFling_Landroid_view_MotionEvent_Landroid_view_MotionEvent_FF (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_e1, System.IntPtr native_e2, System.Single velocityX, System.Single velocityY) [0x00019] in /Users/builder/data/lanes/3819/96c7ba6c/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.Views.GestureDetector.cs:1120 at (wrapper dynamic-method) System.Object:f0c8bbb1-6aaa-4c81-b1b4-cdc9d93090a0 (intptr,intptr,intptr,intptr,single,single) at md52e2717e09da627326f0f75edf149a116.SimpleGestureListener.n_onFling(Native Method) at md52e2717e09da627326f0f75edf149a116.SimpleGestureListener.onFling(SimpleGestureListener.java:47) at android.view.GestureDetector.onTouchEvent(GestureDetector.java:620) at md5297669650d848324368d2f140a00ba63.AbsoluteLayoutRenderer.n_dispatchTouchEvent(Native Method) at md5297669650d848324368d2f140a00ba63.AbsoluteLayoutRenderer.dispatchTouchEvent(AbsoluteLayoutRenderer.java:45) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425) at md5b60ffeb829f638581ab2bb9b1a7f4f3f.PlatformRenderer.n_dispatchTouchEvent(Native Method) at md5b60ffeb829f638581ab2bb9b1a7f4f3f.PlatformRenderer.dispatchTouchEvent(PlatformRenderer.java:55) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425) at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2568) at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1776) at android.app.Activity.dispatchTouchEvent(Activity.java:2866) at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60) at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60) at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2529) at android.view.View.dispatchPointerEvent(View.java:9186) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4706) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4544) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4068) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4121) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4087) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4201) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4095) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4258) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4068) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4121) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4087) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4095) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4068) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6564) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6454) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6425) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6654) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:143) at android.os.Looper.loop(Looper.java:130) at android.app.ActivityThread.main(ActivityThread.java:5951) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)

  • bdlbdl DKMember ✭✭

    Android NullReferenceException Swipe-gesture:

    Anyone else getting a Nullreference exception using the Swipe MR.Gesture?

    I have so far experienced it in AbsolutLayout and Grid, haven't testet it on other layouts.

    android.runtime.JavaProxyThrowable: System.NullReferenceException: Object reference not set to an instance of an object. at MR.Gestures.Android.EventArgs.AndroidSwipeEventArgs..ctor (Android.Views.MotionEvent previous, Android.Views.MotionEvent current, MR.Gestures.PanEventArgs prevArgs, Android.Views.View view, MR.Gestures.Direction direction) [0x0004d] in <572caafff32c4efebfe30e5e0d32916a>:0 at MR.Gestures.Android.SimpleGestureListener.OnFling (Android.Views.MotionEvent down, Android.Views.MotionEvent up, System.Single velocityX, System.Single velocityY) [0x000b2] in <572caafff32c4efebfe30e5e0d32916a>:0 at Android.Views.GestureDetector+SimpleOnGestureListener.n_OnFling_Landroid_view_MotionEvent_Landroid_view_MotionEvent_FF (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_e1, System.IntPtr native_e2, System.Single velocityX, System.Single velocityY) [0x00019] in /Users/builder/data/lanes/3819/96c7ba6c/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.Views.GestureDetector.cs:1120 at (wrapper dynamic-method) System.Object:f0c8bbb1-6aaa-4c81-b1b4-cdc9d93090a0 (intptr,intptr,intptr,intptr,single,single) at md52e2717e09da627326f0f75edf149a116.SimpleGestureListener.n_onFling(Native Method) at md52e2717e09da627326f0f75edf149a116.SimpleGestureListener.onFling(SimpleGestureListener.java:47) at android.view.GestureDetector.onTouchEvent(GestureDetector.java:620) at md5297669650d848324368d2f140a00ba63.AbsoluteLayoutRenderer.n_dispatchTouchEvent(Native Method) at md5297669650d848324368d2f140a00ba63.AbsoluteLayoutRenderer.dispatchTouchEvent(AbsoluteLayoutRenderer.java:45) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425) at md5b60ffeb829f638581ab2bb9b1a7f4f3f.PlatformRenderer.n_dispatchTouchEvent(Native Method) at md5b60ffeb829f638581ab2bb9b1a7f4f3f.PlatformRenderer.dispatchTouchEvent(PlatformRenderer.java:55) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425) at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2568) at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1776) at android.app.Activity.dispatchTouchEvent(Activity.java:2866) at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60) at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60) at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2529) at android.view.View.dispatchPointerEvent(View.java:9186) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4706) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4544) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4068) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4121) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4087) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4201) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4095) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4258) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4068) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4121) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4087) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4095) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4068) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6564) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6454) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6425) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6654) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:143) at android.os.Looper.loop(Looper.java:130) at android.app.ActivityThread.main(ActivityThread.java:5951) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭

    I just released version 1.4.1.

    • [Android] fix: NullReferenceException when swiping
    • [Android] fix: EventArgs are empty if Panned is handled, but not Panning
    • [iOS] fix: after short pan gestures, Tapped is raised too
    • [iOS] fix: a short pan may be called without Touches (UIPanGestureRecognizer.NumberOfTouches == 0)
  • AWESOME!! Thanks!!

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭

    @MichaelEick

    This is very complex and should rather be done on each native platform.
    I already saw some threads in this forum where people asked for the same functionality. A XF component with native implementation for each platform would be perfect, but I didn't see any yet.

  • Umar3xUmar3x FRMember ✭✭✭

    Hello,

    @MichaelRumpler

    Does your plugin will be working to detect drag event on a map ?
    Like detecting when a drag is currently happening on the map and do some instructions/modifications to the current map for exemple like adding a pin when drag end and removing it when drag begins until next drag endding ?

    Regards.

  • Umar3xUmar3x FRMember ✭✭✭
    edited December 2016

    @MichaelRumpler

    Forget about my last post, Ive found another solution, bought your plugin and put my Map in a grid did the job for what I Wanted to achieve

    var grid = new MR.Gestures.Grid();
    grid.Add(map);

    grid.Panning += (s, e) => { Debug.WriteLine("Dragging map") };
    grid.Panned += (s, e) => { Debug.WriteLine("Dragg end") };

  • aschenkelaschenkel CHMember

    Hello

    I have a problem with my ListView. I implemented LongPressing with MR. Gestures Plugin.
    Now i open a context menu on LongPressing a ListViewItem.
    But when the context menu is open and the finger allways pressing on screen, the ListView always is scrolling on Pan.

    I want to leave the ListView without release the finger from screen.

    Has anyone an idea to solve this problem?

    Thanks.

  • aisacaisac DEMember ✭✭

    How Can I add to the swipe (left and right) control the Animation FadeTo()?

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭

    @asiac

    Swiped is raised when the finger left the screen. That's too late for your animation. For this you should use Panning. This raises every time your finger on the display moves.

  • aisacaisac DEMember ✭✭
    edited March 2017

    @MichaelRumpler you are right, even though the Swipe worked just fine for iOS devices but unfortunately not with Android.
    Just something that I am missing in the PanEventArgs is the direction, is there any way to get the pan direction?
    Thanks for the quick reply and thanks for this amazing plugin :smile:

  • roesterroester USUniversity ✭✭
    edited March 2017

    Can you explain (or point me to a sample or doc) how to consume MR.Gestrures in a XAML control that has its own custom renderer?

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭

    @roester Just let your custom renderer inherit from MR.Gestures.platform.Renderers.basecontrol Renderer instead of the renderer from Xamarin. Be sure to call the base methods in all methods you override.

Sign In or Register to comment.