Browse Source

StatusBaseViewHolder: semi-fix null shown up for Mastodong, don't allow user to click when parent post is unavailable

pull/98/head
Alibek Omarov 5 months ago
parent
commit
a8c348906a
2 changed files with 9 additions and 7 deletions
  1. +5
    -5
      app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java
  2. +4
    -2
      app/src/main/java/com/keylesspalace/tusky/viewdata/StatusViewData.java

+ 5
- 5
app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java View File

@ -387,13 +387,13 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
Context context = replyInfo.getContext();
String replyToAccount = status.getInReplyToAccountAcct();
replyInfo.setText(context.getString(R.string.status_replied_to_format, replyToAccount));
if (status.getParentVisible() == false)
if (!status.getParentVisible()) {
replyInfo.setPaintFlags(replyInfo.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
else
replyInfo.setOnClickListener(null);
} else {
replyInfo.setPaintFlags(replyInfo.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG));
replyInfo.setOnClickListener(v -> listener.onViewReplyTo(getAdapterPosition()));
replyInfo.setOnClickListener(v -> listener.onViewReplyTo(getAdapterPosition()));
}
replyInfo.setVisibility(View.VISIBLE);
} else {
replyInfo.setVisibility(View.GONE);

+ 4
- 2
app/src/main/java/com/keylesspalace/tusky/viewdata/StatusViewData.java View File

@ -245,9 +245,11 @@ public abstract class StatusViewData {
return inReplyToId;
}
@Nullable
public String getInReplyToAccountAcct() {
return inReplyToAccountAcct;
if(inReplyToAccountAcct != null) {
return inReplyToAccountAcct;
}
return "";
}
public String getSenderId() {

Loading…
Cancel
Save