ViewThreadFragment: scroll to post we are requested to show

This commit is contained in:
Alibek Omarov 2019-12-14 01:41:50 +03:00
parent fc108e54d3
commit f19e5ce0f6
1 changed files with 8 additions and 0 deletions

View File

@ -197,6 +197,10 @@ public final class ViewThreadFragment extends SFragment implements
handleStatusDeletedEvent((StatusDeletedEvent) event);
}
});
if(thisThreadsStatusPosition != -1) {
recyclerView.scrollToPosition(thisThreadsStatusPosition);
}
}
public void onRevealPressed() {
@ -680,9 +684,13 @@ public final class ViewThreadFragment extends SFragment implements
}
}
private int thisThreadsStatusPosition = -1;
private void insertStatus(Status status, int at) {
statuses.add(at, status);
adapter.addItem(at, statuses.getPairedItem(at));
if(status.getId().equals(thisThreadsStatusId)) {
thisThreadsStatusPosition = at;
}
}
private void handleStatusDeletedEvent(StatusDeletedEvent event) {