Created
August 5, 2017 07:27
-
-
Save TakuSemba/1164e200dd234a2512394a55df22fb2b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
int findTargetSnapPosition(RecyclerView.LayoutManager layoutManager, int velocityX, int velocityY) { | |
boolean forwardDirection = layoutManager.canScrollHorizontally() ? velocityX > 0 : velocityY > 0; | |
return forwardDirection ? previousClosestPosition + 1 : previousClosestPosition - 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment