add drawables for some more filetypes in chatlist

This commit is contained in:
Christian Schneppe 2017-11-30 22:00:59 +01:00
parent ca043ddd4d
commit dbb240d043
3 changed files with 28 additions and 0 deletions

View file

@ -123,10 +123,28 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> {
activity.loadBitmap(message, viewHolder.lastImage);
} else {
final boolean showPreviewText;
final String mimeType = message.getMimeType();
if (message.getType() == Message.TYPE_FILE && fileAvailable) {
if (message.getFileParams().runtime > 0) {
showPreviewText = false;
viewHolder.lastMessageIcon.setImageResource(activity.getThemeResource(R.attr.ic_attach_record, R.drawable.ic_attach_record));
} else if (mimeType != null) {
if (mimeType.contains("pdf")) {
showPreviewText = false;
viewHolder.lastMessageIcon.setImageResource(activity.getThemeResource(R.attr.ic_file_pdf, R.drawable.ic_file_pdf_grey600_48dp));
} else if (mimeType.contains("vcard")) {
showPreviewText = false;
viewHolder.lastMessageIcon.setImageResource(activity.getThemeResource(R.attr.ic_file_vcard, R.drawable.ic_account_card_details_grey600_48dp));
} else if (mimeType.contains("calendar")) {
showPreviewText = false;
viewHolder.lastMessageIcon.setImageResource(activity.getThemeResource(R.attr.ic_file_calendar, R.drawable.ic_calendar_grey600_48dp));
} else if (mimeType.equals("application/vnd.android.package-archive")) {
showPreviewText = false;
viewHolder.lastMessageIcon.setImageResource(activity.getThemeResource(R.attr.ic_file_apk, R.drawable.ic_file_grey600_48dp));
} else {
showPreviewText = true;
viewHolder.lastMessageIcon.setImageResource(activity.getThemeResource(R.attr.ic_attach_document, R.drawable.ic_attach_document));
}
} else {
showPreviewText = true;
viewHolder.lastMessageIcon.setImageResource(activity.getThemeResource(R.attr.ic_attach_document, R.drawable.ic_attach_document));

View file

@ -49,4 +49,9 @@
<attr name="ic_attach_record" format="reference" />
<attr name="ic_attach_video" format="reference" />
<attr name="ic_file_apk" format="reference" />
<attr name="ic_file_pdf" format="reference" />
<attr name="ic_file_vcard" format="reference" />
<attr name="ic_file_calendar" format="reference" />
</resources>

View file

@ -47,6 +47,11 @@
<item name="attr/ic_attach_photo">@drawable/ic_attach_photo</item>
<item name="attr/ic_attach_video">@drawable/ic_attach_video</item>
<item name="attr/ic_attach_record">@drawable/ic_attach_record</item>
<item name="attr/ic_file_apk">@drawable/ic_file_grey600_48dp</item>
<item name="attr/ic_file_pdf">@drawable/ic_file_pdf_grey600_48dp</item>
<item name="attr/ic_file_vcard">@drawable/ic_account_card_details_grey600_48dp</item>
<item name="attr/ic_file_calendar">@drawable/ic_calendar_grey600_48dp</item>
</style>
<style name="ConversationsTheme.LargerText" parent="ConversationsTheme">