Attempt to keep scroll position on rotating

This commit is contained in:
M66B
2020-09-04 16:56:00 +02:00
parent 2c88095ea3
commit 4394843878
2 changed files with 17 additions and 0 deletions

View File

@@ -264,6 +264,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private static boolean debug;
private boolean gotoTop = false;
private Integer gotoPos = null;
private boolean firstClick = false;
private int searchResult = 0;
private AsyncPagedListDiffer<TupleMessageEx> differ;
@@ -5441,6 +5442,11 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
}
}
if (gotoPos != null && currentList != null && currentList.size() > 0) {
properties.scrollTo(gotoPos, 0);
gotoPos = null;
}
if (selectionTracker != null && selectionTracker.hasSelection()) {
Selection<Long> selection = selectionTracker.getSelection();
@@ -5530,6 +5536,11 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
this.gotoTop = true;
}
void gotoPos(int pos) {
if (pos != RecyclerView.NO_POSITION)
gotoPos = pos;
}
void submitList(PagedList<TupleMessageEx> list) {
for (int i = 0; i < list.size(); i++) {
TupleMessageEx message = list.get(i);