From 49ffafdfd492ea8e6190e36457813f05311b008d Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Sat, 15 May 2021 08:52:23 +0800 Subject: Hiding post fliar in PostFragment is now available. --- app/build.gradle | 8 ++++---- .../adapters/PostRecyclerViewAdapter.java | 22 ++++++++++++++++++---- .../events/ChangeHidePostFlairEvent.java | 9 +++++++++ .../infinityforreddit/fragments/PostFragment.java | 9 +++++++++ .../settings/PostPreferenceFragment.java | 9 +++++++++ .../utils/SharedPreferencesUtils.java | 1 + app/src/main/res/values/strings.xml | 1 + app/src/main/res/xml/post_preferences.xml | 5 +++++ 8 files changed, 56 insertions(+), 8 deletions(-) create mode 100644 app/src/main/java/ml/docilealligator/infinityforreddit/events/ChangeHidePostFlairEvent.java diff --git a/app/build.gradle b/app/build.gradle index 8541e228..9cf2874c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -79,16 +79,16 @@ dependencies { // Reactive stuff for event and async related implementation 'io.reactivex.rxjava2:rxandroid:2.1.1' - implementation 'io.reactivex.rxjava2:rxjava:2.2.20' + implementation 'io.reactivex.rxjava2:rxjava:2.2.21' // HTTP clients def retrofitVersion = "2.9.0" implementation "com.squareup.retrofit2:retrofit:$retrofitVersion" implementation "com.squareup.retrofit2:converter-scalars:$retrofitVersion" - implementation 'com.squareup.okhttp3:okhttp:4.2.2' + implementation 'com.squareup.okhttp3:okhttp:4.9.1' // Dependency injection - def daggerVersion = "2.30.1" + def daggerVersion = "2.34" implementation "com.google.dagger:dagger:$daggerVersion" annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion" @@ -120,7 +120,7 @@ dependencies { /**** User Interface (frontend) ****/ //Image loading - def glideVersion = "4.11.0" + def glideVersion = "4.12.0" implementation "com.github.bumptech.glide:glide:$glideVersion" annotationProcessor "com.github.bumptech.glide:compiler:$glideVersion" implementation 'jp.wasabeef:glide-transformations:4.3.0' diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java index 95be0ca5..4565a71c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java @@ -210,6 +210,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter 0 && !mHideTheNumberOfAwards) { @@ -1123,8 +1129,12 @@ public class PostRecyclerViewAdapter extends PagedListAdapter 0 && !mHideTheNumberOfAwards) { @@ -1801,6 +1811,10 @@ public class PostRecyclerViewAdapter extends PagedListAdapter { + EventBus.getDefault().post(new ChangeHidePostFlairEvent((Boolean) newValue)); + return true; + }); + } + if (hideTheNumberOfAwardsSwitch != null) { hideTheNumberOfAwardsSwitch.setOnPreferenceChangeListener((preference, newValue) -> { EventBus.getDefault().post(new ChangeHideTheNumberOfAwardsEvent((Boolean) newValue)); 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 1125d71a..3242c63c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java @@ -165,6 +165,7 @@ public class SharedPreferencesUtils { public static final String USER_DEFAULT_SORT_TIME = "user_default_sort_time"; public static final String CLICK_TO_SHOW_MEDIA_IN_GALLERY_LAYOUT = "click_to_show_media_in_gallery_layout"; public static final String HIDE_POST_TYPE = "hide_post_type"; + public static final String HIDE_POST_FLAIR = "hide_post_flair"; public static final String HIDE_THE_NUMBER_OF_AWARDS = "hide_the_number_of_awards"; public static final String HIDE_SUBREDDIT_AND_USER_PREFIX = "hide_subreddit_and_user_prefix"; public static final String HIDE_THE_NUMBER_OF_VOTES = "hide_the_number_of_votes"; diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c3456e0e..6dd4979f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -541,6 +541,7 @@ User Default Sort Time Click to Show Media in Gallery Layout Hide Post Type + Hide Post Flair Hide the Number of Awards Hide Subreddit and User Prefix Hide the Number of Votes diff --git a/app/src/main/res/xml/post_preferences.xml b/app/src/main/res/xml/post_preferences.xml index 7e47f86c..7ea526a5 100644 --- a/app/src/main/res/xml/post_preferences.xml +++ b/app/src/main/res/xml/post_preferences.xml @@ -19,6 +19,11 @@ app:key="hide_post_type" app:title="@string/settings_hide_post_type" /> + +