Skip to content

Instantly share code, notes, and snippets.

@bouhady
Last active July 19, 2017 09:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bouhady/51b946f33744f005f28d59d9d020d28a to your computer and use it in GitHub Desktop.
Save bouhady/51b946f33744f005f28d59d9d020d28a to your computer and use it in GitHub Desktop.
This action should be called before and after each RecycleView update (NotifyDataChanged/Remove..)
private Action1<Boolean> rxRecycleSync = new Action1<Boolean>() {
Parcelable parcelable = null;
@Override
public void call(Boolean saveState) {
if (saveState)
parcelable = recyclerView.getLayoutManager().onSaveInstanceState();
else
recyclerView.getLayoutManager().onRestoreInstanceState(parcelable);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment