Skip to content

Commit

Permalink
feat(search): add back bot indicator to account search results preview
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasGGamerM committed Mar 20, 2024
1 parent 72cf5c3 commit 8d6593e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

public class AccountViewHolder extends BindableViewHolder<AccountViewModel> implements ImageLoaderViewHolder, UsableRecyclerView.Clickable, UsableRecyclerView.LongClickable{
private final TextView name, username, followers, pronouns, bio;
public final ImageView avatar;
public final ImageView avatar, botIcon;
private final FrameLayout accessory;
private final ProgressBarButton button;
private final PopupMenu contextMenu;
Expand Down Expand Up @@ -92,6 +92,7 @@ public AccountViewHolder(Fragment fragment, ViewGroup list, HashMap<String, Rela
name=findViewById(R.id.name);
username=findViewById(R.id.username);
avatar=findViewById(R.id.avatar);
botIcon=findViewById(R.id.bot_icon);
accessory=findViewById(R.id.accessory);
button=findViewById(R.id.button);
menuAnchor=findViewById(R.id.menu_anchor);
Expand Down Expand Up @@ -147,6 +148,10 @@ public void onBind(AccountViewModel item){
pronouns.setVisibility(pronounsString.isPresent() ? View.VISIBLE : View.GONE);
pronounsString.ifPresent(p -> HtmlParser.setTextWithCustomEmoji(pronouns, p, item.account.emojis));

if(item.account.bot) {
botIcon.setVisibility(View.VISIBLE);
}

/* unused in megalodon
boolean hasVerifiedLink=item.verifiedLink!=null;
if(!hasVerifiedLink)
Expand Down
19 changes: 16 additions & 3 deletions mastodon/src/main/res/layout/item_account_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
android:importantForAccessibility="no"
tools:src="#0f0"/>

<LinearLayout
<org.joinmastodon.android.ui.views.HeaderSubtitleLinearLayout
android:id="@+id/line1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand All @@ -39,7 +39,7 @@

<TextView
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:singleLine="true"
Expand All @@ -50,7 +50,19 @@
android:textAlignment="viewStart"
tools:text="\@user@server"/>

</LinearLayout>
<ImageView
android:id="@+id/bot_icon"
android:layout_width="18sp"
android:layout_height="18sp"
android:layout_marginEnd="4dp"
android:layout_gravity="center_vertical"
android:visibility="gone"
android:importantForAccessibility="no"
android:contentDescription="@string/sk_icon_bot"
android:tint="?colorM3Secondary"
android:src="@drawable/ic_fluent_bot_16_filled" />

</org.joinmastodon.android.ui.views.HeaderSubtitleLinearLayout>

<LinearLayout
android:id="@+id/line2"
Expand Down Expand Up @@ -84,6 +96,7 @@
android:textAppearance="@style/m3_body_medium"
android:textColor="?colorM3Secondary"
tools:text="123 followers"/>

</LinearLayout>

<FrameLayout
Expand Down

0 comments on commit 8d6593e

Please sign in to comment.