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

main
Vavassor 7 years ago
parent 48c03125f5
commit 0c8381e50d
  1. 3
      app/src/main/java/com/keylesspalace/tusky/adapter/StatusViewHolder.java
  2. 2
      app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java
  3. 1
      app/src/main/java/com/keylesspalace/tusky/fragment/TimelineFragment.java
  4. 1
      app/src/main/java/com/keylesspalace/tusky/fragment/ViewThreadFragment.java
  5. 12
      app/src/main/java/com/keylesspalace/tusky/viewdata/StatusViewData.java

@ -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:

@ -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;

@ -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;

@ -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);

@ -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);

Loading…
Cancel
Save