aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-07-30 10:00:42 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-07-30 10:00:42 +0000
commit720aa0b6bde98c272878fd22a4f705f5b31183db (patch)
tree87d1b5be0e9009e625ae0d9127061a414ea99ec2
parente660da55f0e133a21861ac11a8f192e5f4812e61 (diff)
downloadinfinity-for-reddit-720aa0b6bde98c272878fd22a4f705f5b31183db.tar
infinity-for-reddit-720aa0b6bde98c272878fd22a4f705f5b31183db.tar.gz
infinity-for-reddit-720aa0b6bde98c272878fd22a4f705f5b31183db.tar.bz2
infinity-for-reddit-720aa0b6bde98c272878fd22a4f705f5b31183db.tar.lz
infinity-for-reddit-720aa0b6bde98c272878fd22a4f705f5b31183db.tar.xz
infinity-for-reddit-720aa0b6bde98c272878fd22a4f705f5b31183db.tar.zst
infinity-for-reddit-720aa0b6bde98c272878fd22a4f705f5b31183db.zip
Prepare to implement customization options for post details page.
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/AppModule.java6
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/settings/PostDetailsPreferenceFragment.java18
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java2
-rw-r--r--app/src/main/res/layout/item_trending_search.xml3
-rw-r--r--app/src/main/res/values/strings.xml1
-rw-r--r--app/src/main/res/xml/interface_preferences.xml4
-rw-r--r--app/src/main/res/xml/post_details_preferences.xml39
7 files changed, 72 insertions, 1 deletions
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
@@ -277,6 +277,12 @@ class AppModule {
}
@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,
@Named("dark_theme") SharedPreferences darkThemeSharedPreferences,
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" />
</com.google.android.material.card.MaterialCardView> \ 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 @@
<string name="settings_show_only_one_comment_level_indicator">Show Only One Comment Level Indicator</string>
<string name="settings_video_player_automatic_landscape_orientation">Switch to Landscape Orientation in Video Player Automatically</string>
<string name="settings_remember_muting_option_in_post_feed">Remember Muting Option in Post Feed</string>
+ <string name="settings_post_details_title">Post Details</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 201b13cd..47207d0a 100644
--- a/app/src/main/res/xml/interface_preferences.xml
+++ b/app/src/main/res/xml/interface_preferences.xml
@@ -54,6 +54,10 @@
app:fragment="ml.docilealligator.infinityforreddit.settings.PostPreferenceFragment" />
<Preference
+ app:title="@string/settings_post_details_title"
+ app:fragment="ml.docilealligator.infinityforreddit.settings.PostDetailsPreferenceFragment" />
+
+ <Preference
app:title="@string/settings_category_comment_title"
app:fragment="ml.docilealligator.infinityforreddit.settings.CommentPreferenceFragment" />
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 @@
+<?xml version="1.0" encoding="utf-8"?>
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto">
+
+ <!--<Preference
+ app:title="@string/settings_number_of_columns_in_post_feed_title"
+ app:fragment="ml.docilealligator.infinityforreddit.settings.NumberOfColumnsInPostFeedPreferenceFragment" />-->
+
+ <SwitchPreference
+ app:defaultValue="false"
+ app:key="hide_post_type"
+ app:title="@string/settings_hide_post_type" />
+
+ <SwitchPreference
+ app:defaultValue="false"
+ app:key="hide_post_flair"
+ app:title="@string/settings_hide_post_flair" />
+
+ <SwitchPreference
+ app:defaultValue="false"
+ app:key="hide_the_number_of_awards"
+ app:title="@string/settings_hide_the_number_of_awards" />
+
+ <SwitchPreference
+ app:defaultValue="false"
+ app:key="hide_subreddit_and_user_prefix"
+ app:title="@string/settings_hide_subreddit_and_user_prefix" />
+
+ <SwitchPreference
+ app:defaultValue="false"
+ app:key="hide_the_number_of_votes"
+ app:title="@string/settings_hide_the_number_of_votes" />
+
+ <SwitchPreference
+ app:defaultValue="false"
+ app:key="hide_the_number_of_comments"
+ app:title="@string/settings_hide_the_number_of_comments" />
+
+</PreferenceScreen> \ No newline at end of file