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

This commit is contained in:
Alibek Omarov 2020-10-03 17:44:26 +03:00
parent 82a22082f2
commit 30b2349e2b
2 changed files with 9 additions and 7 deletions

View File

@ -387,13 +387,13 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
Context context = replyInfo.getContext(); Context context = replyInfo.getContext();
String replyToAccount = status.getInReplyToAccountAcct(); String replyToAccount = status.getInReplyToAccountAcct();
replyInfo.setText(context.getString(R.string.status_replied_to_format, replyToAccount)); 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); replyInfo.setPaintFlags(replyInfo.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
else replyInfo.setOnClickListener(null);
} else {
replyInfo.setPaintFlags(replyInfo.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG)); 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); replyInfo.setVisibility(View.VISIBLE);
} else { } else {
replyInfo.setVisibility(View.GONE); replyInfo.setVisibility(View.GONE);

View File

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