diff options
author | Beriain <beriain@bitmessage.ch> | 2014-05-12 17:09:32 +0200 |
---|---|---|
committer | Beriain <beriain@bitmessage.ch> | 2014-05-12 17:09:32 +0200 |
commit | 75f7695087355978a236a701283a86bacdd8a54c (patch) | |
tree | 516c1262b83a4a4ae5240a8451c10c79eb31584c /src/eu/siacs/conversations/ui/ContactDetailsActivity.java | |
parent | 42c07bf4ae83a4bc51664fdf35f02b917b57baa4 (diff) | |
parent | 4be8280beb9c61e4a11b67b61617455dbe52b466 (diff) |
Merge https://github.com/siacs/Conversations into development
Diffstat (limited to 'src/eu/siacs/conversations/ui/ContactDetailsActivity.java')
-rw-r--r-- | src/eu/siacs/conversations/ui/ContactDetailsActivity.java | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/eu/siacs/conversations/ui/ContactDetailsActivity.java index 1ed3fa13..eaa9b8ee 100644 --- a/src/eu/siacs/conversations/ui/ContactDetailsActivity.java +++ b/src/eu/siacs/conversations/ui/ContactDetailsActivity.java @@ -4,10 +4,14 @@ import java.math.BigInteger; import java.util.Iterator; import java.util.Locale; +import org.openintents.openpgp.util.OpenPgpUtils; + import android.app.AlertDialog; +import android.app.PendingIntent; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; +import android.content.IntentSender.SendIntentException; import android.net.Uri; import android.os.Bundle; import android.provider.ContactsContract.CommonDataKinds; @@ -26,6 +30,7 @@ import android.widget.QuickContactBadge; import android.widget.TextView; import android.widget.Toast; import eu.siacs.conversations.R; +import eu.siacs.conversations.crypto.PgpEngine; import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.entities.Presences; import eu.siacs.conversations.utils.UIHelper; @@ -252,17 +257,29 @@ public class ContactDetailsActivity extends XmppActivity { key.setText(otrFingerprint); keys.addView(view); } - Log.d("gultsch", "pgp key id " + contact.getPgpKeyId()); if (contact.getPgpKeyId() != 0) { View view = (View) inflater.inflate(R.layout.contact_key, null); TextView key = (TextView) view.findViewById(R.id.key); TextView keyType = (TextView) view.findViewById(R.id.key_type); keyType.setText("PGP Key ID"); - BigInteger bi = new BigInteger("" + contact.getPgpKeyId()); - StringBuilder builder = new StringBuilder(bi.toString(16) - .toUpperCase(Locale.US)); - builder.insert(8, " "); - key.setText(builder.toString()); + key.setText(OpenPgpUtils.convertKeyIdToHex(contact.getPgpKeyId())); + view.setOnClickListener(new OnClickListener() { + + @Override + public void onClick(View v) { + PgpEngine pgp = activity.xmppConnectionService.getPgpEngine(); + if (pgp!=null) { + PendingIntent intent = pgp.getIntentForKey(contact); + if (intent!=null) { + try { + startIntentSenderForResult(intent.getIntentSender(), 0, null, 0, 0, 0); + } catch (SendIntentException e) { + + } + } + } + } + }); keys.addView(view); } } |