diff options
4 files changed, 14 insertions, 1 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java index 954853f1..d64a9d1b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java @@ -166,6 +166,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler private boolean mOnlyDisablePreviewInVideoAndGifPosts; private boolean mHidePostType; private boolean mHidePostFlair; + private boolean mHideUpvoteRatio; private boolean mHideTheNumberOfAwards; private boolean mHideSubredditAndUserPrefix; private boolean mHideTheNumberOfVotes; @@ -353,6 +354,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler mHidePostType = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_POST_TYPE, 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); mHideSubredditAndUserPrefix = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_SUBREDDIT_AND_USER_PREFIX, 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); } - ((PostDetailBaseViewHolder) holder).mUpvoteRatioTextView.setText(mPost.getUpvoteRatio() + "%"); + if (mHideUpvoteRatio) { + ((PostDetailBaseViewHolder) holder).mUpvoteRatioTextView.setVisibility(View.GONE); + } else { + ((PostDetailBaseViewHolder) holder).mUpvoteRatioTextView.setText(mPost.getUpvoteRatio() + "%"); + } if (mPost.isNSFW()) { ((PostDetailBaseViewHolder) holder).mNSFWTextView.setVisibility(View.VISIBLE); 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 3b166d7f..4ade7642 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java @@ -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_AUTHOR_AVATAR = "show_author_avatar"; 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 MAIN_PAGE_TABS_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.main_page_tabs"; diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2fd5280a..5c384e11 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -632,6 +632,7 @@ <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_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> diff --git a/app/src/main/res/xml/post_details_preferences.xml b/app/src/main/res/xml/post_details_preferences.xml index ceb07dcb..cf856634 100644 --- a/app/src/main/res/xml/post_details_preferences.xml +++ b/app/src/main/res/xml/post_details_preferences.xml @@ -20,6 +20,11 @@ <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 + app:defaultValue="false" app:key="hide_the_number_of_awards" app:title="@string/settings_hide_the_number_of_awards" /> |