aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java')
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java29
1 files changed, 27 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 de0979a60..4f2f5e7b2 100644
--- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
@@ -2,6 +2,7 @@ package eu.siacs.conversations.ui;
import android.app.AlertDialog;
import android.app.PendingIntent;
+import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@@ -41,8 +42,8 @@ import eu.siacs.conversations.crypto.axolotl.AxolotlService;
import eu.siacs.conversations.crypto.axolotl.XmppAxolotlSession;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Contact;
+import eu.siacs.conversations.entities.Conversation;
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;
@@ -56,6 +57,7 @@ import eu.siacs.conversations.xmpp.jid.Jid;
public class ContactDetailsActivity extends XmppActivity implements OnAccountUpdate, OnRosterUpdate, OnUpdateBlocklist, OnKeyStatusUpdated {
public static final String ACTION_VIEW_CONTACT = "view_contact";
+ private Conversation mConversation;
private Contact contact;
private DialogInterface.OnClickListener removeFromRoster = new DialogInterface.OnClickListener() {
@@ -107,6 +109,7 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
private Jid contactJid;
private TextView contactJidTv;
private TextView accountJidTv;
+ private TextView lastseen;
private TextView statusMessage;
private CheckBox send;
private CheckBox receive;
@@ -203,6 +206,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);
@@ -225,6 +229,18 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
this.showDynamicTags = preferences.getBoolean("show_dynamic_tags",false);
}
+ private void share() {
+ Intent shareIntent = new Intent();
+ shareIntent.setAction(Intent.ACTION_SEND);
+ shareIntent.putExtra(Intent.EXTRA_TEXT, getShareableUri());
+ shareIntent.setType("text/plain");
+ try {
+ startActivity(Intent.createChooser(shareIntent, getText(R.string.share_uri_with)));
+ } catch (ActivityNotFoundException e) {
+ Toast.makeText(this, R.string.no_application_to_share_uri, Toast.LENGTH_SHORT).show();
+ }
+ }
+
@Override
public boolean onOptionsItemSelected(final MenuItem menuItem) {
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
@@ -263,6 +279,9 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
startActivity(intent);
}
break;
+ case R.id.action_share:
+ share();
+ break;
case R.id.action_block:
BlockContactDialog.show(this, xmppConnectionService, contact);
break;
@@ -371,6 +390,12 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
statusMessage.setVisibility(View.GONE);
}
+ if (contact.isBlocked() && !this.showDynamicTags) {
+ lastseen.setText(R.string.contact_blocked);
+ } else {
+ lastseen.setText(UIHelper.lastseen(getApplicationContext(), contact.lastseen.time));
+ }
+
if (contact.getPresences().size() > 1) {
contactJidTv.setText(contact.getDisplayJid() + " ("
+ contact.getPresences().size() + ")");
@@ -384,7 +409,7 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
account = contact.getAccount().getJid().toBareJid().toString();
}
accountJidTv.setText(getString(R.string.using_account, account));
- badge.setImageBitmap(avatarService().get(contact, getPixel(72)));
+ badge.setImageBitmap(avatarService().get(contact, getPixel(Config.AVATAR_SIZE)));
badge.setOnClickListener(this.onBadgeClick);
keys.removeAllViews();