aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2016-05-21 23:40:48 +0200
committerChristian Schneppe <christian@pix-art.de>2016-05-21 23:40:48 +0200
commit71d07cf545cc1529c76a3d1654c508861374c20c (patch)
tree0a3a7850b248e2fe9c5466e7b9c677d13dcd889d /src
parent5709a053b72eb04c7ac7f2ca357e17f75699fdaa (diff)
fixed crash with videopreviews in chatlist
Diffstat (limited to 'src')
-rw-r--r--src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java34
1 files changed, 26 insertions, 8 deletions
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 9a6c24a83..3625a371e 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java
@@ -96,18 +96,36 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> {
convName.setTypeface(null, Typeface.NORMAL);
}
- if (mimeType != null) {
- if (message.getMimeType().startsWith("video/")) {
+
+ if ((message.getTransferable() == null
+ || message.getTransferable().getStatus() != Transferable.STATUS_DELETED)) {
+ if (mimeType != null && message.getMimeType().startsWith("video/")) {
mLastMessage.setVisibility(View.GONE);
imagePreview.setVisibility(View.VISIBLE);
activity.loadVideoPreview(message, imagePreview);
+ } else if (message.getFileParams().width > 0) {
+ mLastMessage.setVisibility(View.GONE);
+ imagePreview.setVisibility(View.VISIBLE);
+ activity.loadBitmap(message, imagePreview);
+ } else {
+ Pair<String, Boolean> preview = UIHelper.getMessagePreview(activity, message);
+ mLastMessage.setVisibility(View.VISIBLE);
+ imagePreview.setVisibility(View.GONE);
+ mLastMessage.setText(preview.first);
+ if (preview.second) {
+ if (conversation.isRead()) {
+ mLastMessage.setTypeface(null, Typeface.ITALIC);
+ } else {
+ mLastMessage.setTypeface(null, Typeface.BOLD_ITALIC);
+ }
+ } else {
+ if (conversation.isRead()) {
+ mLastMessage.setTypeface(null, Typeface.NORMAL);
+ } else {
+ mLastMessage.setTypeface(null, Typeface.BOLD);
+ }
+ }
}
- } else if (message.getFileParams().width > 0
- && (message.getTransferable() == null
- || message.getTransferable().getStatus() != Transferable.STATUS_DELETED)) {
- mLastMessage.setVisibility(View.GONE);
- imagePreview.setVisibility(View.VISIBLE);
- activity.loadBitmap(message, imagePreview);
} else {
Pair<String, Boolean> preview = UIHelper.getMessagePreview(activity, message);
mLastMessage.setVisibility(View.VISIBLE);