From 3adac8a0743a44018ce8509124a7c6506d92839c Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Sat, 28 Mar 2020 16:27:56 +0800 Subject: Show NSFW toggle in the nav drawer in anonymous mode. --- .../NavigationDrawerRecyclerViewAdapter.java | 26 +++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'app/src/main/java') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/NavigationDrawerRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/NavigationDrawerRecyclerViewAdapter.java index c5fa30b2..0491c1ed 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/NavigationDrawerRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/NavigationDrawerRecyclerViewAdapter.java @@ -308,6 +308,30 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter { + if (isNSFWEnabled) { + isNSFWEnabled = false; + ((MenuItemViewHolder) holder).menuTextView.setText(R.string.enable_nsfw); + ((MenuItemViewHolder) holder).imageView.setImageDrawable(context.getDrawable(R.drawable.ic_nsfw_on_24dp)); + itemClickListener.onMenuClick(R.string.disable_nsfw); + } else { + isNSFWEnabled = true; + ((MenuItemViewHolder) holder).menuTextView.setText(R.string.disable_nsfw); + ((MenuItemViewHolder) holder).imageView.setImageDrawable(context.getDrawable(R.drawable.ic_nsfw_off_24dp)); + itemClickListener.onMenuClick(R.string.enable_nsfw); + } + }); + break; + case 3: stringId = R.string.settings; drawableId = R.drawable.ic_settings_24dp; } @@ -379,7 +403,7 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter