mirror of
https://github.com/oxen-io/session-android.git
synced 2025-06-09 17:58:34 +00:00
Add You to reactions you've sent in the bottom dialog fragment.
This commit is contained in:
parent
092fb40333
commit
ed2b049ad4
@ -1,5 +1,6 @@
|
|||||||
package org.thoughtcrime.securesms.reactions;
|
package org.thoughtcrime.securesms.reactions;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@ -45,13 +46,13 @@ final class ReactionRecipientsAdapter extends RecyclerView.Adapter<ReactionRecip
|
|||||||
return data.size();
|
return data.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
final class ViewHolder extends RecyclerView.ViewHolder {
|
final static class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
private final AvatarImageView avatar;
|
private final AvatarImageView avatar;
|
||||||
private final TextView recipient;
|
private final TextView recipient;
|
||||||
private final TextView emoji;
|
private final TextView emoji;
|
||||||
|
|
||||||
public ViewHolder(@NonNull View itemView) {
|
private ViewHolder(@NonNull View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
|
|
||||||
avatar = itemView.findViewById(R.id.reactions_bottom_view_recipient_avatar);
|
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) {
|
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());
|
this.emoji.setText(reaction.getEmoji());
|
||||||
|
|
||||||
if (reaction.getSender().equals(Recipient.self())) {
|
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);
|
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 -->
|
<!-- ReactionsBottomSheetDialogFragment -->
|
||||||
<string name="ReactionsBottomSheetDialogFragment_all">All %1$d</string>
|
<string name="ReactionsBottomSheetDialogFragment_all">All %1$d</string>
|
||||||
|
<string name="ReactionsBottomSheetDialogFragment_you">%1$s (You)</string>
|
||||||
|
|
||||||
<!-- ReactionsConversationView -->
|
<!-- ReactionsConversationView -->
|
||||||
<string name="ReactionsConversationView_plus">+%1$d</string>
|
<string name="ReactionsConversationView_plus">+%1$d</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user