aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-02-17 13:44:59 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-02-17 13:44:59 +0000
commit52d6691ae7ea7d9d5a19bede87b913f33e0645a3 (patch)
treeda85b2f9454e28a8629cafa9552cd6cb9f4334ee /app
parent9b9a1aa308659fc2f031f468002eeff15323b9d6 (diff)
downloadinfinity-for-reddit-52d6691ae7ea7d9d5a19bede87b913f33e0645a3.tar
infinity-for-reddit-52d6691ae7ea7d9d5a19bede87b913f33e0645a3.tar.gz
infinity-for-reddit-52d6691ae7ea7d9d5a19bede87b913f33e0645a3.tar.bz2
infinity-for-reddit-52d6691ae7ea7d9d5a19bede87b913f33e0645a3.tar.lz
infinity-for-reddit-52d6691ae7ea7d9d5a19bede87b913f33e0645a3.tar.xz
infinity-for-reddit-52d6691ae7ea7d9d5a19bede87b913f33e0645a3.tar.zst
infinity-for-reddit-52d6691ae7ea7d9d5a19bede87b913f33e0645a3.zip
Customize the number of columns in Post Feed for every post layout.
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java72
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/settings/CommentPreferenceFragment.java15
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/settings/GesturesAndButtonsPreferenceFragment.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/settings/InterfacePreferenceFragment.java59
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/settings/PostPreferenceFragment.java75
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java4
-rw-r--r--app/src/main/res/values/strings.xml2
-rw-r--r--app/src/main/res/xml/comment_preferences.xml30
-rw-r--r--app/src/main/res/xml/gestures_and_buttons_preferences.xml (renamed from app/src/main/res/xml/gestures_and_buttons_preference.xml)0
-rw-r--r--app/src/main/res/xml/interface_preference.xml117
-rw-r--r--app/src/main/res/xml/interface_preferences.xml62
-rw-r--r--app/src/main/res/xml/number_of_columns_in_post_feed_preferences.xml43
-rw-r--r--app/src/main/res/xml/post_preferences.xml37
13 files changed, 323 insertions, 195 deletions
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 b514b160..cbce964b 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java
@@ -319,25 +319,6 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
int windowWidth = displayMetrics.widthPixels;
- int nColumns;
- if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
- nColumns = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.NUMBER_OF_COLUMNS_IN_POST_FEED_PORTRAIT, "1"));
- } else {
- nColumns = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.NUMBER_OF_COLUMNS_IN_POST_FEED_LANDSCAPE, "2"));
- }
-
- if (nColumns == 1) {
- mLinearLayoutManager = new LinearLayoutManager(activity);
- mPostRecyclerView.setLayoutManager(mLinearLayoutManager);
- } else {
- mStaggeredGridLayoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
- mPostRecyclerView.setLayoutManager(mStaggeredGridLayoutManager);
- StaggeredGridLayoutManagerItemOffsetDecoration itemDecoration =
- new StaggeredGridLayoutManagerItemOffsetDecoration(activity, R.dimen.staggeredLayoutManagerItemOffset);
- mPostRecyclerView.addItemDecoration(itemDecoration);
- windowWidth /= 2;
- }
-
mGlide = Glide.with(activity);
lazyModeRunnable = new LazyModeRunnable() {
@@ -747,6 +728,19 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
});
}
+ int nColumns = getNColumns(resources);
+ if (nColumns == 1) {
+ mLinearLayoutManager = new LinearLayoutManager(activity);
+ mPostRecyclerView.setLayoutManager(mLinearLayoutManager);
+ } else {
+ mStaggeredGridLayoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
+ mPostRecyclerView.setLayoutManager(mStaggeredGridLayoutManager);
+ StaggeredGridLayoutManagerItemOffsetDecoration itemDecoration =
+ new StaggeredGridLayoutManagerItemOffsetDecoration(activity, R.dimen.staggeredLayoutManagerItemOffset);
+ mPostRecyclerView.addItemDecoration(itemDecoration);
+ windowWidth /= 2;
+ }
+
mAdapter.setHideReadPostsIndex(hideReadPostsIndex);
if (activity instanceof ActivityToolbarInterface) {
@@ -919,6 +913,28 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
return rootView;
}
+ private int getNColumns(Resources resources) {
+ if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
+ switch (postLayout) {
+ case SharedPreferencesUtils.POST_LAYOUT_COMPACT:
+ return Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.NUMBER_OF_COLUMNS_IN_POST_FEED_PORTRAIT_COMPACT_LAYOUT, "1"));
+ case SharedPreferencesUtils.POST_LAYOUT_GALLERY:
+ return Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.NUMBER_OF_COLUMNS_IN_POST_FEED_PORTRAIT_GALLERY_LAYOUT, "2"));
+ default:
+ return Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.NUMBER_OF_COLUMNS_IN_POST_FEED_PORTRAIT, "1"));
+ }
+ } else {
+ switch (postLayout) {
+ case SharedPreferencesUtils.POST_LAYOUT_COMPACT:
+ return Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.NUMBER_OF_COLUMNS_IN_POST_FEED_LANDSCAPE_COMPACT_LAYOUT, "2"));
+ case SharedPreferencesUtils.POST_LAYOUT_GALLERY:
+ return Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.NUMBER_OF_COLUMNS_IN_POST_FEED_LANDSCAPE_GALLERY_LAYOUT, "2"));
+ default:
+ return Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.NUMBER_OF_COLUMNS_IN_POST_FEED_LANDSCAPE, "2"));
+ }
+ }
+ }
+
private void initializeAndBindPostViewModel(String accessToken) {
if (postType == PostDataSource.TYPE_SEARCH) {
mPostViewModel = new ViewModelProvider(PostFragment.this, new PostViewModel.Factory(accessToken == null ? mRetrofit : mOauthRetrofit, accessToken,
@@ -1237,6 +1253,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
@Override
public void changePostLayout(int postLayout) {
+ this.postLayout = postLayout;
switch (postType) {
case PostDataSource.TYPE_FRONT_PAGE:
mPostLayoutSharedPreferences.edit().putInt(SharedPreferencesUtils.POST_LAYOUT_FRONT_PAGE_POST, postLayout).apply();
@@ -1255,6 +1272,23 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
break;
}
+ int nColumns = getNColumns(getResources());
+ if (nColumns == 1) {
+ mLinearLayoutManager = new LinearLayoutManager(activity);
+ mPostRecyclerView.setLayoutManager(mLinearLayoutManager);
+ mStaggeredGridLayoutManager = null;
+ if (mPostRecyclerView.getItemDecorationCount() > 0) {
+ mPostRecyclerView.removeItemDecorationAt(0);
+ }
+ } else if (nColumns == 2) {
+ mStaggeredGridLayoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
+ mPostRecyclerView.setLayoutManager(mStaggeredGridLayoutManager);
+ StaggeredGridLayoutManagerItemOffsetDecoration itemDecoration =
+ new StaggeredGridLayoutManagerItemOffsetDecoration(activity, R.dimen.staggeredLayoutManagerItemOffset);
+ mPostRecyclerView.addItemDecoration(itemDecoration);
+ mLinearLayoutManager = null;
+ }
+
if (mAdapter != null) {
mAdapter.setPostLayout(postLayout);
refreshAdapter();
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CommentPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CommentPreferenceFragment.java
new file mode 100644
index 00000000..a5d41885
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CommentPreferenceFragment.java
@@ -0,0 +1,15 @@
+package ml.docilealligator.infinityforreddit.settings;
+
+import android.os.Bundle;
+
+import androidx.preference.PreferenceFragmentCompat;
+
+import ml.docilealligator.infinityforreddit.R;
+
+public class CommentPreferenceFragment extends PreferenceFragmentCompat {
+
+ @Override
+ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
+ setPreferencesFromResource(R.xml.comment_preferences, rootKey);
+ }
+} \ No newline at end of file
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/GesturesAndButtonsPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/GesturesAndButtonsPreferenceFragment.java
index cd151ad3..882455ef 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/GesturesAndButtonsPreferenceFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/GesturesAndButtonsPreferenceFragment.java
@@ -35,7 +35,7 @@ public class GesturesAndButtonsPreferenceFragment extends PreferenceFragmentComp
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
- setPreferencesFromResource(R.xml.gestures_and_buttons_preference, rootKey);
+ setPreferencesFromResource(R.xml.gestures_and_buttons_preferences, rootKey);
((Infinity) activity.getApplication()).getAppComponent().inject(this);
SwitchPreference lockJumpToNextTopLevelCommentButtonSwitch =
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/InterfacePreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/InterfacePreferenceFragment.java
index e873f8ba..2ef43ebf 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/InterfacePreferenceFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/InterfacePreferenceFragment.java
@@ -4,39 +4,26 @@ package ml.docilealligator.infinityforreddit.settings;
import android.os.Build;
import android.os.Bundle;
-import androidx.preference.ListPreference;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.SwitchPreference;
import org.greenrobot.eventbus.EventBus;
-import ml.docilealligator.infinityforreddit.events.ChangeCompactLayoutToolbarHiddenByDefaultEvent;
-import ml.docilealligator.infinityforreddit.events.ChangeDefaultPostLayoutEvent;
-import ml.docilealligator.infinityforreddit.events.ChangeLongPressToHideToolbarInCompactLayoutEvent;
-import ml.docilealligator.infinityforreddit.events.ChangeShowAbsoluteNumberOfVotesEvent;
+import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.events.ChangeVoteButtonsPositionEvent;
import ml.docilealligator.infinityforreddit.events.RecreateActivityEvent;
-import ml.docilealligator.infinityforreddit.events.ShowDividerInCompactLayoutPreferenceEvent;
-import ml.docilealligator.infinityforreddit.events.ShowThumbnailOnTheRightInCompactLayoutEvent;
-import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
public class InterfacePreferenceFragment extends PreferenceFragmentCompat {
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
- setPreferencesFromResource(R.xml.interface_preference, rootKey);
+ setPreferencesFromResource(R.xml.interface_preferences, rootKey);
Preference immersiveInterfaceEntryPreference = findPreference(SharedPreferencesUtils.IMMERSIVE_INTERFACE_ENTRY_KEY);
SwitchPreference bottomAppBarSwitch = findPreference(SharedPreferencesUtils.BOTTOM_APP_BAR_KEY);
SwitchPreference voteButtonsOnTheRightSwitch = findPreference(SharedPreferencesUtils.VOTE_BUTTONS_ON_THE_RIGHT_KEY);
- ListPreference defaultPostLayoutSwitch = findPreference(SharedPreferencesUtils.DEFAULT_POST_LAYOUT_KEY);
- SwitchPreference showDividerInCompactLayout = findPreference(SharedPreferencesUtils.SHOW_DIVIDER_IN_COMPACT_LAYOUT);
- SwitchPreference showThumbnailOnTheRightInCompactLayout = findPreference(SharedPreferencesUtils.SHOW_THUMBNAIL_ON_THE_LEFT_IN_COMPACT_LAYOUT);
- SwitchPreference showAbsoluteNumberOfVotes = findPreference(SharedPreferencesUtils.SHOW_ABSOLUTE_NUMBER_OF_VOTES);
- SwitchPreference longPressToHideToolbarInCompactLayoutSwitch = findPreference(SharedPreferencesUtils.LONG_PRESS_TO_HIDE_TOOLBAR_IN_COMPACT_LAYOUT);
- SwitchPreference postCompactLayoutToolbarHiddenByDefaultSwitch = findPreference(SharedPreferencesUtils.POST_COMPACT_LAYOUT_TOOLBAR_HIDDEN_BY_DEFAULT);
if (immersiveInterfaceEntryPreference != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
immersiveInterfaceEntryPreference.setVisible(true);
@@ -55,47 +42,5 @@ public class InterfacePreferenceFragment extends PreferenceFragmentCompat {
return true;
});
}
-
- if (defaultPostLayoutSwitch != null) {
- defaultPostLayoutSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
- EventBus.getDefault().post(new ChangeDefaultPostLayoutEvent(Integer.parseInt((String) newValue)));
- return true;
- });
- }
-
- if (showDividerInCompactLayout != null) {
- showDividerInCompactLayout.setOnPreferenceChangeListener((preference, newValue) -> {
- EventBus.getDefault().post(new ShowDividerInCompactLayoutPreferenceEvent((Boolean) newValue));
- return true;
- });
- }
-
- if (showThumbnailOnTheRightInCompactLayout != null) {
- showThumbnailOnTheRightInCompactLayout.setOnPreferenceChangeListener((preference, newValue) -> {
- EventBus.getDefault().post(new ShowThumbnailOnTheRightInCompactLayoutEvent((Boolean) newValue));
- return true;
- });
- }
-
- if (showAbsoluteNumberOfVotes != null) {
- showAbsoluteNumberOfVotes.setOnPreferenceChangeListener((preference, newValue) -> {
- EventBus.getDefault().post(new ChangeShowAbsoluteNumberOfVotesEvent((Boolean) newValue));
- return true;
- });
- }
-
- if (longPressToHideToolbarInCompactLayoutSwitch != null) {
- longPressToHideToolbarInCompactLayoutSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
- EventBus.getDefault().post(new ChangeLongPressToHideToolbarInCompactLayoutEvent((Boolean) newValue));
- return true;
- });
- }
-
- if (postCompactLayoutToolbarHiddenByDefaultSwitch != null) {
- postCompactLayoutToolbarHiddenByDefaultSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
- EventBus.getDefault().post(new ChangeCompactLayoutToolbarHiddenByDefaultEvent((Boolean) newValue));
- return true;
- });
- }
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/PostPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/PostPreferenceFragment.java
new file mode 100644
index 00000000..08011d3a
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/PostPreferenceFragment.java
@@ -0,0 +1,75 @@
+package ml.docilealligator.infinityforreddit.settings;
+
+import android.os.Bundle;
+
+import androidx.preference.ListPreference;
+import androidx.preference.PreferenceFragmentCompat;
+import androidx.preference.SwitchPreference;
+
+import org.greenrobot.eventbus.EventBus;
+
+import ml.docilealligator.infinityforreddit.R;
+import ml.docilealligator.infinityforreddit.events.ChangeCompactLayoutToolbarHiddenByDefaultEvent;
+import ml.docilealligator.infinityforreddit.events.ChangeDefaultPostLayoutEvent;
+import ml.docilealligator.infinityforreddit.events.ChangeLongPressToHideToolbarInCompactLayoutEvent;
+import ml.docilealligator.infinityforreddit.events.ChangeShowAbsoluteNumberOfVotesEvent;
+import ml.docilealligator.infinityforreddit.events.ShowDividerInCompactLayoutPreferenceEvent;
+import ml.docilealligator.infinityforreddit.events.ShowThumbnailOnTheRightInCompactLayoutEvent;
+import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
+
+public class PostPreferenceFragment extends PreferenceFragmentCompat {
+
+ @Override
+ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
+ setPreferencesFromResource(R.xml.post_preferences, rootKey);
+
+ ListPreference defaultPostLayoutSwitch = findPreference(SharedPreferencesUtils.DEFAULT_POST_LAYOUT_KEY);
+ SwitchPreference showDividerInCompactLayout = findPreference(SharedPreferencesUtils.SHOW_DIVIDER_IN_COMPACT_LAYOUT);
+ SwitchPreference showThumbnailOnTheRightInCompactLayout = findPreference(SharedPreferencesUtils.SHOW_THUMBNAIL_ON_THE_LEFT_IN_COMPACT_LAYOUT);
+ SwitchPreference showAbsoluteNumberOfVotes = findPreference(SharedPreferencesUtils.SHOW_ABSOLUTE_NUMBER_OF_VOTES);
+ SwitchPreference longPressToHideToolbarInCompactLayoutSwitch = findPreference(SharedPreferencesUtils.LONG_PRESS_TO_HIDE_TOOLBAR_IN_COMPACT_LAYOUT);
+ SwitchPreference postCompactLayoutToolbarHiddenByDefaultSwitch = findPreference(SharedPreferencesUtils.POST_COMPACT_LAYOUT_TOOLBAR_HIDDEN_BY_DEFAULT);
+
+ if (defaultPostLayoutSwitch != null) {
+ defaultPostLayoutSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
+ EventBus.getDefault().post(new ChangeDefaultPostLayoutEvent(Integer.parseInt((String) newValue)));
+ return true;
+ });
+ }
+
+ if (showDividerInCompactLayout != null) {
+ showDividerInCompactLayout.setOnPreferenceChangeListener((preference, newValue) -> {
+ EventBus.getDefault().post(new ShowDividerInCompactLayoutPreferenceEvent((Boolean) newValue));
+ return true;
+ });
+ }
+
+ if (showThumbnailOnTheRightInCompactLayout != null) {
+ showThumbnailOnTheRightInCompactLayout.setOnPreferenceChangeListener((preference, newValue) -> {
+ EventBus.getDefault().post(new ShowThumbnailOnTheRightInCompactLayoutEvent((Boolean) newValue));
+ return true;
+ });
+ }
+
+ if (showAbsoluteNumberOfVotes != null) {
+ showAbsoluteNumberOfVotes.setOnPreferenceChangeListener((preference, newValue) -> {
+ EventBus.getDefault().post(new ChangeShowAbsoluteNumberOfVotesEvent((Boolean) newValue));
+ return true;
+ });
+ }
+
+ if (longPressToHideToolbarInCompactLayoutSwitch != null) {
+ longPressToHideToolbarInCompactLayoutSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
+ EventBus.getDefault().post(new ChangeLongPressToHideToolbarInCompactLayoutEvent((Boolean) newValue));
+ return true;
+ });
+ }
+
+ if (postCompactLayoutToolbarHiddenByDefaultSwitch != null) {
+ postCompactLayoutToolbarHiddenByDefaultSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
+ EventBus.getDefault().post(new ChangeCompactLayoutToolbarHiddenByDefaultEvent((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 94127163..26c64308 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java
@@ -79,6 +79,10 @@ public class SharedPreferencesUtils {
public static final String SHOW_THUMBNAIL_ON_THE_LEFT_IN_COMPACT_LAYOUT = "show_thumbnail_on_the_left_in_compact_layout";
public static final String NUMBER_OF_COLUMNS_IN_POST_FEED_PORTRAIT = "number_of_columns_in_post_feed_portrait";
public static final String NUMBER_OF_COLUMNS_IN_POST_FEED_LANDSCAPE = "number_of_columns_in_post_feed_landscape";
+ public static final String NUMBER_OF_COLUMNS_IN_POST_FEED_PORTRAIT_COMPACT_LAYOUT = "number_of_columns_in_post_feed_portrait_compact_layout";
+ public static final String NUMBER_OF_COLUMNS_IN_POST_FEED_LANDSCAPE_COMPACT_LAYOUT = "number_of_columns_in_post_feed_landscape_compact_layout";
+ public static final String NUMBER_OF_COLUMNS_IN_POST_FEED_PORTRAIT_GALLERY_LAYOUT = "number_of_columns_in_post_feed_portrait_gallery_layout";
+ public static final String NUMBER_OF_COLUMNS_IN_POST_FEED_LANDSCAPE_GALLERY_LAYOUT = "number_of_columns_in_post_feed_landscape_gallery_layout";
public static final String SWIPE_RIGHT_TO_GO_BACK = "swipe_to_go_back_from_post_detail";
public static final String VOLUME_KEYS_NAVIGATE_COMMENTS = "volume_keys_navigate_comments";
public static final String VOLUME_KEYS_NAVIGATE_POSTS = "volume_keys_navigate_posts";
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 0f073b9b..57b528e7 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1020,5 +1020,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>
</resources>
diff --git a/app/src/main/res/xml/comment_preferences.xml b/app/src/main/res/xml/comment_preferences.xml
new file mode 100644
index 00000000..2248d7f3
--- /dev/null
+++ b/app/src/main/res/xml/comment_preferences.xml
@@ -0,0 +1,30 @@
+<?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="false"
+ app:key="show_top_level_comments_first"
+ app:title="@string/settings_show_top_level_comments_first_title" />
+
+ <SwitchPreference
+ app:defaultValue="false"
+ app:key="show_comment_divider"
+ app:title="@string/settings_show_comment_divider_title" />
+
+ <SwitchPreference
+ app:defaultValue="false"
+ app:key="comment_toolbar_hidden"
+ app:title="@string/settings_comment_toolbar_hidden" />
+
+ <SwitchPreference
+ app:defaultValue="true"
+ app:key="comment_toolbar_hide_on_click"
+ app:title="@string/settings_comment_toolbar_hide_on_click" />
+
+ <SwitchPreference
+ app:defaultValue="false"
+ app:key="fully_collapse_comment"
+ android:title="@string/settings_fully_collapse_comment_title" />
+
+</PreferenceScreen> \ No newline at end of file
diff --git a/app/src/main/res/xml/gestures_and_buttons_preference.xml b/app/src/main/res/xml/gestures_and_buttons_preferences.xml
index 02a37524..02a37524 100644
--- a/app/src/main/res/xml/gestures_and_buttons_preference.xml
+++ b/app/src/main/res/xml/gestures_and_buttons_preferences.xml
diff --git a/app/src/main/res/xml/interface_preference.xml b/app/src/main/res/xml/interface_preference.xml
deleted file mode 100644
index b55853c1..00000000
--- a/app/src/main/res/xml/interface_preference.xml
+++ /dev/null
@@ -1,117 +0,0 @@
-<?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">
-
- <Preference
- app:title="@string/settings_font_title"
- app:icon="@drawable/ic_font_size_24dp"
- app:fragment="ml.docilealligator.infinityforreddit.settings.FontPreferenceFragment" />
-
- <Preference
- app:key="immersive_interface_entry"
- app:title="@string/settings_immersive_interface_title"
- app:fragment="ml.docilealligator.infinityforreddit.settings.ImmersiveInterfacePreferenceFragment"
- app:isPreferenceVisible="false" />
-
- <Preference
- app:title="@string/settings_customize_tabs_in_main_page_title"
- app:summary="@string/only_for_logged_in_user"
- app:fragment="ml.docilealligator.infinityforreddit.settings.CustomizeMainPageTabsFragment" />
-
- <Preference
- app:title="@string/settings_customize_bottom_app_bar_title"
- app:summary="@string/only_for_logged_in_user"
- app:fragment="ml.docilealligator.infinityforreddit.settings.CustomizeBottomAppBarFragment" />
-
- <SwitchPreference
- app:defaultValue="false"
- app:key="bottom_app_bar"
- app:title="@string/settings_enable_bottom_app_bar_title"
- app:summary="@string/settings_enable_bottom_app_bar_summary" />
-
- <Preference
- app:title="@string/settings_time_format_title"
- app:fragment="ml.docilealligator.infinityforreddit.settings.TimeFormatPreferenceFragment" />
-
- <SwitchPreference
- app:defaultValue="false"
- app:key="hide_subreddit_description"
- app:title="@string/settings_hide_subreddit_description_title" />
-
- <PreferenceCategory
- app:title="@string/settings_category_post_and_comment_title" />
-
- <SwitchPreference
- app:defaultValue="false"
- app:key="vote_buttons_on_the_right"
- app:title="@string/settings_vote_buttons_on_the_right_title" />
-
- <SwitchPreference
- app:defaultValue="true"
- app:key="show_absolute_number_of_votes"
- app:title="@string/settings_show_absolute_number_of_votes_title" />
-
- <PreferenceCategory
- app:title="@string/settings_category_post_title" />
-
- <ListPreference
- app:defaultValue="0"
- android:entries="@array/settings_default_post_layout"
- app:entryValues="@array/settings_default_post_layout_values"
- app:key="default_post_layout"
- app:title="@string/settings_default_post_layout"
- app:useSimpleSummaryProvider="true" />
-
- <SwitchPreference
- app:defaultValue="true"
- app:key="show_divider_in_compact_layout"
- app:title="@string/settings_show_divider_in_compact_layout" />
-
- <SwitchPreference
- app:defaultValue="false"
- app:key="show_thumbnail_on_the_left_in_compact_layout"
- app:title="@string/settings_show_thumbnail_on_the_left_in_compact_layout" />
-
- <SwitchPreference
- app:defaultValue="false"
- app:key="long_press_to_hide_toolbar_in_compact_layout"
- app:title="@string/settings_long_press_to_hide_toolbar_in_compact_layout_title" />
-
- <SwitchPreference
- app:defaultValue="false"
- app:key="post_compact_layout_toolbar_hidden_by_default"
- app:title="@string/settings_post_compact_layout_toolbar_hidden_by_default_title" />
-
- <Preference
- app:title="@string/settings_number_of_columns_in_post_feed_title"
- app:fragment="ml.docilealligator.infinityforreddit.settings.NumberOfColumnsInPostFeedPreferenceFragment" />
-
- <PreferenceCategory
- app:title="@string/settings_category_comment_title" />
-
- <SwitchPreference
- app:defaultValue="false"
- app:key="show_top_level_comments_first"
- app:title="@string/settings_show_top_level_comments_first_title" />
-
- <SwitchPreference
- app:defaultValue="false"
- app:key="show_comment_divider"
- app:title="@string/settings_show_comment_divider_title" />
-
- <SwitchPreference
- app:defaultValue="false"
- app:key="comment_toolbar_hidden"
- app:title="@string/settings_comment_toolbar_hidden" />
-
- <SwitchPreference
- app:defaultValue="true"
- app:key="comment_toolbar_hide_on_click"
- app:title="@string/settings_comment_toolbar_hide_on_click" />
-
- <SwitchPreference
- app:defaultValue="false"
- app:key="fully_collapse_comment"
- android:title="@string/settings_fully_collapse_comment_title" />
-
-</PreferenceScreen> \ No newline at end of file
diff --git a/app/src/main/res/xml/interface_preferences.xml b/app/src/main/res/xml/interface_preferences.xml
new file mode 100644
index 00000000..d6f8dc68
--- /dev/null
+++ b/app/src/main/res/xml/interface_preferences.xml
@@ -0,0 +1,62 @@
+<?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">
+
+ <Preference
+ app:title="@string/settings_font_title"
+ app:icon="@drawable/ic_font_size_24dp"
+ app:fragment="ml.docilealligator.infinityforreddit.settings.FontPreferenceFragment" />
+
+ <Preference
+ app:key="immersive_interface_entry"
+ app:title="@string/settings_immersive_interface_title"
+ app:fragment="ml.docilealligator.infinityforreddit.settings.ImmersiveInterfacePreferenceFragment"
+ app:isPreferenceVisible="false" />
+
+ <Preference
+ app:title="@string/settings_customize_tabs_in_main_page_title"
+ app:summary="@string/only_for_logged_in_user"
+ app:fragment="ml.docilealligator.infinityforreddit.settings.CustomizeMainPageTabsFragment" />
+
+ <Preference
+ app:title="@string/settings_customize_bottom_app_bar_title"
+ app:summary="@string/only_for_logged_in_user"
+ app:fragment="ml.docilealligator.infinityforreddit.settings.CustomizeBottomAppBarFragment" />
+
+ <SwitchPreference
+ app:defaultValue="false"
+ app:key="bottom_app_bar"
+ app:title="@string/settings_enable_bottom_app_bar_title"
+ app:summary="@string/settings_enable_bottom_app_bar_summary" />
+
+ <Preference
+ app:title="@string/settings_time_format_title"
+ app:fragment="ml.docilealligator.infinityforreddit.settings.TimeFormatPreferenceFragment" />
+
+ <SwitchPreference
+ app:defaultValue="false"
+ app:key="hide_subreddit_description"
+ app:title="@string/settings_hide_subreddit_description_title" />
+
+ <Preference
+ app:title="@string/settings_category_post_title"
+ app:fragment="ml.docilealligator.infinityforreddit.settings.PostPreferenceFragment" />
+
+ <Preference
+ app:title="@string/settings_category_comment_title"
+ app:fragment="ml.docilealligator.infinityforreddit.settings.CommentPreferenceFragment" />
+
+ <PreferenceCategory
+ app:title="@string/settings_category_post_and_comment_title" />
+
+ <SwitchPreference
+ app:defaultValue="false"
+ app:key="vote_buttons_on_the_right"
+ app:title="@string/settings_vote_buttons_on_the_right_title" />
+
+ <SwitchPreference
+ app:defaultValue="true"
+ app:key="show_absolute_number_of_votes"
+ app:title="@string/settings_show_absolute_number_of_votes_title" />
+
+</PreferenceScreen> \ No newline at end of file
diff --git a/app/src/main/res/xml/number_of_columns_in_post_feed_preferences.xml b/app/src/main/res/xml/number_of_columns_in_post_feed_preferences.xml
index 356058da..5e91acff 100644
--- a/app/src/main/res/xml/number_of_columns_in_post_feed_preferences.xml
+++ b/app/src/main/res/xml/number_of_columns_in_post_feed_preferences.xml
@@ -1,12 +1,14 @@
<?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">
+
<Preference
android:icon="@drawable/ic_info_preference_24dp"
app:summary="@string/restart_app_see_changes"
app:enabled="false" />
- <PreferenceCategory />
+ <PreferenceCategory
+ android:title="@string/post_layout_card" />
<ListPreference
app:defaultValue="1"
@@ -23,4 +25,43 @@
app:key="number_of_columns_in_post_feed_landscape"
app:title="@string/settings_number_of_columns_in_post_feed_landscape_title"
app:useSimpleSummaryProvider="true" />
+
+ <PreferenceCategory
+ android:title="@string/post_layout_compact" />
+
+ <ListPreference
+ app:defaultValue="1"
+ app:entries="@array/settings_number_of_columns_in_post_feed"
+ app:entryValues="@array/settings_number_of_columns_in_post_feed"
+ app:key="number_of_columns_in_post_feed_portrait_compact_layout"
+ app:title="@string/settings_number_of_columns_in_post_feed_portrait_title"
+ app:useSimpleSummaryProvider="true" />
+
+ <ListPreference
+ app:defaultValue="2"
+ app:entries="@array/settings_number_of_columns_in_post_feed"
+ app:entryValues="@array/settings_number_of_columns_in_post_feed"
+ app:key="number_of_columns_in_post_feed_landscape_compact_layout"
+ app:title="@string/settings_number_of_columns_in_post_feed_landscape_title"
+ app:useSimpleSummaryProvider="true" />
+
+ <PreferenceCategory
+ android:title="@string/post_layout_gallery" />
+
+ <ListPreference
+ app:defaultValue="2"
+ app:entries="@array/settings_number_of_columns_in_post_feed"
+ app:entryValues="@array/settings_number_of_columns_in_post_feed"
+ app:key="number_of_columns_in_post_feed_portrait_gallery_layout"
+ app:title="@string/settings_number_of_columns_in_post_feed_portrait_title"
+ app:useSimpleSummaryProvider="true" />
+
+ <ListPreference
+ app:defaultValue="2"
+ app:entries="@array/settings_number_of_columns_in_post_feed"
+ app:entryValues="@array/settings_number_of_columns_in_post_feed"
+ app:key="number_of_columns_in_post_feed_landscape_gallery_layout"
+ app:title="@string/settings_number_of_columns_in_post_feed_landscape_title"
+ app:useSimpleSummaryProvider="true" />
+
</PreferenceScreen> \ No newline at end of file
diff --git a/app/src/main/res/xml/post_preferences.xml b/app/src/main/res/xml/post_preferences.xml
new file mode 100644
index 00000000..4c4b50aa
--- /dev/null
+++ b/app/src/main/res/xml/post_preferences.xml
@@ -0,0 +1,37 @@
+<?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">
+
+ <ListPreference
+ app:defaultValue="0"
+ android:entries="@array/settings_default_post_layout"
+ app:entryValues="@array/settings_default_post_layout_values"
+ app:key="default_post_layout"
+ app:title="@string/settings_default_post_layout"
+ app:useSimpleSummaryProvider="true" />
+
+ <SwitchPreference
+ app:defaultValue="true"
+ app:key="show_divider_in_compact_layout"
+ app:title="@string/settings_show_divider_in_compact_layout" />
+
+ <SwitchPreference
+ app:defaultValue="false"
+ app:key="show_thumbnail_on_the_left_in_compact_layout"
+ app:title="@string/settings_show_thumbnail_on_the_left_in_compact_layout" />
+
+ <SwitchPreference
+ app:defaultValue="false"
+ app:key="long_press_to_hide_toolbar_in_compact_layout"
+ app:title="@string/settings_long_press_to_hide_toolbar_in_compact_layout_title" />
+
+ <SwitchPreference
+ app:defaultValue="false"
+ app:key="post_compact_layout_toolbar_hidden_by_default"
+ app:title="@string/settings_post_compact_layout_toolbar_hidden_by_default_title" />
+
+ <Preference
+ app:title="@string/settings_number_of_columns_in_post_feed_title"
+ app:fragment="ml.docilealligator.infinityforreddit.settings.NumberOfColumnsInPostFeedPreferenceFragment" />
+
+</PreferenceScreen> \ No newline at end of file