aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java18
-rw-r--r--src/main/res/values/attrs.xml5
-rw-r--r--src/main/res/values/themes.xml5
3 files changed, 28 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java
index c867dc068..b4b1d34df 100644
--- a/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java
+++ b/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java
@@ -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));
diff --git a/src/main/res/values/attrs.xml b/src/main/res/values/attrs.xml
index 3154a8443..83598c041 100644
--- a/src/main/res/values/attrs.xml
+++ b/src/main/res/values/attrs.xml
@@ -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> \ No newline at end of file
diff --git a/src/main/res/values/themes.xml b/src/main/res/values/themes.xml
index 4dc939b2d..01540d100 100644
--- a/src/main/res/values/themes.xml
+++ b/src/main/res/values/themes.xml
@@ -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">