Code Monkey home page Code Monkey logo

Comments (10)

openaphid avatar openaphid commented on June 14, 2024

I'm afraid that I can't reproduce the issue. Maybe I miss the point.

During my test, the page didn't fall over automatically as long as my finger didn't leave the screen.

from android-flip.

quintos avatar quintos commented on June 14, 2024

No, what i meant is, the ability to "fling" it. (Flinging being that a animation continues at a degrading speed (or the same) after the finger is released. or something like that..)

This is the experience in the Flipboard implementation:
I fling it up or down but release it before it reaches the middle. And because of the speed/momentum it crosses the middle and falls over without my finger attached. (This is how it's perceived)

What i'm experiencing with your implementation is, if i release my finger before the page reaches the middle, it will always fall back. I need to keep my finger attached until it over the middle. In other words i need to take it over the middle with my finger and i can not fling it over the middle.

I don;t know if you have Flipboard available to have a look but you'll notice that you can give pages a very small push and that will still trigger the page to flip over by itself.

Is this not how you experience it?

from android-flip.

openaphid avatar openaphid commented on June 14, 2024

Now I got it.

A velocity tracker is required to detect it. We'll add the support later with the event listener too.

Thanks

from android-flip.

quintos avatar quintos commented on June 14, 2024

cool

from android-flip.

iPaulPro avatar iPaulPro commented on June 14, 2024

@openaphid The Flipboard component actually "snaps" to the direction that the finger last moved. Velocity does not matter, and doesn't need to be tracked.

E.g. If the last touch movement was negative (bottom to top), always flip to the next page, regardless of how the gesture started, or how fast the finger was moving.

I'd love to see this added, as it allows the user to "fling" through pages in an intuitive way. I am looking into the source now, to attempt to implement it myself. It appears that the key is to alter FlipCards.rotateBy() and line forward = angle >= 90; in FlipCards.handleTouchEvent(). Any help is greatly appreciated (as it will take me time to familiarize myself).

Awesome work!

from android-flip.

iPaulPro avatar iPaulPro commented on June 14, 2024

So making the change I describe above is very simple. In FlipCards.handleTouchEvent():

In MotionEvent.ACTION_UP

remove forward = angle >= 90;

then in MotionEvent.ACTION_MOVE

add forward = delta > 0;

The only issue this causes is that the first page is no longer bound to the MAX_TIP_ANGLE. I will make a pull request if I get that fixed.

from android-flip.

iPaulPro avatar iPaulPro commented on June 14, 2024

So the only other change I had to make to support the MAX_TIP_ANGLE boundary was to add

if (frontCards.getIndex() == -1)
    forward = true;
else if (backCards.getIndex() == -1) 
    forward = false;

where forward = angle >= 90; used to be (in MotionEvent.ACTION_UP).

@openaphid Let me know if there is an issue with this implementation. I have submitted a pull request: #10.

from android-flip.

VAdaihiep avatar VAdaihiep commented on June 14, 2024

@iPaulPro Thanks in advance, I just use your code to fling and it works perfectly. But I seen slightly slower while backward page, sometimes it does NOT perform flip animation. Please tell me how to make it smoother like forward page?
Hope to hear from you soon. Thank you!

from android-flip.

openaphid avatar openaphid commented on June 14, 2024

@iPaulPro Thanks for your contribution.

@VAdaihiep A new issue is created to address the problem you have.

from android-flip.

openaphid avatar openaphid commented on June 14, 2024

@VAdaihiep Please try the updated APK to see if it fixes the issue: https://github.com/openaphid/android-flip/blob/develop/FlipView/Demo/APK/Aphid-FlipView-Demo.apk

And you could follow it up in issue #17

from android-flip.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.