kopia lustrzana https://github.com/ryukoposting/Signal-Android
Add badge to Recipient row of reactions sheet.
rodzic
320bf45518
commit
31b98ec612
|
@ -9,6 +9,7 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.R;
|
import org.thoughtcrime.securesms.R;
|
||||||
|
import org.thoughtcrime.securesms.badges.BadgeImageView;
|
||||||
import org.thoughtcrime.securesms.components.AvatarImageView;
|
import org.thoughtcrime.securesms.components.AvatarImageView;
|
||||||
import org.thoughtcrime.securesms.mms.GlideApp;
|
import org.thoughtcrime.securesms.mms.GlideApp;
|
||||||
import org.thoughtcrime.securesms.util.AvatarUtil;
|
import org.thoughtcrime.securesms.util.AvatarUtil;
|
||||||
|
@ -46,6 +47,7 @@ final class ReactionRecipientsAdapter extends RecyclerView.Adapter<ReactionRecip
|
||||||
static final class ViewHolder extends RecyclerView.ViewHolder {
|
static final class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
private final AvatarImageView avatar;
|
private final AvatarImageView avatar;
|
||||||
|
private final BadgeImageView badge;
|
||||||
private final TextView recipient;
|
private final TextView recipient;
|
||||||
private final TextView emoji;
|
private final TextView emoji;
|
||||||
|
|
||||||
|
@ -53,6 +55,7 @@ final class ReactionRecipientsAdapter extends RecyclerView.Adapter<ReactionRecip
|
||||||
super(itemView);
|
super(itemView);
|
||||||
|
|
||||||
avatar = itemView.findViewById(R.id.reactions_bottom_view_recipient_avatar);
|
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);
|
recipient = itemView.findViewById(R.id.reactions_bottom_view_recipient_name);
|
||||||
emoji = itemView.findViewById(R.id.reactions_bottom_view_recipient_emoji);
|
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()) {
|
if (reaction.getSender().isSelf()) {
|
||||||
this.recipient.setText(R.string.ReactionsRecipientAdapter_you);
|
this.recipient.setText(R.string.ReactionsRecipientAdapter_you);
|
||||||
this.avatar.setAvatar(GlideApp.with(avatar), null, false);
|
this.avatar.setAvatar(GlideApp.with(avatar), null, false);
|
||||||
|
this.badge.setBadge(null);
|
||||||
AvatarUtil.loadIconIntoImageView(reaction.getSender(), avatar);
|
AvatarUtil.loadIconIntoImageView(reaction.getSender(), avatar);
|
||||||
} else {
|
} else {
|
||||||
this.recipient.setText(reaction.getSender().getDisplayName(itemView.getContext()));
|
this.recipient.setText(reaction.getSender().getDisplayName(itemView.getContext()));
|
||||||
this.avatar.setAvatar(GlideApp.with(avatar), reaction.getSender(), false);
|
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_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="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
|
<TextView
|
||||||
android:id="@+id/reactions_bottom_view_recipient_name"
|
android:id="@+id/reactions_bottom_view_recipient_name"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|
Ładowanie…
Reference in New Issue