aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorcmp <me@porterca.com>2022-10-15 11:06:38 +0000
committerGitHub <noreply@github.com>2022-10-15 11:06:38 +0000
commit9b8cd3816faf54781537c6c4ea472aec957d15ae (patch)
treeaff0910580f11ff180c772b0e48fa4db837eb13a /app
parent540ba6e74ef83925817b80c7e4dfd60ff0ad6e92 (diff)
downloadinfinity-for-reddit-9b8cd3816faf54781537c6c4ea472aec957d15ae.tar
infinity-for-reddit-9b8cd3816faf54781537c6c4ea472aec957d15ae.tar.gz
infinity-for-reddit-9b8cd3816faf54781537c6c4ea472aec957d15ae.tar.bz2
infinity-for-reddit-9b8cd3816faf54781537c6c4ea472aec957d15ae.tar.lz
infinity-for-reddit-9b8cd3816faf54781537c6c4ea472aec957d15ae.tar.xz
infinity-for-reddit-9b8cd3816faf54781537c6c4ea472aec957d15ae.tar.zst
infinity-for-reddit-9b8cd3816faf54781537c6c4ea472aec957d15ae.zip
Delineate comments with hidden scores (#1147)
* Delineate comments with hidden scores. * Same change for fully collapsed comments.
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java34
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java73
2 files changed, 70 insertions, 37 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java
index 0259361f..1782a0a4 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java
@@ -223,8 +223,14 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
((CommentViewHolder) holder).markwonAdapter.setMarkdown(mMarkwon, comment.getCommentMarkdown());
((CommentViewHolder) holder).markwonAdapter.notifyDataSetChanged();
- ((CommentViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
- comment.getScore() + comment.getVoteType()));
+ String commentText = "";
+ if (comment.isScoreHidden()) {
+ commentText = mActivity.getString(R.string.hidden);
+ } else {
+ commentText = Utils.getNVotes(mShowAbsoluteNumberOfVotes,
+ comment.getScore() + comment.getVoteType());
+ }
+ ((CommentViewHolder) holder).scoreTextView.setText(commentText);
switch (comment.getVoteType()) {
case Comment.VOTE_TYPE_UPVOTE:
@@ -565,8 +571,10 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
scoreTextView.setTextColor(mCommentIconAndInfoColor);
}
- scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
- comment.getScore() + comment.getVoteType()));
+ if (!comment.isScoreHidden()) {
+ scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
+ comment.getScore() + comment.getVoteType()));
+ }
VoteThing.voteThing(mActivity, mOauthRetrofit, mAccessToken, new VoteThing.VoteThingListener() {
@Override
@@ -588,8 +596,10 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
if (currentPosition == position) {
downvoteButton.setColorFilter(mCommentIconAndInfoColor, PorterDuff.Mode.SRC_IN);
- scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
- comment.getScore() + comment.getVoteType()));
+ if (!comment.isScoreHidden()) {
+ scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
+ comment.getScore() + comment.getVoteType()));
+ }
}
}
@@ -631,8 +641,10 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
scoreTextView.setTextColor(mCommentIconAndInfoColor);
}
- scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
- comment.getScore() + comment.getVoteType()));
+ if (!comment.isScoreHidden()) {
+ scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
+ comment.getScore() + comment.getVoteType()));
+ }
VoteThing.voteThing(mActivity, mOauthRetrofit, mAccessToken, new VoteThing.VoteThingListener() {
@Override
@@ -654,8 +666,10 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
if (currentPosition == position) {
upvoteButton.setColorFilter(mCommentIconAndInfoColor, PorterDuff.Mode.SRC_IN);
- scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
- comment.getScore() + comment.getVoteType()));
+ if (!comment.isScoreHidden()) {
+ scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
+ comment.getScore() + comment.getVoteType()));
+ }
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java
index bac83b14..aee4be21 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java
@@ -439,11 +439,20 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
((CommentViewHolder) holder).mMarkwonAdapter.setMarkdown(mCommentMarkwon, comment.getCommentMarkdown());
((CommentViewHolder) holder).mMarkwonAdapter.notifyDataSetChanged();
- ((CommentViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
- comment.getScore() + comment.getVoteType()));
- ((CommentViewHolder) holder).topScoreTextView.setText(mActivity.getString(R.string.top_score,
- Utils.getNVotes(mShowAbsoluteNumberOfVotes,
- comment.getScore() + comment.getVoteType())));
+
+ String commentText = "";
+ String topScoreText = "";
+ if (comment.isScoreHidden()) {
+ commentText = mActivity.getString(R.string.hidden);
+ } else {
+ commentText = Utils.getNVotes(mShowAbsoluteNumberOfVotes,
+ comment.getScore() + comment.getVoteType());
+ topScoreText = mActivity.getString(R.string.top_score,
+ Utils.getNVotes(mShowAbsoluteNumberOfVotes,
+ comment.getScore() + comment.getVoteType()));
+ }
+ ((CommentViewHolder) holder).scoreTextView.setText(commentText);
+ ((CommentViewHolder) holder).topScoreTextView.setText(topScoreText);
((CommentViewHolder) holder).commentIndentationView.setShowOnlyOneDivider(mShowOnlyOneCommentLevelIndicator);
((CommentViewHolder) holder).commentIndentationView.setLevelAndColors(comment.getDepth(), verticalBlockColors);
@@ -546,8 +555,10 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
} else {
((CommentFullyCollapsedViewHolder) holder).commentTimeTextView.setText(Utils.getFormattedTime(mLocale, comment.getCommentTimeMillis(), mTimeFormatPattern));
}
- ((CommentFullyCollapsedViewHolder) holder).scoreTextView.setText(mActivity.getString(R.string.top_score,
- Utils.getNVotes(mShowAbsoluteNumberOfVotes, comment.getScore() + comment.getVoteType())));
+ if (!comment.isScoreHidden()) {
+ ((CommentFullyCollapsedViewHolder) holder).scoreTextView.setText(mActivity.getString(R.string.top_score,
+ Utils.getNVotes(mShowAbsoluteNumberOfVotes, comment.getScore() + comment.getVoteType())));
+ }
((CommentFullyCollapsedViewHolder) holder).commentIndentationView.setShowOnlyOneDivider(mShowOnlyOneCommentLevelIndicator);
((CommentFullyCollapsedViewHolder) holder).commentIndentationView.setLevelAndColors(comment.getDepth(), verticalBlockColors);
}
@@ -1355,11 +1366,13 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
topScoreTextView.setTextColor(mSecondaryTextColor);
}
- scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
- comment.getScore() + comment.getVoteType()));
- topScoreTextView.setText(mActivity.getString(R.string.top_score,
- Utils.getNVotes(mShowAbsoluteNumberOfVotes,
- comment.getScore() + comment.getVoteType())));
+ if (!comment.isScoreHidden()) {
+ scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
+ comment.getScore() + comment.getVoteType()));
+ topScoreTextView.setText(mActivity.getString(R.string.top_score,
+ Utils.getNVotes(mShowAbsoluteNumberOfVotes,
+ comment.getScore() + comment.getVoteType())));
+ }
VoteThing.voteThing(mActivity, mOauthRetrofit, mAccessToken, new VoteThing.VoteThingListener() {
@Override
@@ -1383,11 +1396,13 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
if (currentPosition == position) {
downvoteButton.setColorFilter(mCommentIconAndInfoColor, PorterDuff.Mode.SRC_IN);
- scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
- comment.getScore() + comment.getVoteType()));
- topScoreTextView.setText(mActivity.getString(R.string.top_score,
- Utils.getNVotes(mShowAbsoluteNumberOfVotes,
- comment.getScore() + comment.getVoteType())));
+ if (!comment.isScoreHidden()) {
+ scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
+ comment.getScore() + comment.getVoteType()));
+ topScoreTextView.setText(mActivity.getString(R.string.top_score,
+ Utils.getNVotes(mShowAbsoluteNumberOfVotes,
+ comment.getScore() + comment.getVoteType())));
+ }
}
}
@@ -1432,11 +1447,13 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
topScoreTextView.setTextColor(mSecondaryTextColor);
}
- scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
- comment.getScore() + comment.getVoteType()));
- topScoreTextView.setText(mActivity.getString(R.string.top_score,
- Utils.getNVotes(mShowAbsoluteNumberOfVotes,
- comment.getScore() + comment.getVoteType())));
+ if (!comment.isScoreHidden()) {
+ scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
+ comment.getScore() + comment.getVoteType()));
+ topScoreTextView.setText(mActivity.getString(R.string.top_score,
+ Utils.getNVotes(mShowAbsoluteNumberOfVotes,
+ comment.getScore() + comment.getVoteType())));
+ }
int position = getBindingAdapterPosition();
VoteThing.voteThing(mActivity, mOauthRetrofit, mAccessToken, new VoteThing.VoteThingListener() {
@@ -1461,11 +1478,13 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
if (currentPosition == position) {
upvoteButton.setColorFilter(mCommentIconAndInfoColor, PorterDuff.Mode.SRC_IN);
- scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
- comment.getScore() + comment.getVoteType()));
- topScoreTextView.setText(mActivity.getString(R.string.top_score,
- Utils.getNVotes(mShowAbsoluteNumberOfVotes,
- comment.getScore() + comment.getVoteType())));
+ if (!comment.isScoreHidden()) {
+ scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
+ comment.getScore() + comment.getVoteType()));
+ topScoreTextView.setText(mActivity.getString(R.string.top_score,
+ Utils.getNVotes(mShowAbsoluteNumberOfVotes,
+ comment.getScore() + comment.getVoteType())));
+ }
}
}