mirror of
https://github.com/moparisthebest/Conversations
synced 2024-12-25 17:08:47 -05:00
display keys in contact details
This commit is contained in:
parent
e319dd2cee
commit
c666b086d6
@ -91,5 +91,20 @@
|
|||||||
android:text="Receive presence updates"
|
android:text="Receive presence updates"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
android:textColor="#5b5b5b" />
|
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>
|
</LinearLayout>
|
22
res/layout/contact_key.xml
Normal file
22
res/layout/contact_key.xml
Normal file
@ -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>
|
@ -1,6 +1,11 @@
|
|||||||
package eu.siacs.conversations.ui;
|
package eu.siacs.conversations.ui;
|
||||||
|
|
||||||
|
import java.math.BigInteger;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.zip.Inflater;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
@ -8,12 +13,15 @@ import android.os.Bundle;
|
|||||||
import android.provider.ContactsContract.CommonDataKinds;
|
import android.provider.ContactsContract.CommonDataKinds;
|
||||||
import android.provider.ContactsContract.Contacts;
|
import android.provider.ContactsContract.Contacts;
|
||||||
import android.provider.ContactsContract.Intents;
|
import android.provider.ContactsContract.Intents;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
import android.widget.QuickContactBadge;
|
import android.widget.QuickContactBadge;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import eu.siacs.conversations.R;
|
import eu.siacs.conversations.R;
|
||||||
@ -83,6 +91,8 @@ public class ContactDetailsActivity extends XmppActivity {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private LinearLayout keys;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -97,7 +107,7 @@ public class ContactDetailsActivity extends XmppActivity {
|
|||||||
send = (CheckBox) findViewById(R.id.details_send_presence);
|
send = (CheckBox) findViewById(R.id.details_send_presence);
|
||||||
receive = (CheckBox) findViewById(R.id.details_receive_presence);
|
receive = (CheckBox) findViewById(R.id.details_receive_presence);
|
||||||
badge = (QuickContactBadge) findViewById(R.id.details_contact_badge);
|
badge = (QuickContactBadge) findViewById(R.id.details_contact_badge);
|
||||||
|
keys = (LinearLayout) findViewById(R.id.details_contact_keys);
|
||||||
getActionBar().setHomeButtonEnabled(true);
|
getActionBar().setHomeButtonEnabled(true);
|
||||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
@ -211,6 +221,31 @@ public class ContactDetailsActivity extends XmppActivity {
|
|||||||
if (contact.getSystemAccount() == null) {
|
if (contact.getSystemAccount() == null) {
|
||||||
badge.setOnClickListener(onBadgeClick);
|
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
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user