Created
July 13, 2015 10:08
-
-
Save mzgreen/e8fe9a00dd9e8b93b6cc to your computer and use it in GitHub Desktop.
ScrollingSwipeRefreshLayoutBehavior
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
public class ScrollingSwipeRefreshLayoutBehavior extends AppBarLayout.ScrollingViewBehavior { | |
@Override | |
public boolean layoutDependsOn(CoordinatorLayout parent, View child, View dependency) { | |
return super.layoutDependsOn(parent, child, dependency) || (dependency instanceof AppBarLayout); | |
} | |
@Override | |
public boolean onDependentViewChanged(CoordinatorLayout parent, View child, View dependency) { | |
boolean returnValue = super.onDependentViewChanged(parent, child, dependency); | |
if (dependency instanceof AppBarLayout) { | |
child.setEnabled(dependency.getY()==0); | |
} | |
return returnValue; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment