Add badge to Recipient row of reactions sheet.
This commit is contained in:
parent
320bf45518
commit
31b98ec612
2 changed files with 15 additions and 0 deletions
|
@ -9,6 +9,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.badges.BadgeImageView;
|
||||
import org.thoughtcrime.securesms.components.AvatarImageView;
|
||||
import org.thoughtcrime.securesms.mms.GlideApp;
|
||||
import org.thoughtcrime.securesms.util.AvatarUtil;
|
||||
|
@ -46,6 +47,7 @@ final class ReactionRecipientsAdapter extends RecyclerView.Adapter<ReactionRecip
|
|||
static final class ViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
private final AvatarImageView avatar;
|
||||
private final BadgeImageView badge;
|
||||
private final TextView recipient;
|
||||
private final TextView emoji;
|
||||
|
||||
|
@ -53,6 +55,7 @@ final class ReactionRecipientsAdapter extends RecyclerView.Adapter<ReactionRecip
|
|||
super(itemView);
|
||||
|
||||
avatar = itemView.findViewById(R.id.reactions_bottom_view_recipient_avatar);
|
||||
badge = itemView.findViewById(R.id.reactions_bottom_view_recipient_badge);
|
||||
recipient = itemView.findViewById(R.id.reactions_bottom_view_recipient_name);
|
||||
emoji = itemView.findViewById(R.id.reactions_bottom_view_recipient_emoji);
|
||||
}
|
||||
|
@ -63,10 +66,12 @@ final class ReactionRecipientsAdapter extends RecyclerView.Adapter<ReactionRecip
|
|||
if (reaction.getSender().isSelf()) {
|
||||
this.recipient.setText(R.string.ReactionsRecipientAdapter_you);
|
||||
this.avatar.setAvatar(GlideApp.with(avatar), null, false);
|
||||
this.badge.setBadge(null);
|
||||
AvatarUtil.loadIconIntoImageView(reaction.getSender(), avatar);
|
||||
} else {
|
||||
this.recipient.setText(reaction.getSender().getDisplayName(itemView.getContext()));
|
||||
this.avatar.setAvatar(GlideApp.with(avatar), reaction.getSender(), false);
|
||||
this.badge.setBadgeFromRecipient(reaction.getSender());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,16 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<org.thoughtcrime.securesms.badges.BadgeImageView
|
||||
android:id="@+id/reactions_bottom_view_recipient_badge"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="23dp"
|
||||
app:badge_size="small"
|
||||
app:layout_constraintStart_toStartOf="@id/reactions_bottom_view_recipient_avatar"
|
||||
app:layout_constraintTop_toTopOf="@id/reactions_bottom_view_recipient_avatar" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/reactions_bottom_view_recipient_name"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
Loading…
Add table
Reference in a new issue