Add You to reactions you've sent in the bottom dialog fragment.
parent
092fb40333
commit
ed2b049ad4
|
@ -1,5 +1,6 @@
|
|||
package org.thoughtcrime.securesms.reactions;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -45,13 +46,13 @@ final class ReactionRecipientsAdapter extends RecyclerView.Adapter<ReactionRecip
|
|||
return data.size();
|
||||
}
|
||||
|
||||
final class ViewHolder extends RecyclerView.ViewHolder {
|
||||
final static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
private final AvatarImageView avatar;
|
||||
private final TextView recipient;
|
||||
private final TextView emoji;
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
private ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
|
||||
avatar = itemView.findViewById(R.id.reactions_bottom_view_recipient_avatar);
|
||||
|
@ -60,7 +61,7 @@ final class ReactionRecipientsAdapter extends RecyclerView.Adapter<ReactionRecip
|
|||
}
|
||||
|
||||
void bind(@NonNull Reaction reaction) {
|
||||
this.recipient.setText(reaction.getSender().getDisplayName(itemView.getContext()));
|
||||
this.recipient.setText(getReactionSenderDisplayName(itemView.getContext(), reaction.getSender()));
|
||||
this.emoji.setText(reaction.getEmoji());
|
||||
|
||||
if (reaction.getSender().equals(Recipient.self())) {
|
||||
|
@ -69,6 +70,16 @@ final class ReactionRecipientsAdapter extends RecyclerView.Adapter<ReactionRecip
|
|||
this.avatar.setAvatar(GlideApp.with(avatar), reaction.getSender(), false);
|
||||
}
|
||||
}
|
||||
|
||||
private static @NonNull String getReactionSenderDisplayName(@NonNull Context context, @NonNull Recipient sender) {
|
||||
String displayName = sender.getDisplayName(context);
|
||||
|
||||
if (sender.isLocalNumber()) {
|
||||
return context.getString(R.string.ReactionsBottomSheetDialogFragment_you, displayName);
|
||||
} else {
|
||||
return displayName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -669,6 +669,7 @@
|
|||
|
||||
<!-- ReactionsBottomSheetDialogFragment -->
|
||||
<string name="ReactionsBottomSheetDialogFragment_all">All %1$d</string>
|
||||
<string name="ReactionsBottomSheetDialogFragment_you">%1$s (You)</string>
|
||||
|
||||
<!-- ReactionsConversationView -->
|
||||
<string name="ReactionsConversationView_plus">+%1$d</string>
|
||||
|
|
Loading…
Reference in New Issue