aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/ui/adapter
diff options
context:
space:
mode:
authorSam Whited <sam@samwhited.com>2014-11-07 09:09:28 -0500
committerSam Whited <sam@samwhited.com>2014-11-09 07:00:40 -0500
commitdd426ca6de3b764f8c748486b15220b42504930e (patch)
tree77e2e323464a6b8ea1ab358aae2efd04ba69b607 /src/main/java/eu/siacs/conversations/ui/adapter
parent1f5908b1d1dcc7da971659157dbab9345390768a (diff)
Format contact names in MUC properly
Diffstat (limited to 'src/main/java/eu/siacs/conversations/ui/adapter')
-rw-r--r--src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java25
1 files changed, 13 insertions, 12 deletions
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 ffd0b4e9..17253cff 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
@@ -149,7 +149,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
info = contact.getDisplayName();
} else {
if (message.getPresence() != null) {
- info = message.getPresence().toString();
+ info = message.getPresence().getResourcepart();
} else {
info = message.getCounterpart().toString();
}
@@ -246,8 +246,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
} else {
to = message.getCounterpart();
}
- privateMarker = activity.getString(
- R.string.private_message_to, to);
+ privateMarker = activity.getString(R.string.private_message_to, to);
}
SpannableString span = new SpannableString(privateMarker + " "
+ message.getBody());
@@ -436,7 +435,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
viewHolder.contact_picture.setImageBitmap(activity.avatarService().get(item.getConversation().getAccount(), activity.getPixel(48)));
}
- if (viewHolder.contact_picture != null) {
+ if (viewHolder != null && viewHolder.contact_picture != null) {
viewHolder.contact_picture
.setOnClickListener(new OnClickListener() {
@@ -501,14 +500,16 @@ public class MessageAdapter extends ArrayAdapter<Message> {
} else {
displayInfoMessage(viewHolder,
R.string.install_openkeychain);
- viewHolder.message_box
- .setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- activity.showInstallPgpDialog();
- }
- });
+ if (viewHolder != null) {
+ viewHolder.message_box
+ .setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ activity.showInstallPgpDialog();
+ }
+ });
+ }
}
} else if (item.getEncryption() == Message.ENCRYPTION_DECRYPTION_FAILED) {
displayDecryptionFailed(viewHolder);