aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java48
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java1
-rw-r--r--app/src/main/res/xml/comment_preferences.xml5
3 files changed, 36 insertions, 18 deletions
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 1dc57835..1271cfc2 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java
@@ -113,6 +113,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
private boolean mHideCommentAwards;
private boolean mShowAuthorAvatar;
private boolean mAlwaysShowChildCommentCount;
+ private boolean mHideTheNumberOfVotes;
private int mDepthThreshold;
private CommentRecyclerViewAdapterCallback mCommentRecyclerViewAdapterCallback;
private boolean isInitiallyLoading;
@@ -226,6 +227,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
mHideCommentAwards = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_COMMENT_AWARDS, false);
mShowAuthorAvatar = sharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_AUTHOR_AVATAR, false);
mAlwaysShowChildCommentCount = sharedPreferences.getBoolean(SharedPreferencesUtils.ALWAYS_SHOW_CHILD_COMMENT_COUNT, false);
+ mHideTheNumberOfVotes = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_VOTES_IN_COMMENTS, false);
mDepthThreshold = sharedPreferences.getInt(SharedPreferencesUtils.SHOW_FEWER_TOOLBAR_OPTIONS_THRESHOLD, 5);
mCommentRecyclerViewAdapterCallback = commentRecyclerViewAdapterCallback;
@@ -425,7 +427,9 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
if (mCommentToolbarHidden) {
((CommentViewHolder) holder).bottomConstraintLayout.getLayoutParams().height = 0;
- ((CommentViewHolder) holder).topScoreTextView.setVisibility(View.VISIBLE);
+ if (!mHideTheNumberOfVotes) {
+ ((CommentViewHolder) holder).topScoreTextView.setVisibility(View.VISIBLE);
+ }
} else {
((CommentViewHolder) holder).bottomConstraintLayout.getLayoutParams().height = LinearLayout.LayoutParams.WRAP_CONTENT;
((CommentViewHolder) holder).topScoreTextView.setVisibility(View.GONE);
@@ -439,19 +443,23 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
((CommentViewHolder) holder).mMarkwonAdapter.setMarkdown(mCommentMarkwon, comment.getCommentMarkdown());
((CommentViewHolder) holder).mMarkwonAdapter.notifyDataSetChanged();
- String commentText = "";
- String topScoreText = "";
- if (comment.isScoreHidden()) {
- commentText = mActivity.getString(R.string.hidden);
+ if (!mHideTheNumberOfVotes) {
+ 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);
} 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(mActivity.getString(R.string.vote));
}
- ((CommentViewHolder) holder).scoreTextView.setText(commentText);
- ((CommentViewHolder) holder).topScoreTextView.setText(topScoreText);
((CommentViewHolder) holder).commentIndentationView.setShowOnlyOneDivider(mShowOnlyOneCommentLevelIndicator);
((CommentViewHolder) holder).commentIndentationView.setLevelAndColors(comment.getDepth(), verticalBlockColors);
@@ -558,9 +566,11 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
} else {
((CommentFullyCollapsedViewHolder) holder).commentTimeTextView.setText(Utils.getFormattedTime(mLocale, comment.getCommentTimeMillis(), mTimeFormatPattern));
}
- if (!comment.isScoreHidden()) {
+ if (!comment.isScoreHidden() && !mHideTheNumberOfVotes) {
((CommentFullyCollapsedViewHolder) holder).scoreTextView.setText(mActivity.getString(R.string.top_score,
Utils.getNVotes(mShowAbsoluteNumberOfVotes, comment.getScore() + comment.getVoteType())));
+ } else if (mHideTheNumberOfVotes) {
+ ((CommentFullyCollapsedViewHolder) holder).scoreTextView.setText(mActivity.getString(R.string.vote));
}
((CommentFullyCollapsedViewHolder) holder).commentIndentationView.setShowOnlyOneDivider(mShowOnlyOneCommentLevelIndicator);
((CommentFullyCollapsedViewHolder) holder).commentIndentationView.setLevelAndColors(comment.getDepth(), verticalBlockColors);
@@ -1379,7 +1389,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
topScoreTextView.setTextColor(mSecondaryTextColor);
}
- if (!comment.isScoreHidden()) {
+ if (!comment.isScoreHidden() && !mHideTheNumberOfVotes) {
scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
comment.getScore() + comment.getVoteType()));
topScoreTextView.setText(mActivity.getString(R.string.top_score,
@@ -1409,7 +1419,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
if (currentPosition == position) {
downvoteButton.setColorFilter(mCommentIconAndInfoColor, PorterDuff.Mode.SRC_IN);
- if (!comment.isScoreHidden()) {
+ if (!comment.isScoreHidden() && !mHideTheNumberOfVotes) {
scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
comment.getScore() + comment.getVoteType()));
topScoreTextView.setText(mActivity.getString(R.string.top_score,
@@ -1460,7 +1470,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
topScoreTextView.setTextColor(mSecondaryTextColor);
}
- if (!comment.isScoreHidden()) {
+ if (!comment.isScoreHidden() && !mHideTheNumberOfVotes) {
scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
comment.getScore() + comment.getVoteType()));
topScoreTextView.setText(mActivity.getString(R.string.top_score,
@@ -1491,7 +1501,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
if (currentPosition == position) {
upvoteButton.setColorFilter(mCommentIconAndInfoColor, PorterDuff.Mode.SRC_IN);
- if (!comment.isScoreHidden()) {
+ if (!comment.isScoreHidden() && !mHideTheNumberOfVotes) {
scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
comment.getScore() + comment.getVoteType()));
topScoreTextView.setText(mActivity.getString(R.string.top_score,
@@ -1677,7 +1687,9 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
} else {
mFragment.delayTransition();
bottomConstraintLayout.getLayoutParams().height = 0;
- topScoreTextView.setVisibility(View.VISIBLE);
+ if (!mHideTheNumberOfVotes) {
+ topScoreTextView.setVisibility(View.VISIBLE);
+ }
}
return true;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java
index 6f246348..0cf4ba52 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java
@@ -214,6 +214,7 @@ public class SharedPreferencesUtils {
public static final String POST_FEED_MAX_RESOLUTION = "post_feed_max_resolution";
public static final String REDDIT_VIDEO_DEFAULT_RESOLUTION = "reddit_video_default_resolution";
public static final String EASIER_TO_WATCH_IN_FULL_SCREEN = "easier_to_watch_in_full_screen";
+ public static final String HIDE_THE_NUMBER_OF_VOTES_IN_COMMENTS = "hide_the_number_of_votes_in_comments";
public static final String DEFAULT_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit_preferences";
public static final String MAIN_PAGE_TABS_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.main_page_tabs";
diff --git a/app/src/main/res/xml/comment_preferences.xml b/app/src/main/res/xml/comment_preferences.xml
index dd9245e4..c38eb2f1 100644
--- a/app/src/main/res/xml/comment_preferences.xml
+++ b/app/src/main/res/xml/comment_preferences.xml
@@ -47,6 +47,11 @@
app:key="always_show_child_comment_count"
android:title="@string/settings_always_show_child_comment_count_title" />
+ <ml.docilealligator.infinityforreddit.customviews.CustomFontSwitchPreference
+ app:defaultValue="false"
+ app:key="hide_the_number_of_votes_in_comments"
+ app:title="@string/settings_hide_the_number_of_votes" />
+
<ml.docilealligator.infinityforreddit.customviews.CustomFontSeekBarPreference
app:defaultValue="5"
android:max="10"