diff options
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/adapter/MediaPreviewAdapter.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/adapter/MediaPreviewAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/MediaPreviewAdapter.java index c89ce6216..3d9bce508 100644 --- a/src/main/java/de/pixart/messenger/ui/adapter/MediaPreviewAdapter.java +++ b/src/main/java/de/pixart/messenger/ui/adapter/MediaPreviewAdapter.java @@ -17,6 +17,7 @@ import android.widget.ImageView; import java.lang.ref.WeakReference; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.concurrent.RejectedExecutionException; @@ -29,6 +30,15 @@ import de.pixart.messenger.ui.util.StyledAttributes; public class MediaPreviewAdapter extends RecyclerView.Adapter<MediaPreviewAdapter.MediaPreviewViewHolder> { + private static final List<String> DOCUMENT_MIMES = Arrays.asList( + "application/pdf", + "application/vnd.oasis.opendocument.text", + "application/msword", + "application/vnd.openxmlformats-officedocument.wordprocessingml.document", + "text/x-tex", + "text/plain" + ); + private final ArrayList<Attachment> mediaPreviews = new ArrayList<>(); private final ConversationFragment conversationFragment; @@ -89,7 +99,7 @@ public class MediaPreviewAdapter extends RecyclerView.Adapter<MediaPreviewAdapte } else { final String mime = attachment.getMime(); if (mime == null) { - attr = R.attr.media_preview_file; + attr = R.attr.media_preview_unknown; } else if (mime.startsWith("audio/")) { attr = R.attr.media_preview_audio; } else if (mime.equals("text/calendar") || (mime.equals("text/x-vcalendar"))) { @@ -100,8 +110,10 @@ public class MediaPreviewAdapter extends RecyclerView.Adapter<MediaPreviewAdapte attr = R.attr.media_preview_app; } else if (mime.equals("application/zip") || mime.equals("application/rar")) { attr = R.attr.media_preview_archive; + } else if (DOCUMENT_MIMES.contains(mime)) { + attr = R.attr.media_preview_document; } else { - attr = R.attr.media_preview_file; + attr = R.attr.media_preview_unknown; } } holder.binding.mediaPreview.setImageDrawable(StyledAttributes.getDrawable(context, attr)); |