fix another crash in ViewThreadFragment

This commit is contained in:
Conny Duck 2018-07-08 19:21:19 +02:00
parent 884f889737
commit b7da5f7a29

View file

@ -119,6 +119,8 @@ public final class ViewThreadFragment extends SFragment implements
public void onCreate(@Nullable Bundle savedInstanceState) { public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
thisThreadsStatusId = getArguments().getString("id");
adapter = new ThreadAdapter(this); adapter = new ThreadAdapter(this);
} }
@ -179,7 +181,6 @@ public final class ViewThreadFragment extends SFragment implements
recyclerView.setAdapter(adapter); recyclerView.setAdapter(adapter);
statuses.clear(); statuses.clear();
thisThreadsStatusId = null;
((SimpleItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false); ((SimpleItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
@ -190,7 +191,6 @@ public final class ViewThreadFragment extends SFragment implements
@Override @Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) { public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
thisThreadsStatusId = getArguments().getString("id");
onRefresh(); onRefresh();
} }
@ -598,7 +598,7 @@ public final class ViewThreadFragment extends SFragment implements
Status eventStatus = event.getStatus(); Status eventStatus = event.getStatus();
if (eventStatus.getInReplyToId() == null) return; if (eventStatus.getInReplyToId() == null) return;
if (eventStatus.getInReplyToId().equals(statuses.get(statusIndex).getId())) { if (eventStatus.getInReplyToId().equals(thisThreadsStatusId)) {
insertStatus(eventStatus, statuses.size()); insertStatus(eventStatus, statuses.size());
} else { } else {
// If new status is a reply to some status in the thread, insert new status after it // If new status is a reply to some status in the thread, insert new status after it