Show 0/1/1+ for replies, even if show stats is off (#3590)

Fixes https://github.com/tuskyapp/Tusky/issues/3588
This commit is contained in:
Nik Clayton 2023-04-29 16:49:04 +02:00 committed by GitHub
parent a5578cf765
commit 5c28cba57d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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