Created
February 28, 2015 08:26
-
-
Save mzgreen/29359ccda3b5e1c68093 to your computer and use it in GitHub Desktop.
PartTwoActivity class onShow and onHide implementation
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
private void initRecyclerView() { | |
final RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerView); | |
recyclerView.setLayoutManager(new LinearLayoutManager(this)); | |
RecyclerAdapter recyclerAdapter = new RecyclerAdapter(createItemList()); | |
recyclerView.setAdapter(recyclerAdapter); | |
recyclerView.setOnScrollListener(new HidingScrollListener(this) { | |
@Override | |
public void onMoved(int distance) { | |
mToolbarContainer.setTranslationY(-distance); | |
} | |
@Override | |
public void onShow() { | |
mToolbarContainer.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)).start(); | |
} | |
@Override | |
public void onHide() { | |
mToolbarContainer.animate().translationY(-mToolbarHeight).setInterpolator(new AccelerateInterpolator(2)).start(); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment