aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/ui
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-09-07 23:08:40 +0200
committeriNPUTmice <daniel@gultsch.de>2014-09-07 23:08:40 +0200
commit449c2a544b48a2b9adf0df094eb1ac0d49531ebe (patch)
tree958a9c6421028e08d7ae84059d0b26bc0ed39ed0 /src/eu/siacs/conversations/ui
parent90947597e5a89e2adc6c75d52c8458ee153ee163 (diff)
fixed #321 - delete otr fingerprints
Diffstat (limited to 'src/eu/siacs/conversations/ui')
-rw-r--r--src/eu/siacs/conversations/ui/ContactDetailsActivity.java35
1 files changed, 32 insertions, 3 deletions
diff --git a/src/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/eu/siacs/conversations/ui/ContactDetailsActivity.java
index a9153db1b..17ea5f98b 100644
--- a/src/eu/siacs/conversations/ui/ContactDetailsActivity.java
+++ b/src/eu/siacs/conversations/ui/ContactDetailsActivity.java
@@ -23,6 +23,7 @@ import android.view.View.OnClickListener;
import android.widget.CheckBox;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.CompoundButton;
+import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.QuickContactBadge;
import android.widget.TextView;
@@ -323,16 +324,25 @@ public class ContactDetailsActivity extends XmppActivity {
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);
+ final String otrFingerprint = iterator.next();
+ View view = (View) inflater.inflate(R.layout.contact_key, keys,false);
TextView key = (TextView) view.findViewById(R.id.key);
TextView keyType = (TextView) view.findViewById(R.id.key_type);
+ ImageButton remove = (ImageButton) view.findViewById(R.id.button_remove);
+ remove.setVisibility(View.VISIBLE);
keyType.setText("OTR Fingerprint");
key.setText(otrFingerprint);
keys.addView(view);
+ remove.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ confirmToDeleteFingerprint(otrFingerprint);
+ }
+ });
}
if (contact.getPgpKeyId() != 0) {
- View view = (View) inflater.inflate(R.layout.contact_key, null);
+ View view = (View) inflater.inflate(R.layout.contact_key, keys,false);
TextView key = (TextView) view.findViewById(R.id.key);
TextView keyType = (TextView) view.findViewById(R.id.key_type);
keyType.setText("PGP Key ID");
@@ -360,6 +370,25 @@ public class ContactDetailsActivity extends XmppActivity {
keys.addView(view);
}
}
+
+ protected void confirmToDeleteFingerprint(final String fingerprint) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ builder.setTitle(R.string.delete_fingerprint);
+ builder.setMessage(R.string.sure_delete_fingerprint);
+ builder.setNegativeButton(R.string.cancel, null);
+ builder.setPositiveButton(R.string.delete,new android.content.DialogInterface.OnClickListener() {
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ if (contact.deleteOtrFingerprint(fingerprint)) {
+ populateView();
+ xmppConnectionService.syncRosterToDisk(contact.getAccount());
+ }
+ }
+
+ });
+ builder.create().show();
+ }
@Override
public void onBackendConnected() {