Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android 4.4 seems to break swiping. #101

Closed
mark-bradshaw opened this issue Dec 17, 2013 · 7 comments

Comments

@mark-bradshaw
Copy link
Contributor

@mark-bradshaw mark-bradshaw commented Dec 17, 2013

I updated my test device, a Nexus 4, to Android 4.4 and suddenly my Quo based swiping events in two Cordova based apps are no longer working. But this doesn't appear to be a cordova issue.

I have duplicated the basic setup on a CodePen for your review at http://cdpn.io/ncDfv. In my mac chrome browser I get the normal swipe events. On IOS devices I get the normal swipe events. I don't have an older android device to test on, but the swipe events all used to work fine. But on Android 4.4, no.

I did some digging inside Quo and when I start swiping I get a touchstart event, and then a touchmove event. Sometimes if I'm lucky I get a second touchmove. And then nothing. I don't get a touchend.

If you look at the codepen it's a VERY simple setup. I don't think I've screwed anything up. I'm pulling quo 2.3.1 on the codepen (http://cdpn.io/ncDfv), but in my local testing I've also pulled latest from git. I have tried the 3.0 branch.

@mark-bradshaw

This comment has been minimized.

Copy link
Contributor Author

@mark-bradshaw mark-bradshaw commented Dec 17, 2013

BTW, I've noticed similar open issues on other swipe capable javascript libraries...

For instance, I also tried Zepto to see if it was broken. It was. Here's someone else reporting a similar issue on Zepto (madrobby/zepto#823). I'll be reporting there as well.

@nonameolsson

This comment has been minimized.

Copy link

@nonameolsson nonameolsson commented Dec 28, 2013

I finally started developing my web app I've been planning on for a long time. And I decided to go with LungoJS and QuoJS. But I can't get the swiping to work.
I have a Nexus 4, Nexus 5, Nexus 7(2012) and Nexus 7(2013), all running Android 4.4. The tapping works on all of them, but it's impossible to get the swiping to work.

I really hope this is able to fix, because now I don't know what to do. I don't have enough skills to be digging in the QuoJS-code, and I can't contribute to this project either.

Really hope that someone will find the problem and be able to fix it!

@mark-bradshaw

This comment has been minimized.

Copy link
Contributor Author

@mark-bradshaw mark-bradshaw commented Jan 2, 2014

@mark-bradshaw

This comment has been minimized.

Copy link
Contributor Author

@mark-bradshaw mark-bradshaw commented Jan 6, 2014

Based on that info, for my android device I "fixed" the problem with two things. First I patched the _onTouchMove function. About mid-way down is this:

if (is_swipe) {
            GESTURE.prevSwipe = true;
          }

I changed that to:

if (is_swipe) {
            GESTURE.prevSwipe = true;
            event.preventDefault();
          }

But on my Nexus 4 is_swipe was never getting set to true. The horizontal swipe distance was a bit too high under the current webview. I went down to the next function, _isSwipe, and changed the horizontal swipe distance check from 30 down to 10. 15 seemed to be right on the edge of too high, but 10 seemed fine. Once quo detected a swipe the preventdefault kicked in ans we were happy again.

I can't speak for all the other gestures still being good. I'm afraid I don't have time to thoroughly test for you and track down the problem, but this is what works for me.

@cmisura

This comment has been minimized.

Copy link

@cmisura cmisura commented May 8, 2014

I'm using the latest version and swipe is still broken on Android 4.4

@TNT-RoX

This comment has been minimized.

Copy link
Contributor

@TNT-RoX TNT-RoX commented May 14, 2014

Fixed for different pixel densities and kitkat cancel/end confusion: quo.gestures.swipe.js
change


GAP = 20;
// to
GAP = window.devicePixelRatio >= 2 ? 15 : 20;
// and change
end = function(target, data) {
if (_last) {
_check(false);
return _last = null;
}
};

// to
cancel = end = function(target, data) {
if (_last) {
_check(false);
return _last = null;
}
};

http://developer.android.com/guide/webapps/migrating.html#TouchCancel

@soyjavi

This comment has been minimized.

Copy link
Owner

@soyjavi soyjavi commented Jul 10, 2014

FIXED :)

@soyjavi soyjavi closed this Jul 10, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.