mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-07 03:07:26 +01:00
Disabling NSFW forever is now working.
This commit is contained in:
parent
6282027334
commit
270f891761
@ -1390,7 +1390,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
private void randomThing() {
|
private void randomThing() {
|
||||||
RandomBottomSheetFragment randomBottomSheetFragment = new RandomBottomSheetFragment();
|
RandomBottomSheetFragment randomBottomSheetFragment = new RandomBottomSheetFragment();
|
||||||
Bundle bundle = new Bundle();
|
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.setArguments(bundle);
|
||||||
randomBottomSheetFragment.show(getSupportFragmentManager(), randomBottomSheetFragment.getTag());
|
randomBottomSheetFragment.show(getSupportFragmentManager(), randomBottomSheetFragment.getTag());
|
||||||
}
|
}
|
||||||
|
@ -601,7 +601,7 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
|
|||||||
private void random() {
|
private void random() {
|
||||||
RandomBottomSheetFragment randomBottomSheetFragment = new RandomBottomSheetFragment();
|
RandomBottomSheetFragment randomBottomSheetFragment = new RandomBottomSheetFragment();
|
||||||
Bundle bundle = new Bundle();
|
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.setArguments(bundle);
|
||||||
randomBottomSheetFragment.show(getSupportFragmentManager(), randomBottomSheetFragment.getTag());
|
randomBottomSheetFragment.show(getSupportFragmentManager(), randomBottomSheetFragment.getTag());
|
||||||
}
|
}
|
||||||
|
@ -420,7 +420,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
|||||||
|
|
||||||
if (subredditData.isNSFW()) {
|
if (subredditData.isNSFW()) {
|
||||||
if (nsfwWarningBuilder == null
|
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)
|
nsfwWarningBuilder = new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
|
||||||
.setTitle(R.string.warning)
|
.setTitle(R.string.warning)
|
||||||
.setMessage(R.string.this_is_a_nsfw_subreddit)
|
.setMessage(R.string.this_is_a_nsfw_subreddit)
|
||||||
@ -1391,7 +1391,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
|||||||
private void random() {
|
private void random() {
|
||||||
RandomBottomSheetFragment randomBottomSheetFragment = new RandomBottomSheetFragment();
|
RandomBottomSheetFragment randomBottomSheetFragment = new RandomBottomSheetFragment();
|
||||||
Bundle bundle = new Bundle();
|
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.setArguments(bundle);
|
||||||
randomBottomSheetFragment.show(getSupportFragmentManager(), randomBottomSheetFragment.getTag());
|
randomBottomSheetFragment.show(getSupportFragmentManager(), randomBottomSheetFragment.getTag());
|
||||||
}
|
}
|
||||||
|
@ -1202,7 +1202,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
|||||||
private void random() {
|
private void random() {
|
||||||
RandomBottomSheetFragment randomBottomSheetFragment = new RandomBottomSheetFragment();
|
RandomBottomSheetFragment randomBottomSheetFragment = new RandomBottomSheetFragment();
|
||||||
Bundle bundle = new Bundle();
|
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.setArguments(bundle);
|
||||||
randomBottomSheetFragment.show(getSupportFragmentManager(), randomBottomSheetFragment.getTag());
|
randomBottomSheetFragment.show(getSupportFragmentManager(), randomBottomSheetFragment.getTag());
|
||||||
}
|
}
|
||||||
|
@ -868,7 +868,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
|||||||
new Handler(), null, usage, nameOfUsage, (postFilter, readPostList) -> {
|
new Handler(), null, usage, nameOfUsage, (postFilter, readPostList) -> {
|
||||||
if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) {
|
if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) {
|
||||||
this.postFilter = postFilter;
|
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);
|
initializeAndBindPostViewModel(accessToken);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -881,7 +881,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
|||||||
if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) {
|
if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) {
|
||||||
if (this.postFilter == null) {
|
if (this.postFilter == null) {
|
||||||
this.postFilter = postFilter;
|
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;
|
this.readPosts = readPostList;
|
||||||
initializeAndBindPostViewModel(accessToken);
|
initializeAndBindPostViewModel(accessToken);
|
||||||
@ -894,7 +894,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
|||||||
new Handler(), null, usage, nameOfUsage, (postFilter, readPostList) -> {
|
new Handler(), null, usage, nameOfUsage, (postFilter, readPostList) -> {
|
||||||
if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) {
|
if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) {
|
||||||
this.postFilter = postFilter;
|
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);
|
initializeAndBindPostViewModel(accessToken);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -910,7 +910,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
|||||||
(postFilter, concatenatedSubredditNames) -> {
|
(postFilter, concatenatedSubredditNames) -> {
|
||||||
if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) {
|
if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) {
|
||||||
this.postFilter = postFilter;
|
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;
|
this.concatenatedSubredditNames = concatenatedSubredditNames;
|
||||||
if (concatenatedSubredditNames == null) {
|
if (concatenatedSubredditNames == null) {
|
||||||
showErrorView(R.string.anonymous_front_page_no_subscriptions);
|
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) -> {
|
new Handler(), null, usage, nameOfUsage, (postFilter, readPostList) -> {
|
||||||
if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) {
|
if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) {
|
||||||
this.postFilter = postFilter;
|
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);
|
initializeAndBindPostViewModelForAnonymous(null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -939,7 +939,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
|||||||
(postFilter, concatenatedSubredditNames) -> {
|
(postFilter, concatenatedSubredditNames) -> {
|
||||||
if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) {
|
if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) {
|
||||||
this.postFilter = postFilter;
|
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;
|
this.concatenatedSubredditNames = concatenatedSubredditNames;
|
||||||
if (concatenatedSubredditNames == null) {
|
if (concatenatedSubredditNames == null) {
|
||||||
showErrorView(R.string.anonymous_front_page_no_subscriptions);
|
showErrorView(R.string.anonymous_front_page_no_subscriptions);
|
||||||
@ -1334,7 +1334,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void changeNSFW(boolean nsfw) {
|
public void changeNSFW(boolean nsfw) {
|
||||||
postFilter.allowNSFW = nsfw;
|
postFilter.allowNSFW = !mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_NSFW_FOREVER, false) && nsfw;
|
||||||
if (mPostViewModel != null) {
|
if (mPostViewModel != null) {
|
||||||
mPostViewModel.changePostFilter(postFilter);
|
mPostViewModel.changePostFilter(postFilter);
|
||||||
}
|
}
|
||||||
@ -1486,7 +1486,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
|||||||
@Override
|
@Override
|
||||||
public void changePostFilter(PostFilter postFilter) {
|
public void changePostFilter(PostFilter postFilter) {
|
||||||
this.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) {
|
if (mPostViewModel != null) {
|
||||||
mPostViewModel.changePostFilter(postFilter);
|
mPostViewModel.changePostFilter(postFilter);
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ public class SubredditListingFragment extends Fragment implements FragmentCommun
|
|||||||
|
|
||||||
String sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_SEARCH_SUBREDDIT, SortType.Type.RELEVANCE.value);
|
String sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_SEARCH_SUBREDDIT, SortType.Type.RELEVANCE.value);
|
||||||
sortType = new SortType(SortType.Type.valueOf(sort.toUpperCase()));
|
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,
|
mAdapter = new SubredditListingRecyclerViewAdapter(mActivity, mExecutor, mOauthRetrofit, mRetrofit,
|
||||||
mCustomThemeWrapper, accessToken, accountName,
|
mCustomThemeWrapper, accessToken, accountName,
|
||||||
|
@ -141,7 +141,7 @@ public class UserListingFragment extends Fragment implements FragmentCommunicato
|
|||||||
String accountName = getArguments().getString(EXTRA_ACCOUNT_NAME);
|
String accountName = getArguments().getString(EXTRA_ACCOUNT_NAME);
|
||||||
String sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_SEARCH_USER, SortType.Type.RELEVANCE.value);
|
String sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_SEARCH_USER, SortType.Type.RELEVANCE.value);
|
||||||
sortType = new SortType(SortType.Type.valueOf(sort.toUpperCase()));
|
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,
|
mAdapter = new UserListingRecyclerViewAdapter(getActivity(), mExecutor, mOauthRetrofit, mRetrofit,
|
||||||
mCustomThemeWrapper, accessToken, accountName, mRedditDataRoomDatabase,
|
mCustomThemeWrapper, accessToken, accountName, mRedditDataRoomDatabase,
|
||||||
|
Loading…
Reference in New Issue
Block a user