mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-01-14 04:07:12 +01:00
The number of columns in card layout 2 is available.
This commit is contained in:
parent
916143fd46
commit
6bdf38b996
@ -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:
|
||||
|
@ -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";
|
||||
|
@ -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>
|
@ -26,6 +26,25 @@
|
||||
app:title="@string/settings_number_of_columns_in_post_feed_landscape_title"
|
||||
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" />
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user