diff options
Diffstat (limited to '')
3 files changed, 23 insertions, 27 deletions
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 60bfabdc..90694bed 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java @@ -280,7 +280,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb @Override public void onDrawerClosed(View drawerView) { if (adapter != null) { - adapter.closeAccountSectionWithoutChangeIconResource(true); + adapter.closeAccountManagement(true); } } }); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/HeaderSectionRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/HeaderSectionRecyclerViewAdapter.java index dd612e6c..8ce63cae 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/HeaderSectionRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/HeaderSectionRecyclerViewAdapter.java @@ -135,8 +135,8 @@ public class HeaderSectionRecyclerViewAdapter extends RecyclerView.Adapter<Recyc public void onAuthenticationSucceeded( @NonNull BiometricPrompt.AuthenticationResult result) { super.onAuthenticationSucceeded(result); - pageToggle.openAccountSection(); - openAccountSection(((NavHeaderViewHolder) holder).binding.accountSwitcherImageViewNavHeaderMain); + pageToggle.openAccountManagement(); + openAccountManagement(((NavHeaderViewHolder) holder).binding.accountSwitcherImageViewNavHeaderMain); } }); @@ -147,17 +147,17 @@ public class HeaderSectionRecyclerViewAdapter extends RecyclerView.Adapter<Recyc biometricPrompt.authenticate(promptInfo); } else { - pageToggle.openAccountSection(); - openAccountSection(((NavHeaderViewHolder) holder).binding.accountSwitcherImageViewNavHeaderMain); + pageToggle.openAccountManagement(); + openAccountManagement(((NavHeaderViewHolder) holder).binding.accountSwitcherImageViewNavHeaderMain); } } else { - pageToggle.openAccountSection(); - openAccountSection(((NavHeaderViewHolder) holder).binding.accountSwitcherImageViewNavHeaderMain); + pageToggle.openAccountManagement(); + openAccountManagement(((NavHeaderViewHolder) holder).binding.accountSwitcherImageViewNavHeaderMain); } } else { ((NavHeaderViewHolder) holder).binding.accountSwitcherImageViewNavHeaderMain.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.ic_baseline_arrow_drop_down_24dp, null)); - pageToggle.closeAccountSectionWithoutChangeIconResource(); - closeAccountSectionWithoutChangeIconResource(false); + pageToggle.closeAccountManagement(); + closeAccountManagement(false); } }); } @@ -168,19 +168,16 @@ public class HeaderSectionRecyclerViewAdapter extends RecyclerView.Adapter<Recyc return 1; } - private void openAccountSection(ImageView dropIconImageView) { + private void openAccountManagement(ImageView dropIconImageView) { dropIconImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.ic_baseline_arrow_drop_up_24dp, null)); isInMainPage = false; } - public boolean closeAccountSectionWithoutChangeIconResource(boolean checkIsInMainPage) { - if (!(checkIsInMainPage && isInMainPage)) { - isInMainPage = true; - return true; + public void closeAccountManagement(boolean notifyItemChanged) { + isInMainPage = true; + if (notifyItemChanged) { + notifyItemChanged(0); } - - notifyItemChanged(0); - return false; } public void updateAccountInfo(String profileImageUrl, String bannerImageUrl, int karma) { @@ -223,7 +220,7 @@ public class HeaderSectionRecyclerViewAdapter extends RecyclerView.Adapter<Recyc } public interface PageToggle { - void openAccountSection(); - void closeAccountSectionWithoutChangeIconResource(); + void openAccountManagement(); + void closeAccountManagement(); } } 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 7fe52d54..06adecd3 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 @@ -39,13 +39,13 @@ public class NavigationDrawerRecyclerViewMergedAdapter { glide, accountName, sharedPreferences, navigationDrawerSharedPreferences, securitySharedPreferences, new HeaderSectionRecyclerViewAdapter.PageToggle() { @Override - public void openAccountSection() { + public void openAccountManagement() { NavigationDrawerRecyclerViewMergedAdapter.this.openAccountSection(); } @Override - public void closeAccountSectionWithoutChangeIconResource() { - NavigationDrawerRecyclerViewMergedAdapter.this.closeAccountSectionWithoutChangeIconResource(); + public void closeAccountManagement() { + NavigationDrawerRecyclerViewMergedAdapter.this.closeAccountManagement(false); } }); accountSectionRecyclerViewAdapter = new AccountSectionRecyclerViewAdapter(baseActivity, customThemeWrapper, @@ -88,7 +88,7 @@ public class NavigationDrawerRecyclerViewMergedAdapter { mainPageConcatAdapter.addAdapter(accountManagementSectionRecyclerViewAdapter); } - public void closeAccountSectionWithoutChangeIconResource() { + public void closeAccountManagement(boolean refreshHeader) { mainPageConcatAdapter.removeAdapter(accountManagementSectionRecyclerViewAdapter); mainPageConcatAdapter.addAdapter(accountSectionRecyclerViewAdapter); @@ -97,11 +97,10 @@ public class NavigationDrawerRecyclerViewMergedAdapter { mainPageConcatAdapter.addAdapter(preferenceSectionRecyclerViewAdapter); mainPageConcatAdapter.addAdapter(favoriteSubscribedSubredditsSectionRecyclerViewAdapter); mainPageConcatAdapter.addAdapter(subscribedSubredditsRecyclerViewAdapter); - } - public void closeAccountSectionWithoutChangeIconResource(boolean checkIsInMainPage) { - closeAccountSectionWithoutChangeIconResource(); - headerSectionRecyclerViewAdapter.closeAccountSectionWithoutChangeIconResource(checkIsInMainPage); + if (refreshHeader) { + headerSectionRecyclerViewAdapter.closeAccountManagement(true); + } } public void updateAccountInfo(String profileImageUrl, String bannerImageUrl, int karma) { |