From 720aa0b6bde98c272878fd22a4f705f5b31183db Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Fri, 30 Jul 2021 18:00:42 +0800 Subject: Prepare to implement customization options for post details page. --- .../infinityforreddit/AppModule.java | 6 ++++ .../settings/PostDetailsPreferenceFragment.java | 18 ++++++++++ .../utils/SharedPreferencesUtils.java | 2 ++ app/src/main/res/layout/item_trending_search.xml | 3 +- app/src/main/res/values/strings.xml | 1 + app/src/main/res/xml/interface_preferences.xml | 4 +++ app/src/main/res/xml/post_details_preferences.xml | 39 ++++++++++++++++++++++ 7 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 app/src/main/java/ml/docilealligator/infinityforreddit/settings/PostDetailsPreferenceFragment.java create mode 100644 app/src/main/res/xml/post_details_preferences.xml (limited to 'app/src') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AppModule.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AppModule.java index 435969a0..49120eca 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/AppModule.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AppModule.java @@ -276,6 +276,12 @@ class AppModule { return mApplication.getSharedPreferences(SharedPreferencesUtils.NAVIGATION_DRAWER_SHARED_PREFERENCES_FILE, Context.MODE_PRIVATE); } + @Provides + @Named("post_details") + SharedPreferences providePostDetailsSharedPreferences() { + return mApplication.getSharedPreferences(SharedPreferencesUtils.POST_DETAILS_SHARED_PREFERENCES_FILE, Context.MODE_PRIVATE); + } + @Provides @Singleton CustomThemeWrapper provideCustomThemeWrapper(@Named("light_theme") SharedPreferences lightThemeSharedPreferences, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/PostDetailsPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/PostDetailsPreferenceFragment.java new file mode 100644 index 00000000..2e0db830 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/PostDetailsPreferenceFragment.java @@ -0,0 +1,18 @@ +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 PostDetailsPreferenceFragment extends PreferenceFragmentCompat { + @Override + public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { + PreferenceManager preferenceManager = getPreferenceManager(); + preferenceManager.setSharedPreferencesName(SharedPreferencesUtils.POST_DETAILS_SHARED_PREFERENCES_FILE); + setPreferencesFromResource(R.xml.post_details_preferences, rootKey); + } +} 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 470aad37..c1fe0797 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java @@ -319,6 +319,8 @@ public class SharedPreferencesUtils { public static final String HIDE_FAVORITE_SUBREDDITS_SECTION = "hide_favorite_subreddits_sections"; public static final String HIDE_SUBSCRIBED_SUBREDDITS_SECTIONS = "hide_subscribed_subreddits_sections"; + public static final String POST_DETAILS_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.post_details"; + //Legacy Settings public static final String MAIN_PAGE_TAB_1_TITLE_LEGACY = "main_page_tab_1_title"; public static final String MAIN_PAGE_TAB_2_TITLE_LEGACY = "main_page_tab_2_title"; diff --git a/app/src/main/res/layout/item_trending_search.xml b/app/src/main/res/layout/item_trending_search.xml index 8227b938..d1cdbded 100644 --- a/app/src/main/res/layout/item_trending_search.xml +++ b/app/src/main/res/layout/item_trending_search.xml @@ -69,6 +69,7 @@ android:maxLines="2" android:textColor="#FFFFFF" android:textSize="?attr/title_font_20" - android:fontFamily="?attr/title_font_family" /> + android:fontFamily="?attr/title_font_family" + android:textStyle="bold" /> \ 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 b0cf0dde..522701ce 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -588,6 +588,7 @@ Show Only One Comment Level Indicator Switch to Landscape Orientation in Video Player Automatically Remember Muting Option in Post Feed + Post Details 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 201b13cd..47207d0a 100644 --- a/app/src/main/res/xml/interface_preferences.xml +++ b/app/src/main/res/xml/interface_preferences.xml @@ -53,6 +53,10 @@ app:title="@string/settings_category_post_title" app:fragment="ml.docilealligator.infinityforreddit.settings.PostPreferenceFragment" /> + + diff --git a/app/src/main/res/xml/post_details_preferences.xml b/app/src/main/res/xml/post_details_preferences.xml new file mode 100644 index 00000000..48e1ffbd --- /dev/null +++ b/app/src/main/res/xml/post_details_preferences.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3