From 30b2349e2b90653f8aae4f96302104d63c08d768 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sat, 3 Oct 2020 17:44:26 +0300 Subject: [PATCH] StatusBaseViewHolder: semi-fix null shown up for Mastodong, don't allow user to click when parent post is unavailable --- .../tusky/adapter/StatusBaseViewHolder.java | 10 +++++----- .../keylesspalace/tusky/viewdata/StatusViewData.java | 6 ++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java b/app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java index c23265a3..ba12d9eb 100644 --- a/app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java +++ b/app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java @@ -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); diff --git a/app/src/main/java/com/keylesspalace/tusky/viewdata/StatusViewData.java b/app/src/main/java/com/keylesspalace/tusky/viewdata/StatusViewData.java index 0f2f5c82..af608151 100644 --- a/app/src/main/java/com/keylesspalace/tusky/viewdata/StatusViewData.java +++ b/app/src/main/java/com/keylesspalace/tusky/viewdata/StatusViewData.java @@ -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() {