diff options
author | Alex Ning <chineseperson5@gmail.com> | 2021-03-14 13:26:36 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2021-03-14 13:26:36 +0000 |
commit | c0937304ccbd5d44c89ecc2b7674355bc24eb755 (patch) | |
tree | 59f3e6ef5b7c6bf4291e6ccff6d6a3cb2ad2a6d4 /app/src | |
parent | 5811ca9ff01811d3432583e4875cb4cf309294a0 (diff) | |
download | infinity-for-reddit-c0937304ccbd5d44c89ecc2b7674355bc24eb755.tar infinity-for-reddit-c0937304ccbd5d44c89ecc2b7674355bc24eb755.tar.gz infinity-for-reddit-c0937304ccbd5d44c89ecc2b7674355bc24eb755.tar.bz2 infinity-for-reddit-c0937304ccbd5d44c89ecc2b7674355bc24eb755.tar.lz infinity-for-reddit-c0937304ccbd5d44c89ecc2b7674355bc24eb755.tar.xz infinity-for-reddit-c0937304ccbd5d44c89ecc2b7674355bc24eb755.tar.zst infinity-for-reddit-c0937304ccbd5d44c89ecc2b7674355bc24eb755.zip |
Add settings for navigation drawer.
Diffstat (limited to 'app/src')
4 files changed, 63 insertions, 0 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/NavigationDrawerPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/NavigationDrawerPreferenceFragment.java new file mode 100644 index 00000000..85751e38 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/NavigationDrawerPreferenceFragment.java @@ -0,0 +1,19 @@ +package ml.docilealligator.infinityforreddit.settings; + +import android.os.Bundle; + +import androidx.preference.PreferenceFragmentCompat; +import androidx.preference.PreferenceManager; + +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; + +public class NavigationDrawerPreferenceFragment extends PreferenceFragmentCompat { + + @Override + public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { + PreferenceManager preferenceManager = getPreferenceManager(); + preferenceManager.setSharedPreferencesName(SharedPreferencesUtils.NAVIGATION_DRAWER_SHARED_PREFERENCES_FILE); + setPreferencesFromResource(R.xml.navigation_drawer_preferences, rootKey); + } +}
\ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 414087ae..986e5376 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -547,6 +547,12 @@ <string name="settings_restore_settings_title">Restore Settings</string> <string name="settings_credits_love_animation_title">Love Animation</string> <string name="settings_swipe_between_posts_title">Swipe Between Posts</string> + <string name="settings_navigation_drawer_title">Navigation Drawer</string> + <string name="settings_collapse_account_section_title">Collapse Account Section</string> + <string name="settings_collapse_post_section_title">Collapse Post Section</string> + <string name="settings_collapse_preferences_section_title">Collapse Preferences Section</string> + <string name="settings_collapse_favorite_subreddits_section_title">Collapse Favorite Subreddits Section</string> + <string name="settings_collapse_subscribed_subreddits_section_title">Collapse Subscribed Subreddits Section</string> <string name="no_link_available">Cannot get the link</string> diff --git a/app/src/main/res/xml/interface_preferences.xml b/app/src/main/res/xml/interface_preferences.xml index e40f5b25..1d45da42 100644 --- a/app/src/main/res/xml/interface_preferences.xml +++ b/app/src/main/res/xml/interface_preferences.xml @@ -14,6 +14,10 @@ app:isPreferenceVisible="false" /> <Preference + app:title="@string/settings_navigation_drawer_title" + app:fragment="ml.docilealligator.infinityforreddit.settings.NavigationDrawerPreferenceFragment" /> + + <Preference app:title="@string/settings_customize_tabs_in_main_page_title" app:summary="@string/only_for_logged_in_user" app:fragment="ml.docilealligator.infinityforreddit.settings.CustomizeMainPageTabsFragment" /> diff --git a/app/src/main/res/xml/navigation_drawer_preferences.xml b/app/src/main/res/xml/navigation_drawer_preferences.xml new file mode 100644 index 00000000..4fa0d064 --- /dev/null +++ b/app/src/main/res/xml/navigation_drawer_preferences.xml @@ -0,0 +1,34 @@ +<?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" /> + + <SwitchPreference + app:defaultValue="false" + app:key="collapse_account_section" + app:title="@string/settings_collapse_account_section_title" /> + + <SwitchPreference + app:defaultValue="false" + app:key="collapse_post_section" + app:title="@string/settings_collapse_post_section_title" /> + + <SwitchPreference + app:defaultValue="false" + app:key="collapse_preferences_section" + app:title="@string/settings_collapse_preferences_section_title" /> + + <SwitchPreference + app:defaultValue="false" + app:key="collapse_favorite_subreddits_section" + app:title="@string/settings_collapse_favorite_subreddits_section_title" /> + + <SwitchPreference + app:defaultValue="false" + app:key="collapse_subscribed_subreddits_section" + app:title="@string/settings_collapse_subscribed_subreddits_section_title" /> + +</PreferenceScreen>
\ No newline at end of file |