aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2020-11-06 14:39:53 +0000
committerAlex Ning <chineseperson5@gmail.com>2020-11-06 14:39:53 +0000
commit7e446c9fcb3e94e75d3a20ccc8575aa7fde76887 (patch)
treecfd6a7d0672a426abc6b5ae7119c6369183b58c0 /app/src/main
parent4a67e0263962561be3fbaae5652a37fc73b9e7f2 (diff)
downloadinfinity-for-reddit-7e446c9fcb3e94e75d3a20ccc8575aa7fde76887.tar
infinity-for-reddit-7e446c9fcb3e94e75d3a20ccc8575aa7fde76887.tar.gz
infinity-for-reddit-7e446c9fcb3e94e75d3a20ccc8575aa7fde76887.tar.bz2
infinity-for-reddit-7e446c9fcb3e94e75d3a20ccc8575aa7fde76887.tar.lz
infinity-for-reddit-7e446c9fcb3e94e75d3a20ccc8575aa7fde76887.tar.xz
infinity-for-reddit-7e446c9fcb3e94e75d3a20ccc8575aa7fde76887.tar.zst
infinity-for-reddit-7e446c9fcb3e94e75d3a20ccc8575aa7fde76887.zip
Hiding subreddit description is available.
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java2
-rw-r--r--app/src/main/res/values/strings.xml1
-rw-r--r--app/src/main/res/xml/interface_preference.xml5
4 files changed, 9 insertions, 2 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java
index b5310569..857392ef 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java
@@ -313,6 +313,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
showBottomAppBar = mSharedPreferences.getBoolean(SharedPreferencesUtils.BOTTOM_APP_BAR_KEY, false);
lockBottomAppBar = mSharedPreferences.getBoolean(SharedPreferencesUtils.LOCK_BOTTOM_APP_BAR, false);
+ boolean hideSubredditDescription = mSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_SUBREDDIT_DESCRIPTION, false);
subredditName = getIntent().getStringExtra(EXTRA_SUBREDDIT_NAME_KEY);
@@ -420,7 +421,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
nSubscribersTextView.setText(nSubscribers);
creationTimeTextView.setText(new SimpleDateFormat("MMM d, yyyy",
locale).format(subredditData.getCreatedUTC()));
- if (subredditData.getDescription().equals("")) {
+ if (hideSubredditDescription || subredditData.getDescription().equals("")) {
descriptionTextView.setVisibility(View.GONE);
} else {
descriptionTextView.setVisibility(View.VISIBLE);
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 c50de17c..5a85e10c 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java
@@ -138,7 +138,7 @@ public class SharedPreferencesUtils {
public static final String RESPECT_SUBREDDIT_RECOMMENDED_COMMENT_SORT_TYPE = "respect_subreddit_recommended_comment_sort_type";
public static final String SUBREDDIT_FILTER_POPULAR_AND_ALL = "subreddit_filter_popular_and_all";
public static final String UFO_CAPTURING_ANIMATION = "ufo_capturing_animation";
-
+ public static final String HIDE_SUBREDDIT_DESCRIPTION = "hide_subreddit_description";
public static final String MAIN_PAGE_TABS_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.main_page_tabs";
public static final String MAIN_PAGE_TAB_COUNT = "_main_page_tab_count";
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 3f293049..9041a5d1 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -502,6 +502,7 @@
<string name="settings_subreddit_filter_category">Hide Subreddits</string>
<string name="settings_subreddit_filter_popular_and_all">In r/popular and r/all</string>
<string name="settings_credits_ufo_capturing_animation_title">UFO Capturing Animation</string>
+ <string name="settings_hide_subreddit_description_title">Hide Subreddit Description</string>
<string name="no_link_available">Cannot get the link</string>
diff --git a/app/src/main/res/xml/interface_preference.xml b/app/src/main/res/xml/interface_preference.xml
index 0b767200..7e2fec08 100644
--- a/app/src/main/res/xml/interface_preference.xml
+++ b/app/src/main/res/xml/interface_preference.xml
@@ -33,6 +33,11 @@
app:title="@string/settings_time_format_title"
app:fragment="ml.docilealligator.infinityforreddit.Settings.TimeFormatPreferenceFragment" />
+ <SwitchPreference
+ app:defaultValue="false"
+ app:key="hide_subreddit_description"
+ app:title="@string/settings_hide_subreddit_description_title" />
+
<PreferenceCategory
app:title="@string/settings_category_post_and_comment_title" />