From aab502238dce0a84dfc94dbabb67f98eabb7f074 Mon Sep 17 00:00:00 2001 From: Docile-Alligator Date: Fri, 11 Mar 2022 12:10:35 +0800 Subject: Fix navigation drawer issues. --- .../navigationdrawer/AccountSectionRecyclerViewAdapter.java | 13 ++++++------- .../navigationdrawer/PostSectionRecyclerViewAdapter.java | 2 +- .../PreferenceSectionRecyclerViewAdapter.java | 2 +- .../navigationdrawer/RedditSectionRecyclerViewAdapter.java | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) (limited to 'app/src') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/AccountSectionRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/AccountSectionRecyclerViewAdapter.java index 348eb199..18c98c6f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/AccountSectionRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/AccountSectionRecyclerViewAdapter.java @@ -2,6 +2,7 @@ package ml.docilealligator.infinityforreddit.adapters.navigationdrawer; import android.content.Intent; import android.content.SharedPreferences; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -25,6 +26,7 @@ public class AccountSectionRecyclerViewAdapter extends RecyclerView.Adapter { if (collapseAccountSection) { collapseAccountSection = !collapseAccountSection; - notifyItemRangeInserted(holder.getBindingAdapterPosition() + 1, ACCOUNT_SECTION_ITEMS); + notifyItemRangeInserted(holder.getBindingAdapterPosition() + 1, isLoggedIn ? ACCOUNT_SECTION_ITEMS : ANONYMOUS_ACCOUNT_SECTION_ITEMS); } else { collapseAccountSection = !collapseAccountSection; - notifyItemRangeRemoved(holder.getBindingAdapterPosition() + 1, ACCOUNT_SECTION_ITEMS); + notifyItemRangeRemoved(holder.getBindingAdapterPosition() + 1, isLoggedIn ? ACCOUNT_SECTION_ITEMS : ANONYMOUS_ACCOUNT_SECTION_ITEMS); } notifyItemChanged(holder.getBindingAdapterPosition()); }); @@ -103,7 +105,7 @@ public class AccountSectionRecyclerViewAdapter extends RecyclerView.Adapter 0) { ((MenuItemViewHolder) holder).menuTextView.setText(baseActivity.getString(R.string.inbox_with_count, inboxCount)); @@ -141,10 +143,7 @@ public class AccountSectionRecyclerViewAdapter extends RecyclerView.Adapter