From a5a5e6dac24ad08cf57abfcf16551832265fa425 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Sat, 28 Mar 2020 22:43:47 +0800 Subject: Add some advanced preferences which do nothing right now. --- .../Settings/AdvancedPreferenceFragment.java | 26 ++++++++++++++++++++++ .../Utils/SharedPreferencesUtils.java | 4 ++++ app/src/main/res/values/strings.xml | 8 +++++++ app/src/main/res/xml/advanced_preferences.xml | 21 +++++++++++++++++ app/src/main/res/xml/main_preferences.xml | 4 ++++ 5 files changed, 63 insertions(+) create mode 100644 app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AdvancedPreferenceFragment.java create mode 100644 app/src/main/res/xml/advanced_preferences.xml (limited to 'app/src/main') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AdvancedPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AdvancedPreferenceFragment.java new file mode 100644 index 00000000..7af72c72 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AdvancedPreferenceFragment.java @@ -0,0 +1,26 @@ +package ml.docilealligator.infinityforreddit.Settings; + +import android.os.Bundle; + +import androidx.fragment.app.Fragment; +import androidx.preference.Preference; +import androidx.preference.PreferenceFragmentCompat; + +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; + +/** + * A simple {@link Fragment} subclass. + */ +public class AdvancedPreferenceFragment extends PreferenceFragmentCompat { + + @Override + public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { + setPreferencesFromResource(R.xml.advanced_preferences, rootKey); + + Preference deleteSubredditsPreference = findPreference(SharedPreferencesUtils.DELETE_ALL_SUBREDDITS_DATA_IN_DATABASE); + Preference deleteUsersPreference = findPreference(SharedPreferencesUtils.DELETE_ALL_USERS_DATA_IN_DATABASE); + Preference deleteSortTypePreference = findPreference(SharedPreferencesUtils.DELETE_ALL_SORT_TYPE_DATA_IN_DATABASE); + Preference deletePostLaoutPreference = findPreference(SharedPreferencesUtils.DELETE_ALL_POST_LAYOUT_DATA_IN_DATABASE); + } +} 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 11613fdb..c10b83fc 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java @@ -81,4 +81,8 @@ public class SharedPreferencesUtils { public static final String CUSTOMIZE_DARK_THEME = "customize_dark_theme"; public static final String CUSTOMIZE_AMOLED_THEME = "customize_amoled_theme"; public static final String MANAGE_THEMES = "manage_themes"; + public static final String DELETE_ALL_SUBREDDITS_DATA_IN_DATABASE= "delete_all_subreddits_data_in_database"; + public static final String DELETE_ALL_USERS_DATA_IN_DATABASE= "delete_all_users_data_in_database"; + public static final String DELETE_ALL_SORT_TYPE_DATA_IN_DATABASE= "delete_all_sort_type_data_in_database"; + public static final String DELETE_ALL_POST_LAYOUT_DATA_IN_DATABASE= "delete_all_post_layout_data_in_database"; } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a28dfd34..45de4c40 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -366,6 +366,11 @@ Amoled Theme Manage Themes Custom themes cannot be applied to settings page (except toolbar, status bar and navigation bar). + Advanced + Delete All Subreddits in Database + Delete All Users in Database + Delete All Sort Type in Database + Delete All Post Layout Data in Database Cannot get the link @@ -638,4 +643,7 @@ Color Picker Invalid Color + + Hello blank fragment + diff --git a/app/src/main/res/xml/advanced_preferences.xml b/app/src/main/res/xml/advanced_preferences.xml new file mode 100644 index 00000000..f16e572d --- /dev/null +++ b/app/src/main/res/xml/advanced_preferences.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/xml/main_preferences.xml b/app/src/main/res/xml/main_preferences.xml index 3afc2f8b..8622a87f 100644 --- a/app/src/main/res/xml/main_preferences.xml +++ b/app/src/main/res/xml/main_preferences.xml @@ -66,6 +66,10 @@ app:key="blur_spoiler" app:title="@string/settings_blur_spoiler_title" /> + + -- cgit v1.2.3