From 7c6ec2e3d7dbab400e4e12cd9a6de6d4af86ce85 Mon Sep 17 00:00:00 2001 From: Grishka Date: Tue, 30 May 2023 21:32:08 +0300 Subject: [PATCH] Fix #587 --- .../android/ui/AccountSwitcherSheet.java | 9 ++++-- .../main/res/layout/item_account_switcher.xml | 32 +++++++------------ 2 files changed, 18 insertions(+), 23 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 fbd19d8a..f9b77101 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/AccountSwitcherSheet.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/AccountSwitcherSheet.java @@ -25,6 +25,7 @@ import org.joinmastodon.android.api.session.AccountSessionManager; import org.joinmastodon.android.fragments.HomeFragment; import org.joinmastodon.android.fragments.SplashFragment; import org.joinmastodon.android.ui.utils.UiUtils; +import org.joinmastodon.android.ui.views.CheckableRelativeLayout; import java.util.ArrayList; import java.util.List; @@ -225,16 +226,18 @@ public class AccountSwitcherSheet extends BottomSheet{ private class AccountViewHolder extends BindableViewHolder implements ImageLoaderViewHolder, UsableRecyclerView.Clickable, UsableRecyclerView.LongClickable{ private final TextView name, username; private final ImageView avatar; - private final RadioButton radioButton; + private final CheckableRelativeLayout view; public AccountViewHolder(){ super(activity, R.layout.item_account_switcher, list); name=findViewById(R.id.name); username=findViewById(R.id.username); - radioButton=findViewById(R.id.radiobtn); + View radioButton=findViewById(R.id.radiobtn); + radioButton.setBackground(new RadioButton(activity).getButtonDrawable()); avatar=findViewById(R.id.avatar); avatar.setOutlineProvider(OutlineProviders.roundedRect(OutlineProviders.RADIUS_MEDIUM)); avatar.setClipToOutline(true); + view=(CheckableRelativeLayout) itemView; } @SuppressLint("SetTextI18n") @@ -242,7 +245,7 @@ public class AccountSwitcherSheet extends BottomSheet{ public void onBind(AccountSession item){ name.setText(item.self.displayName); username.setText(item.getFullUsername()); - radioButton.setChecked(AccountSessionManager.getInstance().getLastActiveAccountID().equals(item.getID())); + view.setChecked(AccountSessionManager.getInstance().getLastActiveAccountID().equals(item.getID())); } @Override diff --git a/mastodon/src/main/res/layout/item_account_switcher.xml b/mastodon/src/main/res/layout/item_account_switcher.xml index 6276c783..69eba241 100644 --- a/mastodon/src/main/res/layout/item_account_switcher.xml +++ b/mastodon/src/main/res/layout/item_account_switcher.xml @@ -1,5 +1,5 @@ - - - - + android:layout_centerInParent="true" + android:layout_marginEnd="20dp" + android:layout_marginStart="12dp" + android:duplicateParentState="true"/> - \ No newline at end of file + \ No newline at end of file