From 5c28cba57dce42f76c678182b5880afeb26be505 Mon Sep 17 00:00:00 2001 From: Nik Clayton Date: Sat, 29 Apr 2023 16:49:04 +0200 Subject: [PATCH] Show 0/1/1+ for replies, even if show stats is off (#3590) Fixes https://github.com/tuskyapp/Tusky/issues/3588 --- .../tusky/adapter/StatusBaseViewHolder.java | 17 ++++++++++------- 1 file changed, 10 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 dfceb309..6af90953 100644 --- a/app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java +++ b/app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java @@ -392,11 +392,18 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder { } - protected void setReplyCount(int repliesCount) { + protected void setReplyCount(int repliesCount, boolean fullStats) { // This label only exists in the non-detailed view (to match the web ui) - if (replyCountLabel != null) { + if (replyCountLabel == null) return; + + if (fullStats) { replyCountLabel.setText(NumberUtils.shortNumber(repliesCount)); + return; } + + // Show "0", "1", or "1+" for replies otherwise, so the user knows if there is a thread + // that they can click through to read. + replyCountLabel.setText((repliesCount > 1 ? replyCountLabel.getContext().getString(R.string.status_count_one_plus) : Integer.toString(repliesCount))); } private void setReblogged(boolean reblogged) { @@ -630,10 +637,6 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder { avatar.setOnClickListener(profileButtonClickListener); displayName.setOnClickListener(profileButtonClickListener); - if (replyCountLabel != null) { - replyCountLabel.setVisibility(statusDisplayOptions.showStatsInline() ? View.VISIBLE : View.INVISIBLE); - } - replyButton.setOnClickListener(v -> { int position = getBindingAdapterPosition(); if (position != RecyclerView.NO_POSITION) { @@ -762,7 +765,7 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder { setUsername(status.getUsername()); setMetaData(status, statusDisplayOptions, listener); setIsReply(actionable.getInReplyToId() != null); - setReplyCount(actionable.getRepliesCount()); + setReplyCount(actionable.getRepliesCount(), statusDisplayOptions.showStatsInline()); setAvatar(actionable.getAccount().getAvatar(), status.getRebloggedAvatar(), actionable.getAccount().getBot(), statusDisplayOptions); setReblogged(actionable.getReblogged());