From fdcbdfdc0500e9cad97d716def5112d2bec91e19 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 5 Jan 2015 18:46:42 +0100 Subject: [PATCH] added debug info + possible platform bug work arounds to message adapter --- .../siacs/conversations/ui/adapter/MessageAdapter.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java index ae3c1834d..5b5664c6e 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java @@ -10,6 +10,7 @@ import android.text.SpannableString; import android.text.style.ForegroundColorSpan; import android.text.style.StyleSpan; import android.util.DisplayMetrics; +import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnLongClickListener; @@ -23,6 +24,7 @@ import android.widget.Toast; import java.util.List; +import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Contact; @@ -430,6 +432,11 @@ public class MessageAdapter extends ArrayAdapter { } return view; } else if (type == NULL) { + if (viewHolder.message_box != null) { + Log.e(Config.LOGTAG, "detected type=NULL but with wrong cached view"); + view = activity.getLayoutInflater().inflate(R.layout.message_null, parent, false); + view.setTag(new ViewHolder()); + } if (position == getCount() - 1) { view.getLayoutParams().height = 1; } else { @@ -438,6 +445,9 @@ public class MessageAdapter extends ArrayAdapter { } view.setLayoutParams(view.getLayoutParams()); return view; + } else if (message.wasMergedIntoPrevious()) { + Log.e(Config.LOGTAG,"detected wasMergedIntoPrevious with wrong type"); + return view; } else if (viewHolder.messageBody == null || viewHolder.image == null) { return view; //avoiding weird platform bugs } else if (type == RECEIVED) {