Fixes a crash when a timeline or thread is backgrounded and brought back with an uninitialized notification or status list.

This commit is contained in:
Vavassor 2017-07-20 21:17:36 -04:00
parent ab537ef3cb
commit 3f8378ae3a
5 changed files with 10 additions and 9 deletions

View File

@ -313,9 +313,8 @@ public class StatusViewHolder extends RecyclerView.ViewHolder {
}
}
private static
@DrawableRes
int getLabelIcon(Status.MediaAttachment.Type type) {
private static int getLabelIcon(Status.MediaAttachment.Type type) {
switch (type) {
default:
case IMAGE:

View File

@ -71,7 +71,6 @@ public class NotificationsFragment extends SFragment implements
}
private SwipeRefreshLayout swipeRefreshLayout;
private LinearLayoutManager layoutManager;
private RecyclerView recyclerView;
private EndlessOnScrollListener scrollListener;
@ -134,6 +133,7 @@ public class NotificationsFragment extends SFragment implements
LocalBroadcastManager.getInstance(context.getApplicationContext())
.registerReceiver(timelineReceiver, TimelineReceiver.getFilter(null));
notifications.clear();
topLoading = false;
topFetches = 0;
bottomLoading = false;

View File

@ -159,6 +159,7 @@ public class TimelineFragment extends SFragment implements
LocalBroadcastManager.getInstance(context.getApplicationContext())
.registerReceiver(timelineReceiver, TimelineReceiver.getFilter(kind));
statuses.clear();
topLoading = false;
topFetches = 0;
bottomLoading = false;

View File

@ -106,6 +106,7 @@ public class ViewThreadFragment extends SFragment implements
adapter.setMediaPreviewEnabled(mediaPreviewEnabled);
recyclerView.setAdapter(adapter);
statuses.clear();
thisThreadsStatusId = null;
timelineReceiver = new TimelineReceiver(this, this);

View File

@ -37,7 +37,7 @@ public final class StatusViewData {
private final String senderId;
private final boolean rebloggingEnabled;
public StatusViewData(String id, Spanned contnet, boolean reblogged, boolean favourited,
public StatusViewData(String id, Spanned content, boolean reblogged, boolean favourited,
String spoilerText, Status.Visibility visibility,
Status.MediaAttachment[] attachments, String rebloggedByUsername,
String rebloggedAvatar, boolean sensitive, boolean isExpanded,
@ -45,7 +45,7 @@ public final class StatusViewData {
String avatar, Date createdAt, Status.Mention[] mentions,
String senderId, boolean rebloggingEnabled) {
this.id = id;
this.content = contnet;
this.content = content;
this.reblogged = reblogged;
this.favourited = favourited;
this.spoilerText = spoilerText;
@ -147,7 +147,7 @@ public final class StatusViewData {
public static class Builder {
private String id;
private Spanned contnet;
private Spanned content;
private boolean reblogged;
private boolean favourited;
private String spoilerText;
@ -171,7 +171,7 @@ public final class StatusViewData {
public Builder(final StatusViewData viewData) {
id = viewData.id;
contnet = viewData.content;
content = viewData.content;
reblogged = viewData.reblogged;
favourited = viewData.favourited;
spoilerText = viewData.spoilerText;
@ -197,7 +197,7 @@ public final class StatusViewData {
}
public Builder setContent(Spanned content) {
this.contnet = content;
this.content = content;
return this;
}
@ -287,7 +287,7 @@ public final class StatusViewData {
}
public StatusViewData createStatusViewData() {
return new StatusViewData(id, contnet, reblogged, favourited, spoilerText, visibility,
return new StatusViewData(id, content, reblogged, favourited, spoilerText, visibility,
attachments, rebloggedByUsername, rebloggedAvatar, isSensitive, isExpanded,
isShowingSensitiveContent, userFullName, nickname, avatar, createdAt, mentions,
senderId, rebloggingEnabled);