diff options
author | steckbrief <steckbrief@chefmail.de> | 2016-05-16 01:51:29 +0200 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2016-05-16 01:51:29 +0200 |
commit | 007f09384e620567e0bcb5836b6ef32d53ce6c95 (patch) | |
tree | 6f3c3b33cdd8306380948f283276652fe294cfad | |
parent | fe78f858bacf54f8285db31b7d6aa65ff3628f15 (diff) |
Do not show contact's avatar on every message, avoid loading own avatar, only register click listeners when avatar is present
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java | 61 |
1 files changed, 33 insertions, 28 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java index b2dca6b9..5c62b1f4 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java @@ -543,36 +543,41 @@ public class MessageAdapter extends ArrayAdapter<Message> { viewHolder.status_message.setText(message.getBody()); return view; } else { - loadAvatar(message, viewHolder.contact_picture); + if (message.getConversation().getMode() == Conversation.MODE_MULTI) { + loadAvatar(message, viewHolder.contact_picture); + + + viewHolder.contact_picture + .setOnClickListener(new OnClickListener() { + + @Override + public void onClick(View v) { + if (MessageAdapter.this.mOnContactPictureClickedListener != null) { + MessageAdapter.this.mOnContactPictureClickedListener + .onContactPictureClicked(message); + } + + } + }); + viewHolder.contact_picture + .setOnLongClickListener(new OnLongClickListener() { + + @Override + public boolean onLongClick(View v) { + if (MessageAdapter.this.mOnContactPictureLongClickedListener != null) { + MessageAdapter.this.mOnContactPictureLongClickedListener + .onContactPictureLongClicked(message); + return true; + } else { + return false; + } + } + }); + } else { + viewHolder.contact_picture.setVisibility(View.GONE); + } } - viewHolder.contact_picture - .setOnClickListener(new OnClickListener() { - - @Override - public void onClick(View v) { - if (MessageAdapter.this.mOnContactPictureClickedListener != null) { - MessageAdapter.this.mOnContactPictureClickedListener - .onContactPictureClicked(message); - } - - } - }); - viewHolder.contact_picture - .setOnLongClickListener(new OnLongClickListener() { - - @Override - public boolean onLongClick(View v) { - if (MessageAdapter.this.mOnContactPictureLongClickedListener != null) { - MessageAdapter.this.mOnContactPictureLongClickedListener - .onContactPictureLongClicked(message); - return true; - } else { - return false; - } - } - }); - final Transferable transferable = message.getTransferable(); if (transferable != null && transferable.getStatus() != Transferable.STATUS_UPLOADING) { if (transferable.getStatus() == Transferable.STATUS_OFFER) { |