Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
AppBarExpander appBarExpander;
...
final RecyclerView view = (RecyclerView) layoutInflater.inflate(R.layout.view_season_page, container, false);
view.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
view.setLayoutManager(new LinearLayoutManager(container.getContext()) {
@Override
public int scrollVerticallyBy(int dy, RecyclerView.Recycler recycler, RecyclerView.State state) {
if (!view.isInTouchMode()) {
onScrollWhenInNonTouchMode(dy);
}
return super.scrollVerticallyBy(dy, recycler, state);
}
private void onScrollWhenInNonTouchMode(int dy) {
if (dy > 0) {
appBarExpander.collapseAppBar();
} else {
appBarExpander.expandAppBar();
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.