From b3bfe2f3ca37f036343d6c0e10938b1f5762d4f6 Mon Sep 17 00:00:00 2001 From: Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> Date: Wed, 30 Oct 2024 09:39:17 -0400 Subject: Remove NSFW toggle in the navigation drawer to comply with the stupid Google Play policy. --- .../infinityforreddit/activities/MainActivity.java | 15 ++++------ .../NavigationDrawerRecyclerViewMergedAdapter.java | 6 +--- .../PreferenceSectionRecyclerViewAdapter.java | 35 +--------------------- 3 files changed, 8 insertions(+), 48 deletions(-) (limited to 'app/src/main/java/ml') 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 0e92206a..5bf73d83 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java @@ -52,7 +52,6 @@ import com.google.android.material.tabs.TabLayout; import com.google.android.material.tabs.TabLayoutMediator; import com.google.android.material.textfield.TextInputEditText; -import ml.docilealligator.infinityforreddit.readpost.ReadPostsUtils; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; @@ -65,15 +64,10 @@ import java.util.concurrent.TimeUnit; import javax.inject.Inject; import javax.inject.Named; -import ml.docilealligator.infinityforreddit.thing.FetchSubscribedThing; import ml.docilealligator.infinityforreddit.Infinity; -import ml.docilealligator.infinityforreddit.post.MarkPostAsReadInterface; -import ml.docilealligator.infinityforreddit.worker.PullNotificationWorker; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.RecyclerViewContentScrollingInterface; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; -import ml.docilealligator.infinityforreddit.thing.SortType; -import ml.docilealligator.infinityforreddit.thing.SortTypeSelectionCallback; import ml.docilealligator.infinityforreddit.account.Account; import ml.docilealligator.infinityforreddit.account.AccountViewModel; import ml.docilealligator.infinityforreddit.adapters.SubredditAutocompleteRecyclerViewAdapter; @@ -106,20 +100,26 @@ import ml.docilealligator.infinityforreddit.fragments.PostFragment; import ml.docilealligator.infinityforreddit.message.ReadMessage; import ml.docilealligator.infinityforreddit.multireddit.MultiReddit; import ml.docilealligator.infinityforreddit.multireddit.MultiRedditViewModel; +import ml.docilealligator.infinityforreddit.post.MarkPostAsReadInterface; import ml.docilealligator.infinityforreddit.post.Post; import ml.docilealligator.infinityforreddit.post.PostPagingSource; import ml.docilealligator.infinityforreddit.readpost.InsertReadPost; +import ml.docilealligator.infinityforreddit.readpost.ReadPostsUtils; import ml.docilealligator.infinityforreddit.subreddit.ParseSubredditData; import ml.docilealligator.infinityforreddit.subreddit.SubredditData; import ml.docilealligator.infinityforreddit.subscribedsubreddit.SubscribedSubredditData; import ml.docilealligator.infinityforreddit.subscribedsubreddit.SubscribedSubredditViewModel; import ml.docilealligator.infinityforreddit.subscribeduser.SubscribedUserData; +import ml.docilealligator.infinityforreddit.thing.FetchSubscribedThing; +import ml.docilealligator.infinityforreddit.thing.SortType; +import ml.docilealligator.infinityforreddit.thing.SortTypeSelectionCallback; import ml.docilealligator.infinityforreddit.user.FetchUserData; import ml.docilealligator.infinityforreddit.user.UserData; import ml.docilealligator.infinityforreddit.utils.APIUtils; import ml.docilealligator.infinityforreddit.utils.CustomThemeSharedPreferencesUtils; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; import ml.docilealligator.infinityforreddit.utils.Utils; +import ml.docilealligator.infinityforreddit.worker.PullNotificationWorker; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; @@ -1303,9 +1303,6 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb @Subscribe public void onChangeNSFWEvent(ChangeNSFWEvent changeNSFWEvent) { sectionsPagerAdapter.changeNSFW(changeNSFWEvent.nsfw); - if (adapter != null) { - adapter.setNSFWEnabled(changeNSFWEvent.nsfw); - } } @Subscribe(threadMode = ThreadMode.MAIN) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/NavigationDrawerRecyclerViewMergedAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/NavigationDrawerRecyclerViewMergedAdapter.java index 06adecd3..fcdf046e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/NavigationDrawerRecyclerViewMergedAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/NavigationDrawerRecyclerViewMergedAdapter.java @@ -55,7 +55,7 @@ public class NavigationDrawerRecyclerViewMergedAdapter { postSectionRecyclerViewAdapter = new PostSectionRecyclerViewAdapter(baseActivity, customThemeWrapper, navigationDrawerSharedPreferences, !accountName.equals(Account.ANONYMOUS_ACCOUNT), itemClickListener); preferenceSectionRecyclerViewAdapter = new PreferenceSectionRecyclerViewAdapter(baseActivity, customThemeWrapper, - accountName, nsfwAndSpoilerSharedPreferences, navigationDrawerSharedPreferences, itemClickListener); + navigationDrawerSharedPreferences, itemClickListener); favoriteSubscribedSubredditsSectionRecyclerViewAdapter = new FavoriteSubscribedSubredditsSectionRecyclerViewAdapter( baseActivity, glide, customThemeWrapper, navigationDrawerSharedPreferences, itemClickListener); subscribedSubredditsRecyclerViewAdapter = new SubscribedSubredditsRecyclerViewAdapter(baseActivity, glide, @@ -123,10 +123,6 @@ public class NavigationDrawerRecyclerViewMergedAdapter { accountSectionRecyclerViewAdapter.setInboxCount(inboxCount); } - public void setNSFWEnabled(boolean isNSFWEnabled) { - preferenceSectionRecyclerViewAdapter.setNSFWEnabled(isNSFWEnabled); - } - public void setFavoriteSubscribedSubreddits(List favoriteSubscribedSubreddits) { favoriteSubscribedSubredditsSectionRecyclerViewAdapter.setFavoriteSubscribedSubreddits(favoriteSubscribedSubreddits); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/PreferenceSectionRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/PreferenceSectionRecyclerViewAdapter.java index e791b35e..5b3d0859 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/PreferenceSectionRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/PreferenceSectionRecyclerViewAdapter.java @@ -11,7 +11,6 @@ import androidx.core.content.ContextCompat; import androidx.recyclerview.widget.RecyclerView; import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.account.Account; import ml.docilealligator.infinityforreddit.activities.BaseActivity; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.databinding.ItemNavDrawerMenuGroupTitleBinding; @@ -22,19 +21,17 @@ public class PreferenceSectionRecyclerViewAdapter extends RecyclerView.Adapter { - if (isNSFWEnabled) { - isNSFWEnabled = false; - ((MenuItemViewHolder) holder).binding.textViewItemNavDrawerMenuItem.setText(R.string.enable_nsfw); - ((MenuItemViewHolder) holder).binding.imageViewItemNavDrawerMenuItem.setImageDrawable(ContextCompat.getDrawable(baseActivity, R.drawable.ic_nsfw_on_day_night_24dp)); - itemClickListener.onMenuClick(R.string.disable_nsfw); - } else { - isNSFWEnabled = true; - ((MenuItemViewHolder) holder).binding.textViewItemNavDrawerMenuItem.setText(R.string.disable_nsfw); - ((MenuItemViewHolder) holder).binding.imageViewItemNavDrawerMenuItem.setImageDrawable(ContextCompat.getDrawable(baseActivity, R.drawable.ic_nsfw_off_day_night_24dp)); - itemClickListener.onMenuClick(R.string.enable_nsfw); - } - }); - break; - case 3: stringId = R.string.settings; drawableId = R.drawable.ic_settings_day_night_24dp; } @@ -144,11 +116,6 @@ public class PreferenceSectionRecyclerViewAdapter extends RecyclerView.Adapter