aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--res/layout/activity_contact_details.xml15
-rw-r--r--res/layout/contact_key.xml22
-rw-r--r--src/eu/siacs/conversations/ui/ContactDetailsActivity.java37
3 files changed, 73 insertions, 1 deletions
diff --git a/res/layout/activity_contact_details.xml b/res/layout/activity_contact_details.xml
index cd49f1bf..1c38f4a3 100644
--- a/res/layout/activity_contact_details.xml
+++ b/res/layout/activity_contact_details.xml
@@ -91,5 +91,20 @@
android:text="Receive presence updates"
android:textSize="18sp"
android:textColor="#5b5b5b" />
+ <TextView
+ style="@style/sectionHeader"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="8dp"
+ android:text="Keys" />
+ <LinearLayout
+ android:id="@+id/details_contact_keys"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:divider="?android:dividerHorizontal"
+ android:showDividers="middle">
+ </LinearLayout>
+
</LinearLayout> \ No newline at end of file
diff --git a/res/layout/contact_key.xml b/res/layout/contact_key.xml
new file mode 100644
index 00000000..dcac42e9
--- /dev/null
+++ b/res/layout/contact_key.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:padding="8dp" >
+
+ <TextView
+ android:id="@+id/key"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textSize="18sp"
+ android:textColor="#5b5b5b"
+ android:typeface="monospace"
+ />
+ <TextView
+ android:id="@+id/key_type"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="#5b5b5b"
+ />
+ </LinearLayout> \ No newline at end of file
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