Context: I tried to implement a flingable VelocityViewPager. The flinging motion works properly. I like that the page "snaps" to center after the flinging motion. Despite this, I've had a few issues with it so far. One issue is that the page doesn't snap to center when you drag it passed a certain amount. I've solved this issue using this code so this is just for context. Another issue is below...
Problem: After beginFakeDrag() -> FlingRunnable (flinging motion) -> endFakeDrag(), endFakeDrag()'s internal code "snaps" the page to center. When I try to fling again during the snap motion, it waits until after the animation completes--putting the flinging motion on queue.
How can I cancel the snap motion on touch down so that it doesn't delay the flinging motion?
Attempt 1: On touch down, I tried to beginFakeDrag() but it doesn't cancel the endFakeDrag() snap motion.
Attempt 2: Instead of calling endFakeDrag(), I tried to mimic the snap motion during fake drag so that I can implement the cancellation myself and only call endFakeDrag() when the page is already centered. I tried this via SnapRunnable using Scroller's startScroll().
This might be my best option, but I can't figure out how much distanceX to scroll to in order to center the page. I tried to look into the original ViewPager.class but the algorithms confused me and it seems to depend on more internal code that the VelocityViewPager.class can't access.