android-flip icon indicating copy to clipboard operation
android-flip copied to clipboard

back flip at first page up to 90 degrees, when only one page exists

Open aoao02 opened this issue 11 years ago • 0 comments

Thanks for a nice library!

When flipping back at the first page, usually it leans up to 60 degrees. But if there are only one page, it leans up to 90 degrees.

I found it can be fixed by modifying FlipCards.java as follows:

-------------------------- the current version -------------------------------

public synchronized boolean handleTouchEvent(MotionEvent event, boolean isOnTouchEvent) { : : //Bounce the page for the first and the last page if (frontCards.getIndex() == maxIndex - 1) { //the last page if (accumulatedAngle > frontCards.getIndex() * 180 + MAX_TIP_ANGLE) accumulatedAngle = frontCards.getIndex() * 180 + MAX_TIP_ANGLE; } else if (accumulatedAngle < -MAX_TIP_ANGLE) accumulatedAngle = -MAX_TIP_ANGLE;

------------------------- the modified version -------------------------------

public synchronized boolean handleTouchEvent(MotionEvent event, boolean isOnTouchEvent) { : : //Bounce the page for the first and the last page if (frontCards.getIndex() == maxIndex - 1) { //the last page if (accumulatedAngle > frontCards.getIndex() * 180 + MAX_TIP_ANGLE) accumulatedAngle = frontCards.getIndex() * 180 + MAX_TIP_ANGLE; } if (accumulatedAngle < -MAX_TIP_ANGLE) accumulatedAngle = -MAX_TIP_ANGLE;


aoao02 avatar Jul 26 '13 03:07 aoao02