aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-08-02 07:26:14 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-08-02 07:26:14 +0000
commit305ae1c13cafa495bfa6695f973557761abd6d61 (patch)
tree863dbb0a6e77cbf374449721c75c23466c269b11
parenta3b4c54ec2255cea03e930201cda9a0a37ef5c08 (diff)
downloadinfinity-for-reddit-305ae1c13cafa495bfa6695f973557761abd6d61.tar
infinity-for-reddit-305ae1c13cafa495bfa6695f973557761abd6d61.tar.gz
infinity-for-reddit-305ae1c13cafa495bfa6695f973557761abd6d61.tar.bz2
infinity-for-reddit-305ae1c13cafa495bfa6695f973557761abd6d61.tar.lz
infinity-for-reddit-305ae1c13cafa495bfa6695f973557761abd6d61.tar.xz
infinity-for-reddit-305ae1c13cafa495bfa6695f973557761abd6d61.tar.zst
infinity-for-reddit-305ae1c13cafa495bfa6695f973557761abd6d61.zip
New options: separate post and comments in post details page.
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java2
-rw-r--r--app/src/main/res/values/strings.xml2
-rw-r--r--app/src/main/res/xml-sw600dp/post_details_preferences.xml45
-rw-r--r--app/src/main/res/xml/post_details_preferences.xml7
5 files changed, 61 insertions, 3 deletions
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 @@
<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>
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 @@
+<?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> \ 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 @@
<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"