Skip to content

Instantly share code, notes, and snippets.

@AlexPrestonSB
Created June 4, 2019 19:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexPrestonSB/5c8d1d7b374e511ad1631a2bede7db29 to your computer and use it in GitHub Desktop.
Save AlexPrestonSB/5c8d1d7b374e511ad1631a2bede7db29 to your computer and use it in GitHub Desktop.
// Messages sent by others display a profile image and nickname.
private class ReceivedMessageHolder extends RecyclerView.ViewHolder {
TextView messageText, timeText, nameText;
ImageView profileImage;
ReceivedMessageHolder(View itemView) {
super(itemView);
messageText = (TextView) itemView.findViewById(R.id.text_message_body);
timeText = (TextView) itemView.findViewById(R.id.text_message_time);
nameText = (TextView) itemView.findViewById(R.id.text_message_name);
profileImage = (ImageView) itemView.findViewById(R.id.image_message_profile);
}
void bind(UserMessage message) {
messageText.setText(message.getMessage());
nameText.setText(message.getSender().getNickname());
Utils.displayRoundImageFromUrl(ChatActivity.this,
message.getSender().getProfileUrl(), profileImage);
timeText.setText(Utils.formatTime(message.getCreatedAt()));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment