From c0937304ccbd5d44c89ecc2b7674355bc24eb755 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Sun, 14 Mar 2021 21:26:36 +0800 Subject: [PATCH] Add settings for navigation drawer. --- .../NavigationDrawerPreferenceFragment.java | 19 +++++++++++ app/src/main/res/values/strings.xml | 6 ++++ .../main/res/xml/interface_preferences.xml | 4 +++ .../res/xml/navigation_drawer_preferences.xml | 34 +++++++++++++++++++ 4 files changed, 63 insertions(+) create mode 100644 app/src/main/java/ml/docilealligator/infinityforreddit/settings/NavigationDrawerPreferenceFragment.java create mode 100644 app/src/main/res/xml/navigation_drawer_preferences.xml 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 @@ Restore Settings Love Animation Swipe Between Posts + Navigation Drawer + Collapse Account Section + Collapse Post Section + Collapse Preferences Section + Collapse Favorite Subreddits Section + Collapse Subscribed Subreddits Section Cannot get the link 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 @@ -13,6 +13,10 @@ app:fragment="ml.docilealligator.infinityforreddit.settings.ImmersiveInterfacePreferenceFragment" app:isPreferenceVisible="false" /> + + + + + + + + + + + + + + + + + \ No newline at end of file