Search in sources :

Example 1 with AttachmentAuthor

use of chat.rocket.core.models.AttachmentAuthor in project Rocket.Chat.Android by RocketChat.

the class RocketChatMessageAttachmentsLayout method showAuthorAttachment.

private void showAuthorAttachment(Attachment attachment, View attachmentView) {
    final View authorBox = attachmentView.findViewById(R.id.author_box);
    AttachmentAuthor author = attachment.getAttachmentAuthor();
    if (author == null) {
        authorBox.setVisibility(GONE);
        return;
    }
    authorBox.setVisibility(VISIBLE);
    FrescoHelper.setupDraweeAndLoadImage(absolutize(author.getIconUrl()), (SimpleDraweeView) attachmentView.findViewById(R.id.author_icon));
    final TextView authorName = (TextView) attachmentView.findViewById(R.id.author_name);
    authorName.setText(author.getName());
    final String link = absolutize(author.getLink());
    authorName.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View view) {
            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(link));
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            view.getContext().startActivity(intent);
        }
    });
// timestamp and link - need to format time
}
Also used : TextView(android.widget.TextView) Intent(android.content.Intent) TextView(android.widget.TextView) SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) View(android.view.View) AttachmentAuthor(chat.rocket.core.models.AttachmentAuthor)

Aggregations

Intent (android.content.Intent)1 View (android.view.View)1 TextView (android.widget.TextView)1 AttachmentAuthor (chat.rocket.core.models.AttachmentAuthor)1 SimpleDraweeView (com.facebook.drawee.view.SimpleDraweeView)1