Moondroid Coverflow: Slow down scroll speed

513 Views Asked by At

I'm using Moondroid Coverflow in my project, but the scrolling speed is way too high. I swipe a little and the carousel turns way too much.

Is there any solution to this or do I have to switch to another coverflow?

Single Page Pagination would be fine too.

1

There are 1 best solutions below

0
Parag Pawar On

After searching for hours finally found a workaround/solution! It's pretty simple, I know probably nobody's going to use this library again, but you never know you may need it sometime!

So, basically, Moondroid CoverFlow itself forked from another repository of applm's ma-components.

Step 1: So what you need to do is import that repository (applm's ma-components) into your project as a library. So that you can directly make changes in the code for CoverFlow!

Step 2: After importing the library open EndlessLoopAdapterContainer from com.martinappl.components.ui.containers!

Step 3: Find the fling method inside that Adapter, it should be something like this:

public void fling(int velocityX, int velocityY){
    mTouchState = TOUCH_STATE_FLING;
    final int x = getScrollX();
    final int y = getScrollY();
    mScroller.fling(x, y, velocityX, velocityY, Integer.MIN_VALUE,Integer.MAX_VALUE, Integer.MIN_VALUE,Integer.MAX_VALUE);

    invalidate();
}

Now just add the following line before calling mScroller.fling():

velocityX *= 0.1; //change the float value as per your need, a lesser value will slow down the scroll speed

And that's it, you've successfully slowed down the scroll speed of the CoverFlow!