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 @DrawableRes
int getLabelIcon(Status.MediaAttachment.Type type) { private static int getLabelIcon(Status.MediaAttachment.Type type) {
switch (type) { switch (type) {
default: default:
case IMAGE: case IMAGE:

View file

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

View file

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

View file

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

View file

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