aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2014-03-06 20:00:46 +0100
committerDaniel Gultsch <daniel@gultsch.de>2014-03-06 20:00:46 +0100
commitc666b086d6be3d993b0b9c52a6aab916cd6942ab (patch)
tree99b6e7376bd9e5b0f5b26c88e3b1cc5d301fc712 /src/eu/siacs
parente319dd2cee7dc2597d4e9fcb8b52fe75b96c7b39 (diff)
display keys in contact details
Diffstat (limited to 'src/eu/siacs')
-rw-r--r--src/eu/siacs/conversations/ui/ContactDetailsActivity.java37
1 files changed, 36 insertions, 1 deletions
diff --git a/src/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/eu/siacs/conversations/ui/ContactDetailsActivity.java
index 23fb68a1..e1fb25d4 100644
--- a/src/eu/siacs/conversations/ui/ContactDetailsActivity.java
+++ b/src/eu/siacs/conversations/ui/ContactDetailsActivity.java
@@ -1,6 +1,11 @@
package eu.siacs.conversations.ui;
+import java.math.BigInteger;
+import java.util.Iterator;
+import java.util.zip.Inflater;
+
import android.app.AlertDialog;
+import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
@@ -8,12 +13,15 @@ import android.os.Bundle;
import android.provider.ContactsContract.CommonDataKinds;
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Intents;
+import android.util.Log;
+import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.CheckBox;
import android.widget.EditText;
+import android.widget.LinearLayout;
import android.widget.QuickContactBadge;
import android.widget.TextView;
import eu.siacs.conversations.R;
@@ -83,6 +91,8 @@ public class ContactDetailsActivity extends XmppActivity {
}
};
+ private LinearLayout keys;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -97,7 +107,7 @@ public class ContactDetailsActivity extends XmppActivity {
send = (CheckBox) findViewById(R.id.details_send_presence);
receive = (CheckBox) findViewById(R.id.details_receive_presence);
badge = (QuickContactBadge) findViewById(R.id.details_contact_badge);
-
+ keys = (LinearLayout) findViewById(R.id.details_contact_keys);
getActionBar().setHomeButtonEnabled(true);
getActionBar().setDisplayHomeAsUpEnabled(true);
@@ -211,6 +221,31 @@ public class ContactDetailsActivity extends XmppActivity {
if (contact.getSystemAccount() == null) {
badge.setOnClickListener(onBadgeClick);
}
+
+ keys.removeAllViews();
+ LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ for (Iterator<String> iterator = contact.getOtrFingerprints().iterator(); iterator
+ .hasNext();) {
+ String otrFingerprint = iterator.next();
+ 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("OTR Fingerprint");
+ 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());
+ builder.insert(8, " ");
+ key.setText(builder.toString());
+ keys.addView(view);
+ }
}
@Override