From 640aa7aee071159488857dff04fa2e8b49506c30 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Sat, 21 May 2016 23:06:03 +0200 Subject: show videopreview also in chatlist --- .../siacs/conversations/ui/adapter/ConversationAdapter.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java index afef5a1d1..9a6c24a83 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java @@ -3,12 +3,10 @@ package eu.siacs.conversations.ui.adapter; import android.content.Context; import android.content.res.Resources; import android.graphics.Bitmap; -import android.graphics.Color; import android.graphics.Typeface; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.AsyncTask; -import android.support.v4.content.ContextCompat; import android.util.Pair; import android.view.LayoutInflater; import android.view.View; @@ -90,6 +88,7 @@ public class ConversationAdapter extends ArrayAdapter { ImageView notificationStatus = (ImageView) view.findViewById(R.id.notification_status); Message message = conversation.getLatestMessage(); + String mimeType = message.getMimeType(); if (!conversation.isRead()) { convName.setTypeface(null, Typeface.BOLD); @@ -97,7 +96,13 @@ public class ConversationAdapter extends ArrayAdapter { convName.setTypeface(null, Typeface.NORMAL); } - if (message.getFileParams().width > 0 + if (mimeType != null) { + if (message.getMimeType().startsWith("video/")) { + mLastMessage.setVisibility(View.GONE); + imagePreview.setVisibility(View.VISIBLE); + activity.loadVideoPreview(message, imagePreview); + } + } else if (message.getFileParams().width > 0 && (message.getTransferable() == null || message.getTransferable().getStatus() != Transferable.STATUS_DELETED)) { mLastMessage.setVisibility(View.GONE); -- cgit v1.2.3