mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-27 19:38:22 +01:00
New option: Settings->Interface->Comment->Hide the Number of Votes.
This commit is contained in:
parent
681a1c584c
commit
8326e6c4a2
@ -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;
|
||||
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,6 +443,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
||||
((CommentViewHolder) holder).mMarkwonAdapter.setMarkdown(mCommentMarkwon, comment.getCommentMarkdown());
|
||||
((CommentViewHolder) holder).mMarkwonAdapter.notifyDataSetChanged();
|
||||
|
||||
if (!mHideTheNumberOfVotes) {
|
||||
String commentText = "";
|
||||
String topScoreText = "";
|
||||
if (comment.isScoreHidden()) {
|
||||
@ -452,6 +457,9 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
||||
}
|
||||
((CommentViewHolder) holder).scoreTextView.setText(commentText);
|
||||
((CommentViewHolder) holder).topScoreTextView.setText(topScoreText);
|
||||
} else {
|
||||
((CommentViewHolder) holder).scoreTextView.setText(mActivity.getString(R.string.vote));
|
||||
}
|
||||
|
||||
((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,8 +1687,10 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
||||
} else {
|
||||
mFragment.delayTransition();
|
||||
bottomConstraintLayout.getLayoutParams().height = 0;
|
||||
if (!mHideTheNumberOfVotes) {
|
||||
topScoreTextView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -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";
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user