From 38352c17603804cce208f43eb4a7555cc4f38d20 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 10 Feb 2019 21:50:47 +0000 Subject: [PATCH] Save recyclerview state --- .../main/java/eu/faircode/email/FragmentMessages.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index e495013a24..c0ae02f30d 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -1437,6 +1437,11 @@ public class FragmentMessages extends FragmentBase { for (String name : values.keySet()) outState.putLongArray(name, Helper.toLongArray(values.get(name))); + if (rvMessage != null) { + Parcelable rv = rvMessage.getLayoutManager().onSaveInstanceState(); + outState.putParcelable("rv", rv); + } + if (selectionTracker != null) selectionTracker.onSaveInstanceState(outState); } @@ -1456,6 +1461,11 @@ public class FragmentMessages extends FragmentBase { values.get(name).add(value); } + if (rvMessage != null) { + Parcelable rv = savedInstanceState.getBundle("rv"); + rvMessage.getLayoutManager().onRestoreInstanceState(rv); + } + if (selectionTracker != null) selectionTracker.onRestoreInstanceState(savedInstanceState); }