Created
April 25, 2016 23:11
-
-
Save eddieberklee/0587f8add6523e57775c3fe04b998514 to your computer and use it in GitHub Desktop.
Code for opening/closing based on a threshold of how far the container was dragged
This file contains hidden or 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
boolean shouldClose; | |
float translationY = mEventsSliderContainer.getTranslationY(); | |
if (isOpen) { | |
shouldClose = (translationY > mScrollViewHeight / 2) | |
|| (translationY > OPEN_CLOSE_THRESHOLD); | |
} else { // already closed, when should it remain closed | |
shouldClose = (translationY > mScrollViewHeight / 2) | |
&& (translationY > mScrollViewHeight - OPEN_CLOSE_THRESHOLD); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment