diff options
Diffstat (limited to 'app/src/main')
4 files changed, 94 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 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"; diff --git a/app/src/main/res/xml-sw600dp/number_of_columns_in_post_feed_preferences.xml b/app/src/main/res/xml-sw600dp/number_of_columns_in_post_feed_preferences.xml index 4a61e4fc..3114805a 100644 --- a/app/src/main/res/xml-sw600dp/number_of_columns_in_post_feed_preferences.xml +++ b/app/src/main/res/xml-sw600dp/number_of_columns_in_post_feed_preferences.xml @@ -1,7 +1,15 @@ <?xml version="1.0" encoding="utf-8"?> <PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto"> + <Preference + app:icon="@drawable/ic_info_preference_24dp" + app:summary="@string/restart_app_see_changes" + app:enabled="false" /> + + <PreferenceCategory + app:title="@string/post_layout_card" /> + <ListPreference - app:defaultValue="2" + 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" @@ -15,4 +23,61 @@ 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 + app:title="@string/post_layout_card_2" /> + + <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_card_layout_2" + 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_card_layout_2" + app:title="@string/settings_number_of_columns_in_post_feed_landscape_title" + app:useSimpleSummaryProvider="true" /> + + <PreferenceCategory + app: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 + app: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/number_of_columns_in_post_feed_preferences.xml b/app/src/main/res/xml/number_of_columns_in_post_feed_preferences.xml index 5e91acff..82c54e21 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 @@ -27,6 +27,25 @@ app:useSimpleSummaryProvider="true" /> <PreferenceCategory + android:title="@string/post_layout_card_2" /> + + <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_card_layout_2" + 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_card_layout_2" + app:title="@string/settings_number_of_columns_in_post_feed_landscape_title" + app:useSimpleSummaryProvider="true" /> + + <PreferenceCategory android:title="@string/post_layout_compact" /> <ListPreference |