New options: separate post and comments in post details page.

This commit is contained in:
Alex Ning 2021-08-02 15:26:14 +08:00
parent a3b4c54ec2
commit 305ae1c13c
5 changed files with 61 additions and 3 deletions

View File

@ -265,6 +265,14 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
if (getResources().getBoolean(R.bool.isTablet) || getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
mCommentsRecyclerView = rootView.findViewById(R.id.comments_recycler_view_view_post_detail_fragment);
}
if (!((mPostDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.SEPARATE_POST_AND_COMMENTS_IN_LANDSCAPE_MODE, true)
&& getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE)
|| (mPostDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.SEPARATE_POST_AND_COMMENTS_IN_PORTRAIT_MODE, false)))) {
if (mCommentsRecyclerView != null) {
mCommentsRecyclerView.setVisibility(View.GONE);
mCommentsRecyclerView = null;
}
}
if (activity != null && activity.isImmersiveInterface()) {
mRecyclerView.setPadding(0, 0, 0, activity.getNavBarHeight() + mRecyclerView.getPaddingBottom());

View File

@ -320,6 +320,8 @@ public class SharedPreferencesUtils {
public static final String HIDE_SUBSCRIBED_SUBREDDITS_SECTIONS = "hide_subscribed_subreddits_sections";
public static final String POST_DETAILS_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.post_details";
public static final String SEPARATE_POST_AND_COMMENTS_IN_PORTRAIT_MODE = "separate_post_and_comments_in_portrait_mode";
public static final String SEPARATE_POST_AND_COMMENTS_IN_LANDSCAPE_MODE = "separate_post_and_comments_in_landscape_mode";
//Legacy Settings
public static final String MAIN_PAGE_TAB_1_TITLE_LEGACY = "main_page_tab_1_title";

View File

@ -589,6 +589,8 @@
<string name="settings_video_player_automatic_landscape_orientation">Switch to Landscape Orientation in Video Player Automatically</string>
<string name="settings_remember_muting_option_in_post_feed">Remember Muting Option in Post Feed</string>
<string name="settings_post_details_title">Post Details</string>
<string name="settings_separate_post_and_comments_in_portrait_mode">Separate Post And Comments in Portrait Mode</string>
<string name="settings_separate_post_and_comments_in_landscape_mode">Separate Post And Comments in Landscape Mode</string>
<string name="no_link_available">Cannot get the link</string>

View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<SwitchPreference
app:defaultValue="true"
app:key="separate_post_and_comments_in_portrait_mode"
app:title="@string/settings_separate_post_and_comments_in_portrait_mode" />
<SwitchPreference
app:defaultValue="true"
app:key="separate_post_and_comments_in_landscape_mode"
app:title="@string/settings_separate_post_and_comments_in_landscape_mode" />
<SwitchPreference
app:defaultValue="false"
app:key="hide_post_type"
app:title="@string/settings_hide_post_type" />
<SwitchPreference
app:defaultValue="false"
app:key="hide_post_flair"
app:title="@string/settings_hide_post_flair" />
<SwitchPreference
app:defaultValue="false"
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" />
<SwitchPreference
app:defaultValue="false"
app:key="hide_the_number_of_comments"
app:title="@string/settings_hide_the_number_of_comments" />
</PreferenceScreen>

View File

@ -2,9 +2,10 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<!--<Preference
app:title="@string/settings_number_of_columns_in_post_feed_title"
app:fragment="ml.docilealligator.infinityforreddit.settings.NumberOfColumnsInPostFeedPreferenceFragment" />-->
<SwitchPreference
app:defaultValue="true"
app:key="separate_post_and_comments_in_landscape_mode"
app:title="@string/settings_separate_post_and_comments_in_landscape_mode" />
<SwitchPreference
app:defaultValue="false"