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 +++++++++++++++++++++- .../res/layout/activity_view_subreddit_detail.xml | 2 -- .../res/layout/content_view_subreddit_detail.xml | 10 --------- 3 files changed, 25 insertions(+), 13 deletions(-) delete mode 100644 app/src/main/res/layout/content_view_subreddit_detail.xml 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 - - - -- cgit v1.2.3