From 3b6daca1c84282ae0530fd76cdf772476d815382 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Wed, 26 Apr 2017 20:19:06 +0200 Subject: fixed click area for pgp key in contact details --- .../messenger/ui/ContactDetailsActivity.java | 29 +++++++++------------- 1 file changed, 12 insertions(+), 17 deletions(-) (limited to 'src/main/java/de/pixart/messenger') diff --git a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java index 8a2e72145..1c54d2ff3 100644 --- a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java @@ -2,11 +2,9 @@ package de.pixart.messenger.ui; import android.app.ActionBar; 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.content.SharedPreferences; import android.net.Uri; import android.os.Bundle; @@ -611,26 +609,23 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp keyType.setTextColor(ContextCompat.getColor(this, R.color.accent)); } key.setText(OpenPgpUtils.convertKeyIdToHex(contact.getPgpKeyId())); - view.setOnClickListener(new OnClickListener() { + final OnClickListener openKey = new OnClickListener() { @Override public void onClick(View v) { - PgpEngine pgp = ContactDetailsActivity.this.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) { - - } - } + PgpEngine pgp = ContactDetailsActivity.this.xmppConnectionService.getPgpEngine(); + try { + startIntentSenderForResult( + pgp.getIntentForKey(contact).getIntentSender(), 0, null, 0, + 0, 0); + } catch (Throwable e) { + Toast.makeText(ContactDetailsActivity.this, R.string.openpgp_error, Toast.LENGTH_SHORT).show(); } } - }); + }; + view.setOnClickListener(openKey); + key.setOnClickListener(openKey); + keyType.setOnClickListener(openKey); keys.addView(view); } keysWrapper.setVisibility(hasKeys ? View.VISIBLE : View.GONE); -- cgit v1.2.3