aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorChristian Schneppe <christian.schneppe@pix-art.de>2020-01-31 14:34:10 +0100
committerChristian Schneppe <christian.schneppe@pix-art.de>2020-01-31 14:34:10 +0100
commitb0d89ba6adced09cb7a6839024c1590fc68217c5 (patch)
tree3e2bbc6844d38c47959c306198ba6cb913155ac5 /src/main/java
parent82e4031e4d34f42c7983947dd695ff59a5f7edff (diff)
add icons for video, audio and image files for the case the preview fails
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
index 5eb425d69..778caf1b2 100644
--- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
+++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
@@ -684,6 +684,24 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
} catch (Exception e) {
e.printStackTrace();
}
+ } else if (mimeType != null && message.getMimeType().contains("video")) {
+ Drawable icon = activity.getResources().getDrawable(R.drawable.ic_video_grey600_48dp);
+ Drawable drawable = DrawableCompat.wrap(icon);
+ DrawableCompat.setTint(drawable, StyledAttributes.getColor(getContext(), R.attr.colorAccent));
+ viewHolder.download_button.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
+ viewHolder.download_button.setText(activity.getString(R.string.open_x_file, UIHelper.getFileDescriptionString(activity, message)));
+ } else if (mimeType != null && message.getMimeType().contains("image")) {
+ Drawable icon = activity.getResources().getDrawable(R.drawable.ic_image_grey600_48dp);
+ Drawable drawable = DrawableCompat.wrap(icon);
+ DrawableCompat.setTint(drawable, StyledAttributes.getColor(getContext(), R.attr.colorAccent));
+ viewHolder.download_button.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
+ viewHolder.download_button.setText(activity.getString(R.string.open_x_file, UIHelper.getFileDescriptionString(activity, message)));
+ } else if (mimeType != null && message.getMimeType().contains("audio")) {
+ Drawable icon = activity.getResources().getDrawable(R.drawable.ic_audio_grey600_48dp);
+ Drawable drawable = DrawableCompat.wrap(icon);
+ DrawableCompat.setTint(drawable, StyledAttributes.getColor(getContext(), R.attr.colorAccent));
+ viewHolder.download_button.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
+ viewHolder.download_button.setText(activity.getString(R.string.open_x_file, UIHelper.getFileDescriptionString(activity, message)));
} else {
Drawable icon = activity.getResources().getDrawable(R.drawable.ic_file_grey600_48dp);
Drawable drawable = DrawableCompat.wrap(icon);