From 79a105ca330e5ebaf45e324814ab1f680ed75d30 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Sat, 9 Nov 2024 16:36:31 -0500 Subject: [PATCH] Put profile links through our normal link handler (cherry picked from commit e8adb13ecb449455285aed9e69422c655ac45ee3) --- .../conversations/ui/ContactDetailsActivity.java | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java index de85d1f00..831fc27b0 100644 --- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java @@ -79,6 +79,7 @@ import eu.siacs.conversations.services.XmppConnectionService.OnAccountUpdate; import eu.siacs.conversations.services.XmppConnectionService.OnRosterUpdate; import eu.siacs.conversations.ui.adapter.MediaAdapter; import eu.siacs.conversations.ui.interfaces.OnMediaLoaded; +import eu.siacs.conversations.ui.text.FixedURLSpan; import eu.siacs.conversations.ui.util.Attachment; import eu.siacs.conversations.ui.util.AvatarWorkerTask; import eu.siacs.conversations.ui.util.GridManager; @@ -746,17 +747,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp binding.profileItems.setOnItemClickListener((a0, v, pos, a3) -> { final Uri uri = items.getUri(pos); if (uri == null) return; - - if ("xmpp".equals(uri.getScheme())) { - switchToConversation(xmppConnectionService.findOrCreateConversation(account, Jid.of(uri.getSchemeSpecificPart()), false, true)); - } else { - Intent intent = new Intent(Intent.ACTION_VIEW, uri); - try { - startActivity(intent); - } catch (ActivityNotFoundException e) { - Toast.makeText(this, R.string.no_application_found_to_open_link, Toast.LENGTH_SHORT).show(); - } - } + new FixedURLSpan(uri.toString()).onClick(v); }); binding.profileItems.setOnItemLongClickListener((a0, v, pos, a3) -> { String toCopy = null;