aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-11-30 22:00:59 +0100
committerChristian Schneppe <christian@pix-art.de>2017-11-30 22:00:59 +0100
commitdbb240d043ac0affd09674c3cb053b4e7b0596b1 (patch)
tree0b579552faba5a50df5d075e2d72681a3690e18d /src
parentca043ddd4daf82661722692e84b71d6d0191c160 (diff)
add drawables for some more filetypes in chatlist
Diffstat (limited to 'src')
-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">