diff options
author | Alex Ning <chineseperson5@gmail.com> | 2021-03-08 16:02:26 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2021-03-08 16:02:26 +0000 |
commit | 6bdf38b99662961d3a5faab8b01c8abe1e16b607 (patch) | |
tree | e00bee20b20d169946bbf143945da87d379f25e6 /app/src/main/java | |
parent | 916143fd4627bdfdbc3c379e98989196ba1adeb6 (diff) | |
download | infinity-for-reddit-6bdf38b99662961d3a5faab8b01c8abe1e16b607.tar infinity-for-reddit-6bdf38b99662961d3a5faab8b01c8abe1e16b607.tar.gz infinity-for-reddit-6bdf38b99662961d3a5faab8b01c8abe1e16b607.tar.bz2 infinity-for-reddit-6bdf38b99662961d3a5faab8b01c8abe1e16b607.tar.lz infinity-for-reddit-6bdf38b99662961d3a5faab8b01c8abe1e16b607.tar.xz infinity-for-reddit-6bdf38b99662961d3a5faab8b01c8abe1e16b607.tar.zst infinity-for-reddit-6bdf38b99662961d3a5faab8b01c8abe1e16b607.zip |
The number of columns in card layout 2 is available.
Diffstat (limited to '')
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java | 7 | ||||
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java | 2 |
2 files changed, 9 insertions, 0 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 2a1eabbc..cc7b9bfc 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java @@ -1018,15 +1018,22 @@ public class PostFragment extends Fragment implements FragmentCommunicator { private int getNColumns(Resources resources) { if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { switch (postLayout) { + case SharedPreferencesUtils.POST_LAYOUT_CARD_2: + return Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.NUMBER_OF_COLUMNS_IN_POST_FEED_PORTRAIT_CARD_LAYOUT_2, "1")); 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: + if (getResources().getBoolean(R.bool.isTablet)) { + return Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.NUMBER_OF_COLUMNS_IN_POST_FEED_PORTRAIT, "2")); + } return Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.NUMBER_OF_COLUMNS_IN_POST_FEED_PORTRAIT, "1")); } } else { switch (postLayout) { + case SharedPreferencesUtils.POST_LAYOUT_CARD_2: + return Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.NUMBER_OF_COLUMNS_IN_POST_FEED_LANDSCAPE_CARD_LAYOUT_2, "2")); 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: 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 335256cd..e1089706 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java @@ -174,6 +174,8 @@ public class SharedPreferencesUtils { public static final String SHOW_SUICIDE_PREVENTION_ACTIVITY = "show_suicide_prevention_activity"; public static final String LOVE_ANIMATION = "love_animation"; public static final String SWIPE_BETWEEN_POSTS = "swipe_between_posts"; + public static final String NUMBER_OF_COLUMNS_IN_POST_FEED_PORTRAIT_CARD_LAYOUT_2 = "number_of_columns_in_post_feed_portrait_card_layout_2"; + public static final String NUMBER_OF_COLUMNS_IN_POST_FEED_LANDSCAPE_CARD_LAYOUT_2 = "number_of_columns_in_post_feed_landscape_card_layout_2"; public static final String DEFAULT_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit_preferences"; public static final String MAIN_PAGE_TABS_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.main_page_tabs"; |