diff options
Diffstat (limited to 'src/eu/siacs/conversations/ui/adapter/ConversationAdapter.java')
-rw-r--r-- | src/eu/siacs/conversations/ui/adapter/ConversationAdapter.java | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/eu/siacs/conversations/ui/adapter/ConversationAdapter.java b/src/eu/siacs/conversations/ui/adapter/ConversationAdapter.java index fcc57601..c3ff5b22 100644 --- a/src/eu/siacs/conversations/ui/adapter/ConversationAdapter.java +++ b/src/eu/siacs/conversations/ui/adapter/ConversationAdapter.java @@ -6,6 +6,7 @@ import eu.siacs.conversations.R; import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Message; import eu.siacs.conversations.ui.ConversationActivity; +import eu.siacs.conversations.ui.XmppActivity; import eu.siacs.conversations.utils.UIHelper; import android.content.Context; import android.graphics.Color; @@ -19,9 +20,9 @@ import android.widget.TextView; public class ConversationAdapter extends ArrayAdapter<Conversation> { - ConversationActivity activity; + private XmppActivity activity; - public ConversationAdapter(ConversationActivity activity, + public ConversationAdapter(XmppActivity activity, List<Conversation> conversations) { super(activity, 0, conversations); this.activity = activity; @@ -36,18 +37,21 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> { parent, false); } Conversation conv = getItem(position); - if (!activity.getSlidingPaneLayout().isSlideable()) { - if (conv == activity.getSelectedConversation()) { - view.setBackgroundColor(0xffdddddd); + if (this.activity instanceof ConversationActivity) { + ConversationActivity activity = (ConversationActivity) this.activity; + if (!activity.getSlidingPaneLayout().isSlideable()) { + if (conv == activity.getSelectedConversation()) { + view.setBackgroundColor(0xffdddddd); + } else { + view.setBackgroundColor(Color.TRANSPARENT); + } } else { view.setBackgroundColor(Color.TRANSPARENT); } - } else { - view.setBackgroundColor(Color.TRANSPARENT); } TextView convName = (TextView) view .findViewById(R.id.conversation_name); - convName.setText(conv.getName(true)); + convName.setText(conv.getName()); TextView convLastMsg = (TextView) view .findViewById(R.id.conversation_lastmsg); ImageView imagePreview = (ImageView) view @@ -59,7 +63,7 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> { || latestMessage.getType() == Message.TYPE_PRIVATE) { if ((latestMessage.getEncryption() != Message.ENCRYPTION_PGP) && (latestMessage.getEncryption() != Message.ENCRYPTION_DECRYPTION_FAILED)) { - convLastMsg.setText(conv.getLatestMessage().getBody()); + convLastMsg.setText(UIHelper.transformAsciiEmoticons(conv.getLatestMessage().getBody())); } else { convLastMsg.setText(activity .getText(R.string.encrypted_message_received)); |