diff options
Diffstat (limited to 'app/src/main')
7 files changed, 15 insertions, 15 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java index c1162ed0..89c95efa 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java @@ -1390,7 +1390,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb private void randomThing() { RandomBottomSheetFragment randomBottomSheetFragment = new RandomBottomSheetFragment(); Bundle bundle = new Bundle(); - bundle.putBoolean(RandomBottomSheetFragment.EXTRA_IS_NSFW, mNsfwAndSpoilerSharedPreferences.getBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.NSFW_BASE, false)); + bundle.putBoolean(RandomBottomSheetFragment.EXTRA_IS_NSFW, !mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_NSFW_FOREVER, false) && mNsfwAndSpoilerSharedPreferences.getBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.NSFW_BASE, false)); randomBottomSheetFragment.setArguments(bundle); randomBottomSheetFragment.show(getSupportFragmentManager(), randomBottomSheetFragment.getTag()); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java index 5096e5f7..5ca8a554 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java @@ -601,7 +601,7 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect private void random() { RandomBottomSheetFragment randomBottomSheetFragment = new RandomBottomSheetFragment(); Bundle bundle = new Bundle(); - bundle.putBoolean(RandomBottomSheetFragment.EXTRA_IS_NSFW, mNsfwAndSpoilerSharedPreferences.getBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.NSFW_BASE, false)); + bundle.putBoolean(RandomBottomSheetFragment.EXTRA_IS_NSFW, !mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_NSFW_FOREVER, false) && mNsfwAndSpoilerSharedPreferences.getBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.NSFW_BASE, false)); randomBottomSheetFragment.setArguments(bundle); randomBottomSheetFragment.show(getSupportFragmentManager(), randomBottomSheetFragment.getTag()); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java index 981f4d75..bd73d838 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java @@ -420,7 +420,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp if (subredditData.isNSFW()) { if (nsfwWarningBuilder == null - && !mNsfwAndSpoilerSharedPreferences.getBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.NSFW_BASE, false)) { + && mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_NSFW_FOREVER, false) || !mNsfwAndSpoilerSharedPreferences.getBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.NSFW_BASE, false)) { nsfwWarningBuilder = new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme) .setTitle(R.string.warning) .setMessage(R.string.this_is_a_nsfw_subreddit) @@ -1391,7 +1391,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp private void random() { RandomBottomSheetFragment randomBottomSheetFragment = new RandomBottomSheetFragment(); Bundle bundle = new Bundle(); - bundle.putBoolean(RandomBottomSheetFragment.EXTRA_IS_NSFW, mNsfwAndSpoilerSharedPreferences.getBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.NSFW_BASE, false)); + bundle.putBoolean(RandomBottomSheetFragment.EXTRA_IS_NSFW, !mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_NSFW_FOREVER, false) && mNsfwAndSpoilerSharedPreferences.getBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.NSFW_BASE, false)); randomBottomSheetFragment.setArguments(bundle); randomBottomSheetFragment.show(getSupportFragmentManager(), randomBottomSheetFragment.getTag()); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java index eb79ce17..47b6fac1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java @@ -1202,7 +1202,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele private void random() { RandomBottomSheetFragment randomBottomSheetFragment = new RandomBottomSheetFragment(); Bundle bundle = new Bundle(); - bundle.putBoolean(RandomBottomSheetFragment.EXTRA_IS_NSFW, mNsfwAndSpoilerSharedPreferences.getBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.NSFW_BASE, false)); + bundle.putBoolean(RandomBottomSheetFragment.EXTRA_IS_NSFW, !mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_NSFW_FOREVER, false) && mNsfwAndSpoilerSharedPreferences.getBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.NSFW_BASE, false)); randomBottomSheetFragment.setArguments(bundle); randomBottomSheetFragment.show(getSupportFragmentManager(), randomBottomSheetFragment.getTag()); } 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 2c3f28b8..7110e057 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java @@ -868,7 +868,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator { new Handler(), null, usage, nameOfUsage, (postFilter, readPostList) -> { if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) { this.postFilter = postFilter; - postFilter.allowNSFW = mNsfwAndSpoilerSharedPreferences.getBoolean(accountName + SharedPreferencesUtils.NSFW_BASE, false); + postFilter.allowNSFW = !mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_NSFW_FOREVER, false) && mNsfwAndSpoilerSharedPreferences.getBoolean(accountName + SharedPreferencesUtils.NSFW_BASE, false); initializeAndBindPostViewModel(accessToken); } }); @@ -881,7 +881,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator { if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) { if (this.postFilter == null) { this.postFilter = postFilter; - postFilter.allowNSFW = mNsfwAndSpoilerSharedPreferences.getBoolean(accountName + SharedPreferencesUtils.NSFW_BASE, false); + postFilter.allowNSFW = !mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_NSFW_FOREVER, false) && mNsfwAndSpoilerSharedPreferences.getBoolean(accountName + SharedPreferencesUtils.NSFW_BASE, false); } this.readPosts = readPostList; initializeAndBindPostViewModel(accessToken); @@ -894,7 +894,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator { new Handler(), null, usage, nameOfUsage, (postFilter, readPostList) -> { if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) { this.postFilter = postFilter; - postFilter.allowNSFW = mNsfwAndSpoilerSharedPreferences.getBoolean(accountName + SharedPreferencesUtils.NSFW_BASE, false); + postFilter.allowNSFW = !mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_NSFW_FOREVER, false) && mNsfwAndSpoilerSharedPreferences.getBoolean(accountName + SharedPreferencesUtils.NSFW_BASE, false); initializeAndBindPostViewModel(accessToken); } }); @@ -910,7 +910,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator { (postFilter, concatenatedSubredditNames) -> { if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) { this.postFilter = postFilter; - postFilter.allowNSFW = mNsfwAndSpoilerSharedPreferences.getBoolean(SharedPreferencesUtils.NSFW_BASE, false); + postFilter.allowNSFW = !mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_NSFW_FOREVER, false) && mNsfwAndSpoilerSharedPreferences.getBoolean(SharedPreferencesUtils.NSFW_BASE, false); this.concatenatedSubredditNames = concatenatedSubredditNames; if (concatenatedSubredditNames == null) { showErrorView(R.string.anonymous_front_page_no_subscriptions); @@ -927,7 +927,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator { new Handler(), null, usage, nameOfUsage, (postFilter, readPostList) -> { if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) { this.postFilter = postFilter; - postFilter.allowNSFW = mNsfwAndSpoilerSharedPreferences.getBoolean(SharedPreferencesUtils.NSFW_BASE, false); + postFilter.allowNSFW = !mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_NSFW_FOREVER, false) && mNsfwAndSpoilerSharedPreferences.getBoolean(SharedPreferencesUtils.NSFW_BASE, false); initializeAndBindPostViewModelForAnonymous(null); } }); @@ -939,7 +939,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator { (postFilter, concatenatedSubredditNames) -> { if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) { this.postFilter = postFilter; - postFilter.allowNSFW = mNsfwAndSpoilerSharedPreferences.getBoolean(SharedPreferencesUtils.NSFW_BASE, false); + postFilter.allowNSFW = !mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_NSFW_FOREVER, false) && mNsfwAndSpoilerSharedPreferences.getBoolean(SharedPreferencesUtils.NSFW_BASE, false); this.concatenatedSubredditNames = concatenatedSubredditNames; if (concatenatedSubredditNames == null) { showErrorView(R.string.anonymous_front_page_no_subscriptions); @@ -1334,7 +1334,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator { @Override public void changeNSFW(boolean nsfw) { - postFilter.allowNSFW = nsfw; + postFilter.allowNSFW = !mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_NSFW_FOREVER, false) && nsfw; if (mPostViewModel != null) { mPostViewModel.changePostFilter(postFilter); } @@ -1486,7 +1486,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator { @Override public void changePostFilter(PostFilter postFilter) { this.postFilter = postFilter; - postFilter.allowNSFW = mNsfwAndSpoilerSharedPreferences.getBoolean((accountName == null || accountName.equals("-") ? "" : accountName) + SharedPreferencesUtils.NSFW_BASE, false); + 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); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SubredditListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SubredditListingFragment.java index 0f26b06e..e35520bd 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SubredditListingFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SubredditListingFragment.java @@ -141,7 +141,7 @@ public class SubredditListingFragment extends Fragment implements FragmentCommun String sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_SEARCH_SUBREDDIT, SortType.Type.RELEVANCE.value); sortType = new SortType(SortType.Type.valueOf(sort.toUpperCase())); - boolean nsfw = mNsfwAndSpoilerSharedPreferences.getBoolean((accountName == null ? "" : accountName) + SharedPreferencesUtils.NSFW_BASE, false); + boolean nsfw = !mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_NSFW_FOREVER, false) && mNsfwAndSpoilerSharedPreferences.getBoolean((accountName == null ? "" : accountName) + SharedPreferencesUtils.NSFW_BASE, false); mAdapter = new SubredditListingRecyclerViewAdapter(mActivity, mExecutor, mOauthRetrofit, mRetrofit, mCustomThemeWrapper, accessToken, accountName, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/UserListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/UserListingFragment.java index 603a4b8c..5e894706 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/UserListingFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/UserListingFragment.java @@ -141,7 +141,7 @@ public class UserListingFragment extends Fragment implements FragmentCommunicato String accountName = getArguments().getString(EXTRA_ACCOUNT_NAME); String sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_SEARCH_USER, SortType.Type.RELEVANCE.value); sortType = new SortType(SortType.Type.valueOf(sort.toUpperCase())); - boolean nsfw = mNsfwAndSpoilerSharedPreferences.getBoolean((accountName == null ? "" : accountName) + SharedPreferencesUtils.NSFW_BASE, false); + boolean nsfw = !mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_NSFW_FOREVER, false) && mNsfwAndSpoilerSharedPreferences.getBoolean((accountName == null ? "" : accountName) + SharedPreferencesUtils.NSFW_BASE, false); mAdapter = new UserListingRecyclerViewAdapter(getActivity(), mExecutor, mOauthRetrofit, mRetrofit, mCustomThemeWrapper, accessToken, accountName, mRedditDataRoomDatabase, |