From 4d1308e138f6d3cc456e38af946e58f19a0a98ac Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 25 Apr 2017 15:23:01 +0200 Subject: [PATCH] fixed click area for pgp key in contact details --- .../ui/ContactDetailsActivity.java | 27 +++++++++---------- src/main/res/layout/contact.xml | 2 +- src/main/res/layout/contact_key.xml | 6 +++-- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java index cee60bf6b..313c7dea2 100644 --- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java @@ -505,26 +505,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); diff --git a/src/main/res/layout/contact.xml b/src/main/res/layout/contact.xml index eb4069bab..68db0d701 100644 --- a/src/main/res/layout/contact.xml +++ b/src/main/res/layout/contact.xml @@ -50,7 +50,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="?attr/color_text_primary" - android:textSize="?attr/TextSizeHeadline" + android:textSize="?attr/TextSizeBody" android:typeface="monospace" android:fontFamily="monospace" android:visibility="gone" /> diff --git a/src/main/res/layout/contact_key.xml b/src/main/res/layout/contact_key.xml index c16d5e089..030303a61 100644 --- a/src/main/res/layout/contact_key.xml +++ b/src/main/res/layout/contact_key.xml @@ -23,7 +23,8 @@ android:textColor="?attr/color_text_primary" android:textSize="?attr/TextSizeBody" android:typeface="monospace" - android:longClickable="true"/> + android:longClickable="true" + android:clickable="true"/> + android:longClickable="true" + android:clickable="true"/>