diff options
author | Alex Ning <chineseperson5@gmail.com> | 2021-02-24 04:54:45 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2021-02-24 04:54:45 +0000 |
commit | 8768e71a910284a74824a26db3041c339a3af325 (patch) | |
tree | cc9e320f49c313d2cead0d4696e8b6d8257bfe6f /app/src | |
parent | 07e2e1e746164eb39c20a1bacbb53bdfc3f8d2c8 (diff) | |
download | infinity-for-reddit-8768e71a910284a74824a26db3041c339a3af325.tar infinity-for-reddit-8768e71a910284a74824a26db3041c339a3af325.tar.gz infinity-for-reddit-8768e71a910284a74824a26db3041c339a3af325.tar.bz2 infinity-for-reddit-8768e71a910284a74824a26db3041c339a3af325.tar.lz infinity-for-reddit-8768e71a910284a74824a26db3041c339a3af325.tar.xz infinity-for-reddit-8768e71a910284a74824a26db3041c339a3af325.tar.zst infinity-for-reddit-8768e71a910284a74824a26db3041c339a3af325.zip |
New options: Hide subreddit and user prefix and hide the number of votes.
Diffstat (limited to 'app/src')
10 files changed, 153 insertions, 28 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java index 87025e50..46f3f7d9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java @@ -210,6 +210,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView private boolean mHideReadPostsAutomatically; private boolean mHidePostType; private boolean mHideTheNumberOfAwards; + private boolean mHideSubredditAndUserPrefix; + private boolean mHideTheNumberOfVotes; private Drawable mCommentIcon; private NetworkState networkState; private ExoCreator mExoCreator; @@ -283,6 +285,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView mHidePostType = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_POST_TYPE, false); mHideTheNumberOfAwards = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_AWARDS, false); + mHideSubredditAndUserPrefix = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_SUBREDDIT_AND_USER_PREFIX, false); + mHideTheNumberOfVotes = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_VOTES, false); mPostLayout = postLayout; @@ -475,8 +479,13 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView String flair = post.getFlair(); int nAwards = post.getNAwards(); - ((PostBaseViewHolder) holder).subredditTextView.setText(subredditNamePrefixed); - ((PostBaseViewHolder) holder).userTextView.setText(authorPrefixed); + if (mHideSubredditAndUserPrefix) { + ((PostBaseViewHolder) holder).subredditTextView.setText(subredditName); + ((PostBaseViewHolder) holder).userTextView.setText(post.getAuthor()); + } else { + ((PostBaseViewHolder) holder).subredditTextView.setText(subredditNamePrefixed); + ((PostBaseViewHolder) holder).userTextView.setText(authorPrefixed); + } if (mDisplaySubredditName) { if (authorPrefixed.equals(subredditNamePrefixed)) { @@ -590,7 +599,11 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView } ((PostBaseViewHolder) holder).titleTextView.setText(post.getTitle()); - ((PostBaseViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); + if (!mHideTheNumberOfVotes) { + ((PostBaseViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); + } else { + ((PostBaseViewHolder) holder).scoreTextView.setText(mActivity.getString(R.string.vote)); + } if (post.isLocked()) { ((PostBaseViewHolder) holder).lockedImageView.setVisibility(View.VISIBLE); @@ -1011,7 +1024,11 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView } ((PostCompactBaseViewHolder) holder).nameTextView.setTextColor(mSubredditColor); - ((PostCompactBaseViewHolder) holder).nameTextView.setText(subredditNamePrefixed); + if (mHideSubredditAndUserPrefix) { + ((PostCompactBaseViewHolder) holder).nameTextView.setText(subredditName); + } else { + ((PostCompactBaseViewHolder) holder).nameTextView.setText(subredditNamePrefixed); + } } else { if (post.getAuthorIconUrl() == null) { String authorName = post.getAuthor().equals("[deleted]") ? post.getSubredditNamePrefixed().substring(2) : post.getAuthor(); @@ -1047,7 +1064,11 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView } ((PostCompactBaseViewHolder) holder).nameTextView.setTextColor(mUsernameColor); - ((PostCompactBaseViewHolder) holder).nameTextView.setText(authorPrefixed); + if (mHideSubredditAndUserPrefix) { + ((PostCompactBaseViewHolder) holder).nameTextView.setText(post.getAuthor()); + } else { + ((PostCompactBaseViewHolder) holder).nameTextView.setText(authorPrefixed); + } } if (mShowElapsedTime) { @@ -1074,7 +1095,11 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView } ((PostCompactBaseViewHolder) holder).titleTextView.setText(title); - ((PostCompactBaseViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); + if (!mHideTheNumberOfVotes) { + ((PostCompactBaseViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); + } else { + ((PostCompactBaseViewHolder) holder).scoreTextView.setText(mActivity.getString(R.string.vote)); + } if (post.isLocked()) { ((PostCompactBaseViewHolder) holder).lockedImageView.setVisibility(View.VISIBLE); @@ -1765,6 +1790,14 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView mHideTheNumberOfAwards = hideTheNumberOfAwards; } + public void setHideSubredditAndUserPrefix(boolean hideSubredditAndUserPrefix) { + mHideSubredditAndUserPrefix = hideSubredditAndUserPrefix; + } + + public void setHideTheNumberOfVotes(boolean hideTheNumberOfVotes) { + mHideTheNumberOfVotes = hideTheNumberOfVotes; + } + @Override public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) { super.onViewRecycled(holder); @@ -2298,7 +2331,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView scoreTextView.setTextColor(mPostIconAndInfoColor); } - scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); + if (!mHideTheNumberOfVotes) { + scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); + } VoteThing.voteThing(mActivity, mOauthRetrofit, mAccessToken, new VoteThing.VoteThingListener() { @Override @@ -2320,7 +2355,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView if (currentPosition == position) { downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); - scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); + if (!mHideTheNumberOfVotes) { + scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); + } } EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post)); @@ -2331,7 +2368,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView Toast.makeText(mActivity, R.string.vote_failed, Toast.LENGTH_SHORT).show(); post.setVoteType(previousVoteType); if (getBindingAdapterPosition() == position) { - scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + previousVoteType)); + if (!mHideTheNumberOfVotes) { + scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + previousVoteType)); + } upvoteButton.setColorFilter(previousUpvoteButtonColorFilter); downvoteButton.setColorFilter(previousDownvoteButtonColorFilter); scoreTextView.setTextColor(previousScoreTextViewColor); @@ -2388,7 +2427,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView scoreTextView.setTextColor(mPostIconAndInfoColor); } - scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); + if (!mHideTheNumberOfVotes) { + scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); + } VoteThing.voteThing(mActivity, mOauthRetrofit, mAccessToken, new VoteThing.VoteThingListener() { @Override @@ -2410,7 +2451,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView if (currentPosition == position) { upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); - scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); + if (!mHideTheNumberOfVotes) { + scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); + } } EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post)); @@ -2421,7 +2464,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView Toast.makeText(mActivity, R.string.vote_failed, Toast.LENGTH_SHORT).show(); post.setVoteType(previousVoteType); if (getBindingAdapterPosition() == position) { - scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + previousVoteType)); + if (!mHideTheNumberOfVotes) { + scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + previousVoteType)); + } upvoteButton.setColorFilter(previousUpvoteButtonColorFilter); downvoteButton.setColorFilter(previousDownvoteButtonColorFilter); scoreTextView.setTextColor(previousScoreTextViewColor); @@ -3253,7 +3298,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView scoreTextView.setTextColor(mPostIconAndInfoColor); } - scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); + if (!mHideTheNumberOfVotes) { + scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); + } VoteThing.voteThing(mActivity, mOauthRetrofit, mAccessToken, new VoteThing.VoteThingListener() { @Override @@ -3275,7 +3322,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView if (currentPosition == position) { downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); - scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); + if (!mHideTheNumberOfVotes) { + scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); + } } EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post)); @@ -3286,7 +3335,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView Toast.makeText(mActivity, R.string.vote_failed, Toast.LENGTH_SHORT).show(); post.setVoteType(previousVoteType); if (getBindingAdapterPosition() == position) { - scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + previousVoteType)); + if (!mHideTheNumberOfVotes) { + scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + previousVoteType)); + } upvoteButton.setColorFilter(previousUpvoteButtonColorFilter); downvoteButton.setColorFilter(previousDownvoteButtonColorFilter); scoreTextView.setTextColor(previousScoreTextViewColor); @@ -3343,7 +3394,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView scoreTextView.setTextColor(mPostIconAndInfoColor); } - scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); + if (!mHideTheNumberOfVotes) { + scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); + } VoteThing.voteThing(mActivity, mOauthRetrofit, mAccessToken, new VoteThing.VoteThingListener() { @Override @@ -3366,7 +3419,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView if (currentPosition == position) { upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); - scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); + if (!mHideTheNumberOfVotes) { + scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); + } } EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post)); @@ -3377,7 +3432,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView Toast.makeText(mActivity, R.string.vote_failed, Toast.LENGTH_SHORT).show(); post.setVoteType(previousVoteType); if (getBindingAdapterPosition() == position) { - scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + previousVoteType)); + if (!mHideTheNumberOfVotes) { + scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + previousVoteType)); + } upvoteButton.setColorFilter(previousUpvoteButtonColorFilter); downvoteButton.setColorFilter(previousDownvoteButtonColorFilter); scoreTextView.setTextColor(previousScoreTextViewColor); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostLayoutBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostLayoutBottomSheetFragment.java index b2babae7..df1bf5e9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostLayoutBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostLayoutBottomSheetFragment.java @@ -26,12 +26,12 @@ public class PostLayoutBottomSheetFragment extends RoundedBottomSheetDialogFragm @BindView(R.id.card_layout_text_view_post_layout_bottom_sheet_fragment) TextView cardLayoutTextView; + @BindView(R.id.card_layout_2_text_view_post_layout_bottom_sheet_fragment) + TextView cardLayout2TextView; @BindView(R.id.compact_layout_text_view_post_layout_bottom_sheet_fragment) TextView compactLayoutTextView; @BindView(R.id.gallery_layout_text_view_post_layout_bottom_sheet_fragment) TextView galleryLayoutTextView; - @BindView(R.id.card_layout_2_text_view_post_layout_bottom_sheet_fragment) - TextView cardLayout2TextView; private Activity activity; public PostLayoutBottomSheetFragment() { // Required empty public constructor diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/events/ChangeHideSubredditAndUserPrefixEvent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/events/ChangeHideSubredditAndUserPrefixEvent.java new file mode 100644 index 00000000..d6981747 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/events/ChangeHideSubredditAndUserPrefixEvent.java @@ -0,0 +1,9 @@ +package ml.docilealligator.infinityforreddit.events; + +public class ChangeHideSubredditAndUserPrefixEvent { + public boolean hideSubredditAndUserPrefix; + + public ChangeHideSubredditAndUserPrefixEvent(boolean hideSubredditAndUserPrefix) { + this.hideSubredditAndUserPrefix = hideSubredditAndUserPrefix; + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/events/ChangeHideTheNumberOfVotesEvent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/events/ChangeHideTheNumberOfVotesEvent.java new file mode 100644 index 00000000..ed4273b6 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/events/ChangeHideTheNumberOfVotesEvent.java @@ -0,0 +1,9 @@ +package ml.docilealligator.infinityforreddit.events; + +public class ChangeHideTheNumberOfVotesEvent { + public boolean hideTheNumberOfVotes; + + public ChangeHideTheNumberOfVotesEvent(boolean hideTheNumberOfVotes) { + this.hideTheNumberOfVotes = hideTheNumberOfVotes; + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java index 7841efc2..60fd460d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java @@ -85,7 +85,9 @@ import ml.docilealligator.infinityforreddit.events.ChangeDefaultPostLayoutEvent; import ml.docilealligator.infinityforreddit.events.ChangeDisableImagePreviewEvent; import ml.docilealligator.infinityforreddit.events.ChangeEnableSwipeActionSwitchEvent; import ml.docilealligator.infinityforreddit.events.ChangeHidePostTypeEvent; +import ml.docilealligator.infinityforreddit.events.ChangeHideSubredditAndUserPrefixEvent; import ml.docilealligator.infinityforreddit.events.ChangeHideTheNumberOfAwardsEvent; +import ml.docilealligator.infinityforreddit.events.ChangeHideTheNumberOfVotesEvent; import ml.docilealligator.infinityforreddit.events.ChangeLongPressToHideToolbarInCompactLayoutEvent; import ml.docilealligator.infinityforreddit.events.ChangeMuteAutoplayingVideosEvent; import ml.docilealligator.infinityforreddit.events.ChangeMuteNSFWVideoEvent; @@ -1657,6 +1659,22 @@ public class PostFragment extends Fragment implements FragmentCommunicator { } } + @Subscribe + public void onChangeHideSubredditAndUserEvent(ChangeHideSubredditAndUserPrefixEvent event) { + if (mAdapter != null) { + mAdapter.setHideSubredditAndUserPrefix(event.hideSubredditAndUserPrefix); + refreshAdapter(); + } + } + + @Subscribe + public void onChangeHideTheNumberOfVotesEvent(ChangeHideTheNumberOfVotesEvent event) { + if (mAdapter != null) { + mAdapter.setHideTheNumberOfVotes(event.hideTheNumberOfVotes); + refreshAdapter(); + } + } + private void refreshAdapter() { int previousPosition = -1; if (mLinearLayoutManager != null) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/PostPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/PostPreferenceFragment.java index f04c205a..b7d0f205 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/PostPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/PostPreferenceFragment.java @@ -12,7 +12,9 @@ import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.events.ChangeCompactLayoutToolbarHiddenByDefaultEvent; import ml.docilealligator.infinityforreddit.events.ChangeDefaultPostLayoutEvent; import ml.docilealligator.infinityforreddit.events.ChangeHidePostTypeEvent; +import ml.docilealligator.infinityforreddit.events.ChangeHideSubredditAndUserPrefixEvent; import ml.docilealligator.infinityforreddit.events.ChangeHideTheNumberOfAwardsEvent; +import ml.docilealligator.infinityforreddit.events.ChangeHideTheNumberOfVotesEvent; import ml.docilealligator.infinityforreddit.events.ChangeLongPressToHideToolbarInCompactLayoutEvent; import ml.docilealligator.infinityforreddit.events.ChangeShowAbsoluteNumberOfVotesEvent; import ml.docilealligator.infinityforreddit.events.ShowDividerInCompactLayoutPreferenceEvent; @@ -33,6 +35,8 @@ public class PostPreferenceFragment extends PreferenceFragmentCompat { SwitchPreference postCompactLayoutToolbarHiddenByDefaultSwitch = findPreference(SharedPreferencesUtils.POST_COMPACT_LAYOUT_TOOLBAR_HIDDEN_BY_DEFAULT); SwitchPreference hidePostTypeSwitch = findPreference(SharedPreferencesUtils.HIDE_POST_TYPE); SwitchPreference hideTheNumberOfAwardsSwitch = findPreference(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_AWARDS); + SwitchPreference hideSubredditAndUserPrefixSwitch = findPreference(SharedPreferencesUtils.HIDE_SUBREDDIT_AND_USER_PREFIX); + SwitchPreference hideTheNumberOfVotesSwitch = findPreference(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_VOTES); if (defaultPostLayoutList != null) { defaultPostLayoutList.setOnPreferenceChangeListener((preference, newValue) -> { @@ -89,5 +93,19 @@ public class PostPreferenceFragment extends PreferenceFragmentCompat { return true; }); } + + if (hideSubredditAndUserPrefixSwitch != null) { + hideSubredditAndUserPrefixSwitch.setOnPreferenceChangeListener((preference, newValue) -> { + EventBus.getDefault().post(new ChangeHideSubredditAndUserPrefixEvent((Boolean) newValue)); + return true; + }); + } + + if (hideTheNumberOfVotesSwitch != null) { + hideTheNumberOfVotesSwitch.setOnPreferenceChangeListener((preference, newValue) -> { + EventBus.getDefault().post(new ChangeHideTheNumberOfVotesEvent((Boolean) newValue)); + return true; + }); + } } }
\ No newline at end of file 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 965f8145..abef106a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java @@ -165,6 +165,8 @@ public class SharedPreferencesUtils { public static final String CLICK_TO_SHOW_MEDIA_IN_GALLERY_LAYOUT = "click_to_show_media_in_gallery_layout"; public static final String HIDE_POST_TYPE = "hide_post_type"; public static final String HIDE_THE_NUMBER_OF_AWARDS = "hide_the_number_of_awards"; + public static final String HIDE_SUBREDDIT_AND_USER_PREFIX = "hide_subreddit_and_user_prefix"; + public static final String HIDE_THE_NUMBER_OF_VOTES = "hide_the_number_of_votes"; public static final String MAIN_PAGE_TABS_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.main_page_tabs"; public static final String MAIN_PAGE_TAB_COUNT = "_main_page_tab_count"; diff --git a/app/src/main/res/layout/fragment_post_layot_bottom_sheet.xml b/app/src/main/res/layout/fragment_post_layot_bottom_sheet.xml index 3cf40d28..e42263a0 100644 --- a/app/src/main/res/layout/fragment_post_layot_bottom_sheet.xml +++ b/app/src/main/res/layout/fragment_post_layot_bottom_sheet.xml @@ -29,7 +29,7 @@ android:fontFamily="?attr/font_family" /> <TextView - android:id="@+id/compact_layout_text_view_post_layout_bottom_sheet_fragment" + android:id="@+id/card_layout_2_text_view_post_layout_bottom_sheet_fragment" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?attr/selectableItemBackground" @@ -39,13 +39,13 @@ android:paddingTop="16dp" android:paddingEnd="32dp" android:paddingBottom="16dp" - android:text="@string/post_layout_compact" + android:text="@string/post_layout_card_2" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" android:fontFamily="?attr/font_family" /> <TextView - android:id="@+id/gallery_layout_text_view_post_layout_bottom_sheet_fragment" + android:id="@+id/compact_layout_text_view_post_layout_bottom_sheet_fragment" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?attr/selectableItemBackground" @@ -55,13 +55,13 @@ android:paddingTop="16dp" android:paddingEnd="32dp" android:paddingBottom="16dp" - android:text="@string/post_layout_gallery" + android:text="@string/post_layout_compact" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" android:fontFamily="?attr/font_family" /> <TextView - android:id="@+id/card_layout_2_text_view_post_layout_bottom_sheet_fragment" + android:id="@+id/gallery_layout_text_view_post_layout_bottom_sheet_fragment" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?attr/selectableItemBackground" @@ -71,7 +71,7 @@ android:paddingTop="16dp" android:paddingEnd="32dp" android:paddingBottom="16dp" - android:text="@string/post_layout_card_2" + android:text="@string/post_layout_gallery" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" android:fontFamily="?attr/font_family" /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 97c0a842..92097b7c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -537,6 +537,8 @@ <string name="settings_click_to_show_media_in_gallery_layout">Click to Show Media in Gallery Layout</string> <string name="settings_hide_post_type">Hide Post Type</string> <string name="settings_hide_the_number_of_awards">Hide the Number of Awards</string> + <string name="settings_hide_subreddit_and_user_prefix">Hide Subreddit and User Prefix</string> + <string name="settings_hide_the_number_of_votes">Hide the Number of Votes</string> <string name="no_link_available">Cannot get the link</string> @@ -1024,7 +1026,7 @@ <string name="have_trouble_login_title">Having Trouble Login</string> <string name="have_trouble_login_message">Do you want to try another way to login?</string> - <!-- TODO: Remove or change this placeholder text --> - <string name="hello_blank_fragment">Hello blank fragment</string> + + <string name="vote">Vote</string> </resources> diff --git a/app/src/main/res/xml/post_preferences.xml b/app/src/main/res/xml/post_preferences.xml index bafe60fd..c695d63c 100644 --- a/app/src/main/res/xml/post_preferences.xml +++ b/app/src/main/res/xml/post_preferences.xml @@ -24,6 +24,16 @@ app:key="hide_the_number_of_awards" app:title="@string/settings_hide_the_number_of_awards" /> + <SwitchPreference + app:defaultValue="false" + app:key="hide_subreddit_and_user_prefix" + app:title="@string/settings_hide_subreddit_and_user_prefix" /> + + <SwitchPreference + app:defaultValue="false" + app:key="hide_the_number_of_votes" + app:title="@string/settings_hide_the_number_of_votes" /> + <PreferenceCategory app:title="@string/post_layout_compact" /> |