Skip to content

Instantly share code, notes, and snippets.

@ValCanBuild
Created November 23, 2018 13:11
Show Gist options
  • Save ValCanBuild/076b958da95d4e8943836ff9772f4ca3 to your computer and use it in GitHub Desktop.
Save ValCanBuild/076b958da95d4e8943836ff9772f4ca3 to your computer and use it in GitHub Desktop.
AppBarLayout onStopNestedScroll method
@Override
public void onStopNestedScroll(
CoordinatorLayout coordinatorLayout, T abl, View target, int type) {
// onStartNestedScroll for a fling will happen before onStopNestedScroll for the scroll. This
// isn't necessarily guaranteed yet, but it should be in the future. We use this to our
// advantage to check if a fling (ViewCompat.TYPE_NON_TOUCH) will start after the touch scroll
// (ViewCompat.TYPE_TOUCH) ends
if (lastStartedType == ViewCompat.TYPE_TOUCH || type == ViewCompat.TYPE_NON_TOUCH) {
// If we haven't been flung, or a fling is ending
snapToChildIfNeeded(coordinatorLayout, abl);
// ...
}
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment