diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-06-04 16:16:14 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2016-06-04 16:16:14 +0200 |
commit | 71e911717697078141c3669134ad9268e9753ea0 (patch) | |
tree | 93c9833d28048c15aefe4109105523a4a0e002d9 /src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java | |
parent | 6639d0f23bb983cae7234d6b15f9875464c67093 (diff) |
opt-in to send last userinteraction in presence
Diffstat (limited to 'src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java index de0979a60..b67aae187 100644 --- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java @@ -104,6 +104,7 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd } }; private Jid accountJid; + private TextView lastseen; private Jid contactJid; private TextView contactJidTv; private TextView accountJidTv; @@ -114,7 +115,8 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd private QuickContactBadge badge; private LinearLayout keys; private LinearLayout tags; - private boolean showDynamicTags; + private boolean showDynamicTags = false; + private boolean showLastSeen = false; private String messageFingerprint; private DialogInterface.OnClickListener addToPhonebook = new DialogInterface.OnClickListener() { @@ -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); @@ -220,9 +223,14 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd getActionBar().setHomeButtonEnabled(true); getActionBar().setDisplayHomeAsUpEnabled(true); } + } + @Override + public void onStart() { + super.onStart(); final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); this.showDynamicTags = preferences.getBoolean("show_dynamic_tags",false); + this.showLastSeen = preferences.getBoolean("last_activity", false); } @Override @@ -371,6 +379,18 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd statusMessage.setVisibility(View.GONE); } + if (contact.isBlocked() && !this.showDynamicTags) { + lastseen.setVisibility(View.VISIBLE); + lastseen.setText(R.string.contact_blocked); + } else { + if (showLastSeen && contact.getLastseen() > 0) { + lastseen.setVisibility(View.VISIBLE); + lastseen.setText(UIHelper.lastseen(getApplicationContext(), contact.isActive(), contact.getLastseen())); + } else { + lastseen.setVisibility(View.GONE); + } + } + if (contact.getPresences().size() > 1) { contactJidTv.setText(contact.getDisplayJid() + " (" + contact.getPresences().size() + ")"); |