From d37e880993001049ec839bbd923aabff55b7401e Mon Sep 17 00:00:00 2001 From: sk Date: Fri, 2 Jun 2023 01:45:30 +0200 Subject: [PATCH] don't close sheet after logging out --- .../org/joinmastodon/android/ui/AccountSwitcherSheet.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/AccountSwitcherSheet.java b/mastodon/src/main/java/org/joinmastodon/android/ui/AccountSwitcherSheet.java index 9bb2a3ac8..0eb9f205d 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/AccountSwitcherSheet.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/AccountSwitcherSheet.java @@ -63,6 +63,7 @@ public class AccountSwitcherSheet extends BottomSheet{ private UsableRecyclerView list; private List accounts; private ListImageLoaderWrapper imgLoader; + private AccountsAdapter accountsAdapter; public AccountSwitcherSheet(@NonNull Activity activity, @Nullable HomeFragment fragment){ this(activity, fragment, false, false, null); @@ -101,7 +102,7 @@ public class AccountSwitcherSheet extends BottomSheet{ setOnDismissListener((d) -> activity.finish()); } - adapter.addAdapter(new AccountsAdapter()); + adapter.addAdapter(accountsAdapter = new AccountsAdapter()); if (!externalShare) { adapter.addAdapter(new ClickableSingleViewRecyclerAdapter(makeSimpleListItem(R.string.add_account, R.drawable.ic_fluent_add_24_regular), () -> { @@ -201,7 +202,10 @@ public class AccountSwitcherSheet extends BottomSheet{ activity.finish(); activity.startActivity(new Intent(activity, MainActivity.class)); } else { - dismiss(); + accounts.stream().filter(w -> accountID.equals(w.session.getID())).findAny().ifPresent(w -> { + accountsAdapter.notifyItemRemoved(accounts.indexOf(w)); + accounts.remove(w); + }); } }