openaphid / android-flip

A component for flip animation on Android, which is similar to the effect in Flipboard iPhone/Android
http://openaphid.github.com/
2.84k stars 1.25k forks source link

After fling support --- Issue in flipping #20

Closed naththeprince closed 11 years ago

naththeprince commented 11 years ago
  1. Fling works just fine.
  2. But i see an issue very often, when we move the page above 90 angle it has to flip down, but its flipping back. Steps to reproduce just flip the cards slowly above 90 i.e., greater than width/2, Earlier it's working fine but now its flipping back, which i strongly feel a bug Please check the images below.
  3. png when i move the cards above 90. when i leave the finger in this posiiton it has to flip up right.. but
  4. u can see the 2.png it just flipped back..

1 2

openaphid commented 11 years ago

Yes. It's a bug. Thanks for reporting it.

naththeprince commented 11 years ago

Ok. Thanks for responding quickly. Actually i was trying from past 3 days to add fling support with the old library before fling added, but i too faced the same issues when i try to change things there. When i came to know fling support is added to the library, i thought to look in to it, tested to see if it solved issues i faced.

Anyhow, is there any documentation on the library procedures/methods.

openaphid commented 11 years ago

I finished a small patch to work around the issue.

I'm actually not fully satisfied with the fix. I re-observed the behavior of FlipBoard, and I believe a velocity tracker is used to detect fling gesture.

iPaulPro commented 11 years ago

Flipboard definitely doesn't use velocity tracking. You easily see this by slowly scrolling. The problem here is related to the fact that when scrolling very slowly, its possible that the last actual touch movement was opposite of what you expect. Meaning, when you are scrolling up, and when your finger comes to a stop, it may actually slightly move down before lifting.

The best way to fix this is to check for unintended movement. The key is the line that I added:

forward = delta > 0

Now that I'm thinking about it, this should really be forward = delta >= 0 which may solve some of this issue. However, it would be best to check to see if the opposite movement was greater than the "touch slop". It appears that this is the way Flipboard avoids this issue.

iPaulPro commented 11 years ago

Looks like that's what you did in https://github.com/openaphid/android-flip/commit/138494b25a0e4bd9943aa00c724c81040d566a21. Sorry, didn't notice that before commenting. :-)

openaphid commented 11 years ago

Thanks for your detailed explanation.

From my observation, fling behavior of Flipboard are different on IOS and android. There is no velocity detection on iOS but its android version may utilize one.

For example, I can slowly scroll a page up in Fipboard android; it goes back as long as the scrolling angle is less than 90 degree.

iPaulPro commented 11 years ago

For example, I can slowly scroll a page up in Fipboard android; it goes back as long as the scrolling angle is less than 90 degree.

Do you have the latest version of Flipboard on Android? This is not the case (I'm not sure that it ever was, to be honest).

I will try to make a video to prove it, when I get a chance, but I can easily get it to flip up by scrolling very slowly and not passing 90 degrees.

naththeprince commented 11 years ago

@iPaulPro I don't think so. Even i have the latest flipboard version on my htc one v. I see when u really scroll slowly without taking out your finger, it doesn't flip up until it cross 90, i.e, width/2. At the same time when u fast swipe a little amount too, it flips up/down.

iPaulPro commented 11 years ago

Interesting. I just tried on the Nexus One, and the behavior is different than on the Galaxy Nexus. On the N1, it behaves the way you describe. Hm...

Edit: Referring to this library, not Flipboard.

iPaulPro commented 11 years ago

Okay, so I just installed Flipboard on the N1 and it also works the way this library does (at master). The behavior of Flipboars's flip changes between platforms. Considering that the current library works the same as Flipboard on 4.2 and 2.3, respectively, it may actually already be correct.

I'm going to test Flibboard and FlipView on a bunch of devices and report back soon.

openaphid commented 11 years ago

I'm using 1.9.10, 221

Flipview will go with your solution as using velocity tracker adds code complexity without significant UX improvement.

naththeprince commented 11 years ago

Thanks for the fix.