diff options
author | Christian S <christian@pix-art.de> | 2016-04-30 21:10:24 +0200 |
---|---|---|
committer | Christian S <christian@pix-art.de> | 2016-04-30 21:10:24 +0200 |
commit | ab37336d1edc446f17d7a7aaeb653efb170283d9 (patch) | |
tree | 609ca7afbc7bd0c4af0344af310fa0bd352bd4ae /src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java | |
parent | fe60bd582aee184b49d1af14357cb88ad2637c3e (diff) | |
parent | 936006173ce11111f10c0bddd66d28c439ca584e (diff) |
Merge remote-tracking branch 'refs/remotes/siacs/master' into development
Diffstat (limited to 'src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java index a43709ae5..415269d74 100644 --- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java @@ -42,6 +42,7 @@ import eu.siacs.conversations.crypto.axolotl.XmppAxolotlSession; import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.entities.ListItem; +import eu.siacs.conversations.entities.Presence; import eu.siacs.conversations.services.XmppConnectionService.OnAccountUpdate; import eu.siacs.conversations.services.XmppConnectionService.OnRosterUpdate; import eu.siacs.conversations.utils.CryptoHelper; @@ -107,6 +108,7 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd private TextView contactJidTv; private TextView accountJidTv; private TextView lastseen; + private TextView statusMessage; private CheckBox send; private CheckBox receive; private Button addContactButton; @@ -203,6 +205,7 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd contactJidTv = (TextView) findViewById(R.id.details_contactjid); accountJidTv = (TextView) findViewById(R.id.details_account); lastseen = (TextView) findViewById(R.id.details_lastseen); + statusMessage = (TextView) findViewById(R.id.status_message); send = (CheckBox) findViewById(R.id.details_send_presence); receive = (CheckBox) findViewById(R.id.details_receive_presence); badge = (QuickContactBadge) findViewById(R.id.details_contact_badge); @@ -310,6 +313,25 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd send.setOnCheckedChangeListener(null); receive.setOnCheckedChangeListener(null); + List<String> statusMessages = contact.getPresences().getStatusMessages(); + if (statusMessages.size() == 0) { + statusMessage.setVisibility(View.GONE); + } else { + StringBuilder builder = new StringBuilder(); + statusMessage.setVisibility(View.VISIBLE); + int s = statusMessages.size(); + for(int i = 0; i < s; ++i) { + if (s > 1) { + builder.append("• "); + } + builder.append(statusMessages.get(i)); + if (i < s - 1) { + builder.append("\n"); + } + } + statusMessage.setText(builder); + } + if (contact.getOption(Contact.Options.FROM)) { send.setText(R.string.send_presence_updates); send.setChecked(true); @@ -342,13 +364,13 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd receive.setEnabled(false); send.setEnabled(false); } - send.setOnCheckedChangeListener(this.mOnSendCheckedChange); receive.setOnCheckedChangeListener(this.mOnReceiveCheckedChange); } else { addContactButton.setVisibility(View.VISIBLE); send.setVisibility(View.GONE); receive.setVisibility(View.GONE); + statusMessage.setVisibility(View.GONE); } if (contact.isBlocked() && !this.showDynamicTags) { @@ -439,7 +461,7 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd keys.setVisibility(View.GONE); } - List<ListItem.Tag> tagList = contact.getTags(); + List<ListItem.Tag> tagList = contact.getTags(this); if (tagList.size() == 0 || !this.showDynamicTags) { tags.setVisibility(View.GONE); } else { |