Save recyclerview state

pull/147/head
M66B 6 years ago
parent d08c9b34bb
commit 38352c1760

@ -1437,6 +1437,11 @@ public class FragmentMessages extends FragmentBase {
for (String name : values.keySet()) for (String name : values.keySet())
outState.putLongArray(name, Helper.toLongArray(values.get(name))); outState.putLongArray(name, Helper.toLongArray(values.get(name)));
if (rvMessage != null) {
Parcelable rv = rvMessage.getLayoutManager().onSaveInstanceState();
outState.putParcelable("rv", rv);
}
if (selectionTracker != null) if (selectionTracker != null)
selectionTracker.onSaveInstanceState(outState); selectionTracker.onSaveInstanceState(outState);
} }
@ -1456,6 +1461,11 @@ public class FragmentMessages extends FragmentBase {
values.get(name).add(value); values.get(name).add(value);
} }
if (rvMessage != null) {
Parcelable rv = savedInstanceState.getBundle("rv");
rvMessage.getLayoutManager().onRestoreInstanceState(rv);
}
if (selectionTracker != null) if (selectionTracker != null)
selectionTracker.onRestoreInstanceState(savedInstanceState); selectionTracker.onRestoreInstanceState(savedInstanceState);
} }

Loading…
Cancel
Save