Skip to content

Instantly share code, notes, and snippets.

@bouhady
Last active July 19, 2017 09:44
Show Gist options
  • 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