Created
March 8, 2018 22:10
-
-
Save ataulm/7d9fb5ef6f085a205c96b3a58bf1f2b0 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
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