diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java index 42c688f4..1a97ab9f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java @@ -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()); 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 c1fe0797..69b5917b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java @@ -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"; diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 522701ce..e50763db 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -589,6 +589,8 @@ Switch to Landscape Orientation in Video Player Automatically Remember Muting Option in Post Feed Post Details + Separate Post And Comments in Portrait Mode + Separate Post And Comments in Landscape Mode Cannot get the link diff --git a/app/src/main/res/xml-sw600dp/post_details_preferences.xml b/app/src/main/res/xml-sw600dp/post_details_preferences.xml new file mode 100644 index 00000000..1bb6f4c9 --- /dev/null +++ b/app/src/main/res/xml-sw600dp/post_details_preferences.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/xml/post_details_preferences.xml b/app/src/main/res/xml/post_details_preferences.xml index 48e1ffbd..a082c1ee 100644 --- a/app/src/main/res/xml/post_details_preferences.xml +++ b/app/src/main/res/xml/post_details_preferences.xml @@ -2,9 +2,10 @@ - +