diff options
author | Andrew Rasch <raschykid@gmail.com> | 2021-09-27 00:10:12 +0000 |
---|---|---|
committer | Andrew Rasch <raschykid@gmail.com> | 2021-09-27 00:10:12 +0000 |
commit | 0d93d7c9961aa36fc2d86857a4b345d36351cbe6 (patch) | |
tree | d9f0ae99b17a4907d0f8a8862aa0b6942b6947d9 /app/src/main/java/ml | |
parent | 50de5bb44a9ad36a15477ffbc3a7f7eb1c9e9e77 (diff) | |
download | infinity-for-reddit-0d93d7c9961aa36fc2d86857a4b345d36351cbe6.tar infinity-for-reddit-0d93d7c9961aa36fc2d86857a4b345d36351cbe6.tar.gz infinity-for-reddit-0d93d7c9961aa36fc2d86857a4b345d36351cbe6.tar.bz2 infinity-for-reddit-0d93d7c9961aa36fc2d86857a4b345d36351cbe6.tar.lz infinity-for-reddit-0d93d7c9961aa36fc2d86857a4b345d36351cbe6.tar.xz infinity-for-reddit-0d93d7c9961aa36fc2d86857a4b345d36351cbe6.tar.zst infinity-for-reddit-0d93d7c9961aa36fc2d86857a4b345d36351cbe6.zip |
Enable folding phone support for card view
Updated card view to allow for separate column numbers for folded vs unfolded state. Organized strings.xml.
Diffstat (limited to 'app/src/main/java/ml')
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java | 10 | ||||
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java | 3 |
2 files changed, 12 insertions, 1 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 8098dba8..cd066a1f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java @@ -1142,6 +1142,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator { } private int getNColumns(Resources resources) { + final boolean foldEnabled = mSharedPreferences.getBoolean(SharedPreferencesUtils.ENABLE_FOLD_SUPPORT, false); if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { switch (postLayout) { case SharedPreferencesUtils.POST_LAYOUT_CARD_2: @@ -1152,7 +1153,11 @@ public class PostFragment extends Fragment implements FragmentCommunicator { 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")); + if (foldEnabled) { + return Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.NUMBER_OF_COLUMNS_IN_POST_FEED_PORTRAIT_UNFOLDED, "2")); + } else { + 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")); } @@ -1165,6 +1170,9 @@ public class PostFragment extends Fragment implements FragmentCommunicator { case SharedPreferencesUtils.POST_LAYOUT_GALLERY: return Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.NUMBER_OF_COLUMNS_IN_POST_FEED_LANDSCAPE_GALLERY_LAYOUT, "2")); default: + if (getResources().getBoolean(R.bool.isTablet) && foldEnabled) { + return Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.NUMBER_OF_COLUMNS_IN_POST_FEED_LANDSCAPE_UNFOLDED, "2")); + } return Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.NUMBER_OF_COLUMNS_IN_POST_FEED_LANDSCAPE, "2")); } } 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 1d5838e1..e1694e47 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java @@ -82,6 +82,8 @@ 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_UNFOLDED = "number_of_columns_in_post_feed_portrait_unfolded"; + public static final String NUMBER_OF_COLUMNS_IN_POST_FEED_LANDSCAPE_UNFOLDED = "number_of_columns_in_post_feed_landscape_unfolded"; 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"; @@ -186,6 +188,7 @@ public class SharedPreferencesUtils { public static final String DEFAULT_LINK_POST_LAYOUT_KEY = "default_link_post_layout"; public static final String USE_BOTTOM_TOOLBAR_IN_MEDIA_VIEWER = "use_bottom_toolbar_in_media_viewer"; public static final String LOCK_SCREEN_ANIMATION = "lock_screen_animation"; + public static final String ENABLE_FOLD_SUPPORT = "enable_fold_support"; 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"; |