From 4b3e11c62df47977c9696f4c066d32f14b28e6b3 Mon Sep 17 00:00:00 2001 From: Docile-Alligator Date: Mon, 21 Feb 2022 12:23:13 +0800 Subject: Fix https://github.com/Docile-Alligator/Infinity-For-Reddit/issues/667 --- .../infinityforreddit/activities/FilteredPostsActivity.java | 4 ++++ .../ml/docilealligator/infinityforreddit/fragments/PostFragment.java | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'app/src') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredPostsActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredPostsActivity.java index 3c0dd8e3..cadadd68 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredPostsActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredPostsActivity.java @@ -93,6 +93,9 @@ public class FilteredPostsActivity extends BaseActivity implements SortTypeSelec @Named("current_account") SharedPreferences mCurrentAccountSharedPreferences; @Inject + @Named("nsfw_and_spoiler") + SharedPreferences mNsfwAndSpoilerSharedPreferences; + @Inject CustomThemeWrapper mCustomThemeWrapper; @Inject Executor mExecutor; @@ -156,6 +159,7 @@ public class FilteredPostsActivity extends BaseActivity implements SortTypeSelec postType = getIntent().getIntExtra(EXTRA_POST_TYPE, PostPagingSource.TYPE_FRONT_PAGE); int filter = getIntent().getIntExtra(EXTRA_FILTER, -1000); PostFilter postFilter = new PostFilter(); + postFilter.allowNSFW = !mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_NSFW_FOREVER, false) && mNsfwAndSpoilerSharedPreferences.getBoolean((mAccountName == null || mAccountName.equals("-") ? "" : mAccountName) + SharedPreferencesUtils.NSFW_BASE, false); switch (filter) { case Post.NSFW_TYPE: postFilter.onlyNSFW = true; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java index aaafe2e2..dc8232e3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java @@ -1629,7 +1629,6 @@ public class PostFragment extends Fragment implements FragmentCommunicator { @Override public void changePostFilter(PostFilter postFilter) { this.postFilter = postFilter; - postFilter.allowNSFW = !mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_NSFW_FOREVER, false) && mNsfwAndSpoilerSharedPreferences.getBoolean((accountName == null || accountName.equals("-") ? "" : accountName) + SharedPreferencesUtils.NSFW_BASE, false); if (mPostViewModel != null) { mPostViewModel.changePostFilter(postFilter); } -- cgit v1.2.3