New option: Settings->Interface->Post Details->Hide Upvote Ratio.

This commit is contained in:
Docile-Alligator 2022-02-21 15:38:17 +08:00
parent 4b3e11c62d
commit 3a69e02867
4 changed files with 14 additions and 1 deletions

View File

@ -166,6 +166,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
private boolean mOnlyDisablePreviewInVideoAndGifPosts; private boolean mOnlyDisablePreviewInVideoAndGifPosts;
private boolean mHidePostType; private boolean mHidePostType;
private boolean mHidePostFlair; private boolean mHidePostFlair;
private boolean mHideUpvoteRatio;
private boolean mHideTheNumberOfAwards; private boolean mHideTheNumberOfAwards;
private boolean mHideSubredditAndUserPrefix; private boolean mHideSubredditAndUserPrefix;
private boolean mHideTheNumberOfVotes; private boolean mHideTheNumberOfVotes;
@ -353,6 +354,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
mHidePostType = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_POST_TYPE, false); mHidePostType = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_POST_TYPE, false);
mHidePostFlair = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_POST_FLAIR, false); mHidePostFlair = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_POST_FLAIR, false);
mHideUpvoteRatio = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_UPVOTE_RATIO, false);
mHideTheNumberOfAwards = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_AWARDS, false); mHideTheNumberOfAwards = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_AWARDS, false);
mHideSubredditAndUserPrefix = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_SUBREDDIT_AND_USER_PREFIX, false); mHideSubredditAndUserPrefix = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_SUBREDDIT_AND_USER_PREFIX, false);
mHideTheNumberOfVotes = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_VOTES, false); mHideTheNumberOfVotes = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_VOTES, false);
@ -622,7 +624,11 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
Utils.setHTMLWithImageToTextView(((PostDetailBaseViewHolder) holder).mAwardsTextView, mPost.getAwards(), true); Utils.setHTMLWithImageToTextView(((PostDetailBaseViewHolder) holder).mAwardsTextView, mPost.getAwards(), true);
} }
if (mHideUpvoteRatio) {
((PostDetailBaseViewHolder) holder).mUpvoteRatioTextView.setVisibility(View.GONE);
} else {
((PostDetailBaseViewHolder) holder).mUpvoteRatioTextView.setText(mPost.getUpvoteRatio() + "%"); ((PostDetailBaseViewHolder) holder).mUpvoteRatioTextView.setText(mPost.getUpvoteRatio() + "%");
}
if (mPost.isNSFW()) { if (mPost.isNSFW()) {
((PostDetailBaseViewHolder) holder).mNSFWTextView.setVisibility(View.VISIBLE); ((PostDetailBaseViewHolder) holder).mNSFWTextView.setVisibility(View.VISIBLE);

View File

@ -207,6 +207,7 @@ public class SharedPreferencesUtils {
public static final String SHOW_FEWER_TOOLBAR_OPTIONS_THRESHOLD = "show_fewer_toolbar_options_threshold"; public static final String SHOW_FEWER_TOOLBAR_OPTIONS_THRESHOLD = "show_fewer_toolbar_options_threshold";
public static final String SHOW_AUTHOR_AVATAR = "show_author_avatar"; public static final String SHOW_AUTHOR_AVATAR = "show_author_avatar";
public static final String ALWAYS_SHOW_CHILD_COMMENT_COUNT = "always_show_child_comment_count"; public static final String ALWAYS_SHOW_CHILD_COMMENT_COUNT = "always_show_child_comment_count";
public static final String HIDE_UPVOTE_RATIO = "hide_upvote_ratio";
public static final String DEFAULT_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit_preferences"; 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"; public static final String MAIN_PAGE_TABS_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.main_page_tabs";

View File

@ -632,6 +632,7 @@
<string name="settings_show_author_avatar_title">Show Author Avatar</string> <string name="settings_show_author_avatar_title">Show Author Avatar</string>
<string name="settings_reddit_user_agreement_title">Reddit User Agreement</string> <string name="settings_reddit_user_agreement_title">Reddit User Agreement</string>
<string name="settings_always_show_child_comment_count_title">Always Show the Number of Child Comments</string> <string name="settings_always_show_child_comment_count_title">Always Show the Number of Child Comments</string>
<string name="settings_hide_upvote_ratio_title">Hide Upvote Ratio</string>
<string name="no_link_available">Cannot get the link</string> <string name="no_link_available">Cannot get the link</string>

View File

@ -18,6 +18,11 @@
app:key="hide_post_flair" app:key="hide_post_flair"
app:title="@string/settings_hide_post_flair" /> app:title="@string/settings_hide_post_flair" />
<ml.docilealligator.infinityforreddit.customviews.CustomFontSwitchPreference
app:defaultValue="false"
app:key="hide_upvote_ratio"
app:title="@string/settings_hide_upvote_ratio_title" />
<ml.docilealligator.infinityforreddit.customviews.CustomFontSwitchPreference <ml.docilealligator.infinityforreddit.customviews.CustomFontSwitchPreference
app:defaultValue="false" app:defaultValue="false"
app:key="hide_the_number_of_awards" app:key="hide_the_number_of_awards"