MR.Gestures handles ALL touch gestures

1246710

Posts

  • NorbertHesterNorbertHester Norbert Hester USMember

    I've got the velocity value from a swipe gesture. Anyone know a lib / class that acts as "velocity decelerator" ? To implement your own scrollviewer-like control ? It should send events in short intervals (e.g. every 20 ms) and provide the new velocity value (whose absolute value gets smaller each time)

  • NorbertHesterNorbertHester Norbert Hester USMember

    a decay animation functionality ?

  • NorbertHesterNorbertHester Norbert Hester USMember

    Finally I found a solution using View.Animate e.g.

    this.Animate(name: animationHandle, callback: callback1, start: velocityY, end: 0.1, length:3000, easing: Easing.CubicOut, finished: finishedDecay);

  • MichaelRumplerMichaelRumpler Michael Rumpler ATMember ✭✭✭✭

    I just released MR.Gestures 1.2.3.

    It is compiled with Xamarin.Forms 1.5.0.6446 and must be used in your WinPhone projects if you use XF 1.5.*.

    There are no code changes in this version.

  • KestonCrandallKestonCrandall Keston Crandall USMember

    @MichaelRumpler

    I was just wondering if you were thinking about supporting 3D touch anytime in the future. I think it might be a nice premium feature that people might pay a bit extra for. I know I would.

  • ChaseFlorellChaseFlorell Chase Florell CAInsider, University mod

    @KestonCrandall since this is a Forms project, what would the 3D touch equivalent look like on Android and WinPhone? Does it still fit the cross-platform paradigm.

  • KestonCrandallKestonCrandall Keston Crandall USMember

    @ChaseFlorell
    It wouldn't be a cross platform feature obviously. It would something you would use coditionally with iOS in your shared code with MR.Gestures.

  • ANDOANDO AN DO USMember
    edited September 2015

    HI MR, I've used your product to working in my project.
    It works like a charm with mouse mode in the simulator, but it's not working with touch mode in the simulator and the real device also.
    Could you please suggest me anything in this case?
    P/S: My app is built on windows 8.1 platform. And I used Swipe and panning gestures to catch all action of swipe to right or left.

  • MichaelRumplerMichaelRumpler Michael Rumpler ATMember ✭✭✭✭

    @KestonCrandall @ChaseFlorell
    3D Touch is available in the Android API for ages (even though it does not work on all devices). The Windows Runtime API includes it too. They just didn't use it. Maybe this will change now that Apple does. So multiplatform support wouldn't be a big problem.
    I will add it, but currently I have no time for it. I have to release my own app before I go on vacation for 4 weeks. I'll be coming back in the 2nd week of November and will hopefully have time to do more on MR.Gestures by mid of November.

    @ANDO
    Sorry to hear that. As I already stated on my web page:

    I do not have a multitouch device (Windows tablet or touchscreen for the desktop) to test Windows Store apps. I could only test the single touch gestures with the mouse. LongPress does not work with the mouse at all. I suppose it really needs to come from a touch device.
    For that reason Windows Store apps are missing in the following table. I cannot tell you what works and what doesn't, unless I can test it on a real device.

    Windows Phone 8.1 and Windows 8.1 both use exactly the same code. So I really don't know, why it works on the phone, but not on the desktop. Unfortunately there's nothing I can do about it until I got my own touchscreen for the PC - which is not planned unless one of my monitors breaks. And to be honest, the Universal Windows Platform is more important, than Windows Runtime. If it runs on UWP, but not on runtime, then that's how it will be. I also won't put any effort in WinPhone Silverlight anymore.

  • ANDOANDO AN DO USMember

    @MichaelRumpler: Thanks for ur reply.
    I solved that problem, your gesture works correctly in Win RT and real device.

    But today, I got an issue. This is my log for this issue:

    Message: Value does not fall within the expected range.
    Stack trace: at Windows.UI.Input.GestureRecognizer.ProcessDownEvent(PointerPoint value)
    at MR.Gestures.WinRT.WinRTGestureHandler.OnPointerPressed(CoreWindow sender, PointerEventArgs ev).

    It's just occur only one time, but It's cause my app crash. I wondering that it can occur again in using time however I can not replicate it :persevere: So, could you provide me which way for this case happen?

  • MichaelRumplerMichaelRumpler Michael Rumpler ATMember ✭✭✭✭

    @ANDO I'm glad that it works on WinRT too.
    I couldn't find why ProcessDownEvent would throw an exception, but I added a try/catch around all calls to the Windows.UI.Input.GestureRecognizer. It will be included in the next version.

  • KrisAdamsKrisAdams Kris Adams GBMember ✭✭

    Hi @MichaelRumpler

    I have just bought and attempted to implement your touch handlers in a new IOS Forms project. I copied the bare-bones Xaml, putting the commands for the gestures on the ContentPage, and implementing them in the ViewModel.

    When I run it on my device, it works fine. However, the Simulator doesn't raise any of the events.

    Is there something special I need to do to make this work in the Simulator?

  • MichaelRumplerMichaelRumpler Michael Rumpler ATMember ✭✭✭✭

    @KrisAdams nothing I'm aware of.

    The GestureSample runs without problems in my iPhone5 iOS 9 simulator. Did you try that?

  • KrisAdamsKrisAdams Kris Adams GBMember ✭✭
    edited October 2015

    Well I don't know if it works.
    When extracting the sample, opening it in Xamarin and trying to run I get this:

    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets: Error: No installed provisioning profiles match the installed iOS code signing keys. (GestureSample.iOS)

  • KrisAdamsKrisAdams Kris Adams GBMember ✭✭

    @MichaelRumpler I still couldn't get your sample to work, but I got my own project to work.

    I think it was a bug somewhere in Xamarin / Simulator. I switched it to iPad, ran it, then switched it back to iPhone and now the events are being caught.

    Super weird.. But nothing wrong from your side. Cheers.

  • MichaelRumplerMichaelRumpler Michael Rumpler ATMember ✭✭✭✭

    I just released MR.Gestures 1.2.4.

    This changed:

    • Reset panning gesture on swipe

    When you handled Swiped and Panning, then the Panning gesture was not properly reset after a swipe. On WinPhone Silverlight this could result in a NullReferenceException. On the other platforms, the PanEventArgs.DeltaDistance had weird values in the first Panning event.

    • [WinRT] fix a bug with elements on TabbedPage / CarouselPage

    If you had elements on different subpages of a TabbedPage or CarouselPage and those elements were at the same screen positions, then the gestures were raised also for elements which were currently not visible.

    • [WinRT] try/catch around calls to Windows.UI.Input.GestureRecognizer

    This is just a precaution for the exception @ANDO reported above. It is not reproducible, but a try/catch does no harm.

    Message: Value does not fall within the expected range.
    Stack trace: at Windows.UI.Input.GestureRecognizer.ProcessDownEvent(PointerPoint value)

    On my TODO list for the next version:

    • Windows 10 (UWP) support
    • hand back the pressure of each touch

    I will go on vacation on Sunday. My wife and I will do a round-trip through Laos for four weeks. I do plan to check on my emails, but I don't know how well the internet connection will be there.

    Don't break anything. :wink:

  • KrisAdamsKrisAdams Kris Adams GBMember ✭✭

    @MichaelRumpler Does your Gestures class work in an IOS app? I want to use it instead of the built in gesture recognizers.

  • KeithRoweKeithRowe Keith Rowe USMember

    When you say you are looking to implement "Windows 10 (UWP) support" does this mean things are not working on Windows 10 now? I have gotten some concerns about people using the swipe in a carousel I built on Surface 3s, and am just curious if this is a Windows 10 issue.

  • KeithRoweKeithRowe Keith Rowe USMember
    edited October 2015

    Never mind - issue was that I changed the name of the app for the client. Is there a way to change the App Name in your registration?

  • NielsCupNielsCup Niels Cup NLMember ✭✭✭

    @MichaelRumpler Hi Michael, I just bought a licence but I have some problems with WP and Android. I also use XLabs in my app and I can't get the IoC to work properly icw MR.Gestures. iOS works fine. Are there any known issues with this?

  • BuildCalcBuildCalc Ben Askren USMember ✭✭✭
    edited October 2015

    @MichaelRumpler -

    Sorry to bother you but I believe I am in need of your help. I am trying to use Mr.Gestures to track the panning gesture of a Xamarin.Forms AbsoluteLayout while a long press gesture is active. On iOS, I can detect a pan gesture while long pressing (very awesome). However, on Android no pan gestures are fired during a long press. Here is the class where all of the action is occurring:

    using System;
    using Xamarin.Forms;
    using System.Collections.Generic;
    using System.Collections;
    using System.ComponentModel;
    
    namespace FormsMod
    {
        public class MyView : MR.Gestures.AbsoluteLayout
        {
            #region Constructor
            public MyView() {
                this.LongPressed += OnLongPressed;
                this.LongPressing += OnLongPressing;
                this.Panning += OnPanning;
            }
            #endregion
    
            #region Gestures
            public void OnLongPressing(object sender, MR.Gestures.LongPressEventArgs e) {
                System.Diagnostics.Debug.WriteLine(GetType() + ".OnLongPressing:"+this.ToString()+" duration:"+e.Duration+" center:"+e.Center+" touches:"+e.NumberOfTouches+" viewPosition:"+e.ViewPosition);
                System.Diagnostics.Debug.WriteLine (" ");
            }
    
            public void OnLongPressed(object sender, MR.Gestures.LongPressEventArgs e) {
                System.Diagnostics.Debug.WriteLine(GetType() + ".OnLongPressed:"+this.ToString()+" duration:"+e.Duration+" center:"+e.Center+" touches:"+e.NumberOfTouches+" viewPosition:"+e.ViewPosition);
                System.Diagnostics.Debug.WriteLine (" ");
            }
    
            public void OnPanning(object sender, MR.Gestures.PanEventArgs e) {
                System.Diagnostics.Debug.WriteLine(GetType() + ".OnPanning:"+this.ToString()+" delta:"+e.DeltaDistance+" total:"+e.TotalDistance+" touches:"+e.Touches+" viewPosition:"+e.ViewPosition);
                System.Diagnostics.Debug.WriteLine (" ");
            }
            #endregion
        }
    }
    

    Do you have any recommendations to help with this? Thank you for your consideration.

  • BuildCalcBuildCalc Ben Askren USMember ✭✭✭

    FYI: Here's a StackOverflow article that talks to how to work around this issue when dealing with it natively:

    http://stackoverflow.com/questions/5651082/move-events-after-longpress

  • LyndonHugheyLyndonHughey Lyndon Hughey USUniversity ✭✭✭

    @MichaelRumpler I just purchased a copy of your controls. They are working perfectly on iOS, but I can't seem to get the resgistration working on Android. I've had to change the name of the android project and have cleaned the solution and rebuilt the project. Yet, it is still displaying a notice that the license code is not appropriate for the app.

    The obvious checks:
    I've ensured the name of the application is copied directly from the iOS application that works.
    The application name is located in the Activity:label attribute in the activity page
    I've also checked the manifest file and it has the same value for the application:label
    The LicenseKey is being set after the Xamarin.forms Init call?

    thanks for your help.

  • MichaelRumplerMichaelRumpler Michael Rumpler ATMember ✭✭✭✭

    I'm back from vacation again. There was not much time for support due to our full schedule on our tour through Laos (I'm not the kind of person who uses a vacation to do nothing). So I just answered some emails, but let the forum rest completely.

    My Mac missed me so much that it decided to go on strike and does not boot anymore. Until I sorted that out, I cannot debug anything. I'll be coming to speed slowly.

    @KrisAdams
    MR.Gestures is a plugin for Xamarin.Forms. You can use it in your iOS app which is written with XF. If your app uses only Xamarin.iOS, then you can't use it.

    @KeithRowe
    I heard from clients that they have problems on Win10. My dev machine is still Win8, so I couldn't try it myself yet.
    Just send me an email with your old and new app name and I'll issue a new license. I might cease to offer that in the future cause so many people do that and my effort already gets too high.

    @NielsCup
    I use MR.Gestures and XLabs with TinyIoC in my own app without any problems. Please make a sample project and end it to me via email.

    @BuildCalc
    I have to look at this in detail when my PC is up.

    @LyndonHughey
    How to configure your app name is described in http://www.mrgestures.com/#HowToConfigureAppName. If it still does not work, then please make a sample project and send it to me.

  • LyndonHugheyLyndonHughey Lyndon Hughey USUniversity ✭✭✭

    @MichaelRumpler
    Thanks for the reply, Michael. I resolved the problem, but I didn't update the thread.

    The project name wasn't being updated properly, even after the VS.net cleaning process. I manually cleaned my bin directory and things started working as expected.

  • MichaelRumplerMichaelRumpler Michael Rumpler ATMember ✭✭✭✭
    edited November 2015

    @BuildCalc Yes, the Android.View.GestureDetector does not support panning after long press.

    I tried the workaround, but then the tap gestures did not work anymore. So I had to write my own detector for the Tapping, Tapped, DoubleTapped, LongPressing and LongPressed events. This has the advantage that these gestures now also work with multiple fingers.

    When you put a finger down and hold it there, you'll get a LongPressing event with NumberOfTouches=1. You can now move your finger and you'll get a LongPressed and some Panning events. If you don't move the finger, but put down another, you'll get another LongPressing event with the NumberOfTouches set accordingly. As soon as one finger moves or lifts, you'll get a LongPressed. There will be no further LongPressed events for every finger lifted.

    Version 1.2.5 has been released with those changes.

    And No, it is no bug, when multi finger gestures don't work on the other platforms / with the other gestures. This has not been implemented yet. Unfortunately the standard platform gesture recognizers cannot handle it. So it is quite some effort. It is on my list, but with low priority.

  • RichardRooksRichardRooks Richard Rooks USMember

    I am using a MR:ListView and need to capture a swipe event while also getting the data from the item swiped. using the itemselected event is not acceptable as i don't want the event raised everytime someone touches an item.

    I need to know which direction was swiped so i can increment or decrease a quantity for the item that was swiped.

    Is there a solution for this situation?

  • MichaelRumplerMichaelRumpler Michael Rumpler ATMember ✭✭✭✭

    @RichardRooks Use the Swiped event on each individual Cell and not on the ListView.

  • BastiBrauningBastiBrauning Basti Brauning USMember

    Is "Tapping" in a ListView broken with the latest Xamarin.Forms 2.0 hotfix?

    I just updated to Xamarin.Forms 2.0.0.6484

    As soon as I start scrolling in my ListView a "Tapping" event is fired on my Labels/Images (whereever I added a TappingCommand). This was not the case on the initial Xamarin.Forms 2.0 release. I'm on MR.Gestures 1.2.5.

  • RichardRooksRichardRooks Richard Rooks USMember

    getting a null reference error as shown in image attached

  • MichaelRumplerMichaelRumpler Michael Rumpler ATMember ✭✭✭✭

    @BastiBrauning Yes, seems like on Android the Tapping events are raised for a Cell and its contents when a ListView is scrolled.

    I guess that's due to the layout updates Xamarin made in that version. But as those updates are only "experimental" and it changed in a build version, I'll wait a bit. Maybe they change it again and fix the bug. If they don't, then I'll search for a workaround after the next release of XF.

  • MichaelRumplerMichaelRumpler Michael Rumpler ATMember ✭✭✭✭

    @RichardRooks You have to give me more information than that.

    When does it occur? On which devices?
    What XF and MR.Gestures versions do you use?
    Do you get the same error in the GestureSample?

  • MichaelRumplerMichaelRumpler Michael Rumpler ATMember ✭✭✭✭

    I just released MR.Gestures 1.3.0-pre1.

    This version adds support for the Universal Windows Platform introduced in Xamarin.Forms 2.0.
    Although Xamarin released XF 2.0 as stable, I won't go as far yet and push it as a prerelease version. I also have some open bug fixes in the queue which I want to include in the final release. But several people already asked for a package for XF 2.0, so I push this out already.

    It works quite good with UWP. There were not many code changes compared to Windows Runtime. So at least it was not a complete new platform as was the case when I upgraded from Silverlight to Runtime.

    I did find two bugs in the GestuerSample on UWP, but they are caused by XF.

  • BastiBrauningBastiBrauning Basti Brauning USMember

    @MichaelRumpler
    The problem on Android where tapping is fired on scroll isn't fixed in 1.3.0-pre1 yet?

    We need the Xamarin.Forms 2.0 hotfix published recently in combination with MR.Gestures. Is there a way to workaround this issue?

  • MichaelRumplerMichaelRumpler Michael Rumpler ATMember ✭✭✭✭

    @BastiBrauning It's not fixed yet. That's what I meant when I wrote:

    I also have some open bug fixes in the queue which I want to include in the final release.

  • LuisAplitoLuisAplito Luis Apólito DOMember ✭✭

    @MichaelRumpler when do you think we will be getting your final release? I have the same bug @BastiBrauning described and its really annoying :tongue:

  • BastiBrauningBastiBrauning Basti Brauning USMember

    @MichaelRumpler any chance for an update? Still seems to be broken on Android with Xamarin 2.0 -pre1. We are unable to publish an Android app update with that bug.

  • MichaelRumplerMichaelRumpler Michael Rumpler ATMember ✭✭✭✭

    @BastiBrauning Yeah, sorry, I had no time to work on MR.Gestures in the last couple of days. But I'm on it now.

  • markadmarkad Mark D GBMember

    Just bought a licence but the key doesn't seem to be correct, unless I'm doing something wrong.

    For testing I set the AppName to "GestureSample" and used the same key from the demo project, this worked fine. Since I bought the licence though, I changed the app name and set the licence corresponding to that app name - I'm now getting a null reference on the following line in iOS.

    MR.Gestures.iOS.Settings.LicenseKey = "56CP-.....-XTPS";

    I guess this is saying that the app name and the key don't match? There is a "." in my app name, I'm not sure if this would screw up the licence key?

    Mark

  • BastiBrauningBastiBrauning Basti Brauning USMember

    Also we try to get UWP support, but currently using MR.Gestures 1.3.0 -pre1 in a ListView (no recycling) seems not to work:

       at MR.Gestures.UWP.UWPGestureHandler..ctor(IGestureAwareControl element, FrameworkElement view, IGestureListener listener)
       at MR.Gestures.UWP.UWPGestureHandler.AddGestureRecognizers(IGestureAwareControl element, FrameworkElement view)
       at MR.Gestures.UWP.UWPGestureHandler.OnElementPropertyChanged(Object sender, PropertyChangedEventArgs e, FrameworkElement view)
       at MR.Gestures.UWP.Renderers.AbsoluteLayoutRenderer.OnElementPropertyChanged(Object sender, PropertyChangedEventArgs e)
       at System.ComponentModel.PropertyChangedEventHandler.Invoke(Object sender, PropertyChangedEventArgs e)
       at Xamarin.Forms.BindableObject.OnPropertyChanged(String propertyName)
       at Xamarin.Forms.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, Boolean silent)
       at Xamarin.Forms.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes)
       at Xamarin.Forms.BindingExpression.ApplyCore(Object sourceObject, BindableObject target, BindableProperty property, Boolean fromTarget)
       at Xamarin.Forms.BindingExpression.Apply(Object sourceObject, BindableObject target, BindableProperty property)
       at Xamarin.Forms.Binding.Apply(Object newContext, BindableObject bindObj, BindableProperty targetProperty)
       at Xamarin.Forms.BindableObject.ApplyBindings(Object oldContext, Boolean skipBindingContext)
       at Xamarin.Forms.BindableObject.SetInheritedBindingContext(BindableObject bindable, Object value)
       at Xamarin.Forms.Element.OnBindingContextChanged()
       at Xamarin.Forms.View.OnBindingContextChanged()
       at Xamarin.Forms.BindableObject.SetInheritedBindingContext(BindableObject bindable, Object value)
       at Xamarin.Forms.Element.OnBindingContextChanged()
       at Xamarin.Forms.Cell.OnBindingContextChanged()
       at Xamarin.Forms.BindableObject.BindingContextPropertyBindingPropertyChanged(BindableObject bindable, Object oldvalue, Object newvalue)
       at Xamarin.Forms.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, Boolean silent)
       at Xamarin.Forms.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes)
       at Xamarin.Forms.BindableObject.SetValue(BindableProperty property, Object value, Boolean fromStyle, Boolean checkAccess)
       at Xamarin.Forms.TemplatedItemsList`2.<UnhookItem>d__119.MoveNext()
    
Sign In or Register to comment.