mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-07 03:07:26 +01:00
Enable folding phone support for card view
Updated card view to allow for separate column numbers for folded vs unfolded state. Organized strings.xml.
This commit is contained in:
parent
50de5bb44a
commit
0d93d7c996
@ -1142,6 +1142,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int getNColumns(Resources resources) {
|
private int getNColumns(Resources resources) {
|
||||||
|
final boolean foldEnabled = mSharedPreferences.getBoolean(SharedPreferencesUtils.ENABLE_FOLD_SUPPORT, false);
|
||||||
if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
|
if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||||
switch (postLayout) {
|
switch (postLayout) {
|
||||||
case SharedPreferencesUtils.POST_LAYOUT_CARD_2:
|
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"));
|
return Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.NUMBER_OF_COLUMNS_IN_POST_FEED_PORTRAIT_GALLERY_LAYOUT, "2"));
|
||||||
default:
|
default:
|
||||||
if (getResources().getBoolean(R.bool.isTablet)) {
|
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"));
|
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:
|
case SharedPreferencesUtils.POST_LAYOUT_GALLERY:
|
||||||
return Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.NUMBER_OF_COLUMNS_IN_POST_FEED_LANDSCAPE_GALLERY_LAYOUT, "2"));
|
return Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.NUMBER_OF_COLUMNS_IN_POST_FEED_LANDSCAPE_GALLERY_LAYOUT, "2"));
|
||||||
default:
|
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"));
|
return Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.NUMBER_OF_COLUMNS_IN_POST_FEED_LANDSCAPE, "2"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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 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_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_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_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_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_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 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 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 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 DEFAULT_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit_preferences";
|
||||||
public static final String MAIN_PAGE_TABS_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.main_page_tabs";
|
public static final String MAIN_PAGE_TABS_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.main_page_tabs";
|
||||||
|
@ -89,6 +89,7 @@
|
|||||||
<string name="action_delete_logs">Delete Logs</string>
|
<string name="action_delete_logs">Delete Logs</string>
|
||||||
<string name="action_share_rpan_link">Share RPAN Link</string>
|
<string name="action_share_rpan_link">Share RPAN Link</string>
|
||||||
<string name="action_share_post_link">Share Post Link</string>
|
<string name="action_share_post_link">Share Post Link</string>
|
||||||
|
<string name="action_go_to_wiki">Go to Wiki</string>
|
||||||
|
|
||||||
<string name="parse_json_response_error">Error occurred when parsing the JSON response</string>
|
<string name="parse_json_response_error">Error occurred when parsing the JSON response</string>
|
||||||
<string name="retrieve_token_error">Error Retrieving the token</string>
|
<string name="retrieve_token_error">Error Retrieving the token</string>
|
||||||
@ -408,6 +409,8 @@
|
|||||||
<string name="settings_number_of_columns_in_post_feed_title">The Number of Columns in Post Feed</string>
|
<string name="settings_number_of_columns_in_post_feed_title">The Number of Columns in Post Feed</string>
|
||||||
<string name="settings_number_of_columns_in_post_feed_portrait_title">Portrait</string>
|
<string name="settings_number_of_columns_in_post_feed_portrait_title">Portrait</string>
|
||||||
<string name="settings_number_of_columns_in_post_feed_landscape_title">Landscape</string>
|
<string name="settings_number_of_columns_in_post_feed_landscape_title">Landscape</string>
|
||||||
|
<string name="settings_number_of_columns_in_post_feed_unfolded_portrait_title">Portrait (Unfolded)</string>
|
||||||
|
<string name="settings_number_of_columns_in_post_feed_unfolded_landscape_title">Landscape (Unfolded)</string>
|
||||||
<string name="settings_swap_tap_and_long_title">Swap Tap and Long Press in Comments</string>
|
<string name="settings_swap_tap_and_long_title">Swap Tap and Long Press in Comments</string>
|
||||||
<string name="settings_swipe_to_go_back_title">Swipe Right to Go Back</string>
|
<string name="settings_swipe_to_go_back_title">Swipe Right to Go Back</string>
|
||||||
<string name="settings_swipe_to_go_back_summary">Does Not Apply to All Pages</string>
|
<string name="settings_swipe_to_go_back_summary">Does Not Apply to All Pages</string>
|
||||||
@ -1043,6 +1046,7 @@
|
|||||||
<string name="go_to_subreddit">Go to Subreddit</string>
|
<string name="go_to_subreddit">Go to Subreddit</string>
|
||||||
<string name="go_to_user">Go to User</string>
|
<string name="go_to_user">Go to User</string>
|
||||||
<string name="go_to_thing_hint">Name</string>
|
<string name="go_to_thing_hint">Name</string>
|
||||||
|
<string name="go_to_top">Go To Top</string>
|
||||||
<string name="random">Random</string>
|
<string name="random">Random</string>
|
||||||
<string name="random_subreddit">Random Subreddit</string>
|
<string name="random_subreddit">Random Subreddit</string>
|
||||||
<string name="random_nsfw_subreddit">Random NSFW Subreddit</string>
|
<string name="random_nsfw_subreddit">Random NSFW Subreddit</string>
|
||||||
@ -1192,7 +1196,4 @@
|
|||||||
<string name="app_lock_timeout_12_hours">12 hours</string>
|
<string name="app_lock_timeout_12_hours">12 hours</string>
|
||||||
<string name="app_lock_timeout_24_hours">24 hours</string>
|
<string name="app_lock_timeout_24_hours">24 hours</string>
|
||||||
|
|
||||||
<string name="go_to_top">Go To Top</string>
|
|
||||||
<string name="action_go_to_wiki">Go to Wiki</string>
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -5,6 +5,11 @@
|
|||||||
app:summary="@string/restart_app_see_changes"
|
app:summary="@string/restart_app_see_changes"
|
||||||
app:enabled="false" />
|
app:enabled="false" />
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
app:defaultValue="false"
|
||||||
|
app:key="enable_fold_support"
|
||||||
|
app:title="Enable folding phone support" />
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
app:title="@string/post_layout_card" />
|
app:title="@string/post_layout_card" />
|
||||||
|
|
||||||
@ -24,6 +29,24 @@
|
|||||||
app:title="@string/settings_number_of_columns_in_post_feed_landscape_title"
|
app:title="@string/settings_number_of_columns_in_post_feed_landscape_title"
|
||||||
app:useSimpleSummaryProvider="true" />
|
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_portrait_unfolded"
|
||||||
|
app:title="@string/settings_number_of_columns_in_post_feed_unfolded_portrait_title"
|
||||||
|
app:useSimpleSummaryProvider="true"
|
||||||
|
app:dependency="enable_fold_support" />
|
||||||
|
|
||||||
|
<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_unfolded"
|
||||||
|
app:title="@string/settings_number_of_columns_in_post_feed_unfolded_landscape_title"
|
||||||
|
app:useSimpleSummaryProvider="true"
|
||||||
|
app:dependency="enable_fold_support"/>
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
app:title="@string/post_layout_card_2" />
|
app:title="@string/post_layout_card_2" />
|
||||||
|
|
||||||
|
@ -7,6 +7,11 @@
|
|||||||
app:summary="@string/restart_app_see_changes"
|
app:summary="@string/restart_app_see_changes"
|
||||||
app:enabled="false" />
|
app:enabled="false" />
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
app:defaultValue="false"
|
||||||
|
app:key="enable_fold_support"
|
||||||
|
app:title="Enable folding phone support" />
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:title="@string/post_layout_card" />
|
android:title="@string/post_layout_card" />
|
||||||
|
|
||||||
@ -26,6 +31,24 @@
|
|||||||
app:title="@string/settings_number_of_columns_in_post_feed_landscape_title"
|
app:title="@string/settings_number_of_columns_in_post_feed_landscape_title"
|
||||||
app:useSimpleSummaryProvider="true" />
|
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_portrait_unfolded"
|
||||||
|
app:title="@string/settings_number_of_columns_in_post_feed_unfolded_portrait_title"
|
||||||
|
app:useSimpleSummaryProvider="true"
|
||||||
|
app:dependency="enable_fold_support" />
|
||||||
|
|
||||||
|
<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_unfolded"
|
||||||
|
app:title="@string/settings_number_of_columns_in_post_feed_unfolded_landscape_title"
|
||||||
|
app:useSimpleSummaryProvider="true"
|
||||||
|
app:dependency="enable_fold_support"/>
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:title="@string/post_layout_card_2" />
|
android:title="@string/post_layout_card_2" />
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user