diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java index b9ded338a..de85d1f00 100644 --- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java @@ -867,6 +867,10 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp binding.command.setText(uri.getSchemeSpecificPart()); binding.command.setCompoundDrawablesRelativeWithIntrinsicBounds(getDrawable(R.drawable.bitcoin_cash_24dp), null, null, null); binding.command.setCompoundDrawablePadding(20); + } else if (uri.getScheme().equals("monero")) { + binding.command.setText(uri.getSchemeSpecificPart()); + binding.command.setCompoundDrawablesRelativeWithIntrinsicBounds(getDrawable(R.drawable.monero_24dp), null, null, null); + binding.command.setCompoundDrawablePadding(20); } else if (uri.getScheme().equals("https") && "liberapay.com".equals(uri.getHost())) { binding.command.setText(uri.getPath().substring(1)); binding.command.setCompoundDrawablesRelativeWithIntrinsicBounds(getDrawable(R.drawable.liberapay), null, null, null); diff --git a/src/main/java/eu/siacs/conversations/ui/util/MyLinkify.java b/src/main/java/eu/siacs/conversations/ui/util/MyLinkify.java index ba2d238b5..7c053420b 100644 --- a/src/main/java/eu/siacs/conversations/ui/util/MyLinkify.java +++ b/src/main/java/eu/siacs/conversations/ui/util/MyLinkify.java @@ -134,6 +134,7 @@ public class MyLinkify { Linkify.addLinks(body, Patterns.SMS_URI, "sms"); Linkify.addLinks(body, Patterns.BITCOIN_URI, "bitcoin"); Linkify.addLinks(body, Patterns.BITCOINCASH_URI, "bitcoincash"); + Linkify.addLinks(body, Patterns.MONERO_URI, "monero"); Linkify.addLinks(body, Patterns.AUTOLINK_WEB_URL, "http", WEBURL_MATCH_FILTER, WEBURL_TRANSFORM_FILTER); if (includeGeo) { Linkify.addLinks(body, GeoHelper.GEO_URI, "geo"); diff --git a/src/main/java/eu/siacs/conversations/utils/Patterns.java b/src/main/java/eu/siacs/conversations/utils/Patterns.java index fcf1fc97d..b72ad37bb 100644 --- a/src/main/java/eu/siacs/conversations/utils/Patterns.java +++ b/src/main/java/eu/siacs/conversations/utils/Patterns.java @@ -45,6 +45,12 @@ public class Patterns { + "\\;\\/\\?\\@\\&\\=\\#\\~\\-\\.\\+\\!\\*\\'\\(\\)\\,\\_])" + "|(?:\\%[a-fA-F0-9]{2}))+)?"); + public static final Pattern MONERO_URI = Pattern + .compile("monero\\:(?:[48][0-9AB][1-9A-HJ-NP-Za-km-z]{93})(?:\\?(?:(?:[" + + Patterns.GOOD_IRI_CHAR + + "\\;\\/\\?\\@\\&\\=\\#\\~\\-\\.\\+\\!\\*\\'\\(\\)\\,\\_])" + + "|(?:\\%[a-fA-F0-9]{2}))+)?"); + /** * Regular expression to match all IANA top-level domains. * List accurate as of 2011/07/18. List taken from: