Adding text with file sharing logo

This commit is contained in:
Erwan Croze 2018-09-11 09:13:22 +02:00
parent 01214fba33
commit 32fcec7a82
2 changed files with 14 additions and 3 deletions

View file

@ -133,6 +133,15 @@
android:textColor="#595959"
android:textSize="16.7sp"/>
<ImageView
android:id="@+id/filesharing"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal|center"
android:foregroundGravity="center"
android:src="@drawable/chat_file_message"
android:visibility="gone"/>
<TextView
android:id="@+id/lastMessage"
android:layout_width="wrap_content"

View file

@ -70,6 +70,7 @@ public class ChatRoomsAdapter extends ListSelectionAdapter {
public CheckBox delete;
public ImageView contactPicture;
public ImageView messageStatus;
public ImageView filesharing;
public ChatRoomViewHolder(View view) {
lastMessageSenderView = view.findViewById(R.id.lastMessageSender);
@ -80,6 +81,7 @@ public class ChatRoomsAdapter extends ListSelectionAdapter {
delete = view.findViewById(R.id.delete_chatroom);
contactPicture = view.findViewById(R.id.contact_picture);
messageStatus = view.findViewById(R.id.lastMessageStatus);
filesharing = view.findViewById(R.id.filesharing);
}
}
@ -193,11 +195,11 @@ public class ChatRoomsAdapter extends ListSelectionAdapter {
if (lastMessage != null) {
boolean hasContent = hasContentFileSharing(lastMessage.getContents());
holder.lastMessageView.setText(lastMessage.getTextContent());
if (lastMessage.getFileTransferInformation() != null || lastMessage.getExternalBodyUrl() != null || hasContent) {
holder.lastMessageView.setBackgroundResource(R.drawable.chat_file_message);
holder.filesharing.setVisibility(View.VISIBLE);
} else if (lastMessage.getTextContent() != null && lastMessage.getTextContent().length() > 0) {
holder.lastMessageView.setBackgroundResource(0);
holder.lastMessageView.setText(lastMessage.getTextContent());
holder.filesharing.setVisibility(View.GONE);
}
if (lastMessage.isOutgoing()) {