diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java index 202c80357..c4949636e 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java @@ -58,6 +58,7 @@ public class ConversationAdapter extends ArrayAdapter { convName.setText(conversation.getJid().toBareJid().toString()); } TextView mLastMessage = (TextView) view.findViewById(R.id.conversation_lastmsg); + ImageView mLastMessageImage = (ImageView) view.findViewById(R.id.conversation_lastmsg_img); TextView mTimestamp = (TextView) view.findViewById(R.id.conversation_lastupdate); TextView mSenderName = (TextView) view.findViewById(R.id.sender_name); ImageView imagePreview = (ImageView) view.findViewById(R.id.conversation_lastimage); @@ -84,11 +85,13 @@ public class ConversationAdapter extends ArrayAdapter { || message.getTransferable().getStatus() != Transferable.STATUS_DELETED)) { mSenderName.setVisibility(View.GONE); mLastMessage.setVisibility(View.GONE); + mLastMessageImage.setVisibility(View.GONE); imagePreview.setVisibility(View.VISIBLE); activity.loadBitmap(message, imagePreview); } else { Pair preview = UIHelper.getMessagePreview(activity,message); mLastMessage.setVisibility(View.VISIBLE); + mLastMessageImage.setVisibility(View.VISIBLE); imagePreview.setVisibility(View.GONE); mLastMessage.setText(preview.first); if (preview.second) { @@ -121,6 +124,15 @@ public class ConversationAdapter extends ArrayAdapter { } else { mSenderName.setVisibility(View.GONE); } + if (message.getFileParams().runtime > 0) { + mLastMessageImage.setImageResource(activity.getThemeResource(R.attr.ic_attach_record, R.drawable.ic_attach_record)); + } else if (message.getType() == Message.TYPE_FILE) { + mLastMessageImage.setImageResource(activity.getThemeResource(R.attr.ic_attach_document, R.drawable.ic_attach_document)); + } else if (message.isGeoUri()) { + mLastMessageImage.setImageResource(activity.getThemeResource(R.attr.ic_attach_location, R.drawable.ic_attach_location)); + } else { + mLastMessageImage.setVisibility(View.GONE); + } } long muted_till = conversation.getLongAttribute(Conversation.ATTRIBUTE_MUTED_TILL,0); @@ -230,4 +242,4 @@ public class ConversationAdapter extends ArrayAdapter { return bitmapWorkerTaskReference.get(); } } -} \ No newline at end of file +} diff --git a/src/main/res/layout/conversation_list_row.xml b/src/main/res/layout/conversation_list_row.xml index 44e7553f5..dfcec3d02 100644 --- a/src/main/res/layout/conversation_list_row.xml +++ b/src/main/res/layout/conversation_list_row.xml @@ -74,11 +74,16 @@ + + - \ No newline at end of file +