From bcfb63b57c957b6ca854404cdef2f2da1e7cba46 Mon Sep 17 00:00:00 2001 From: FineFindus <63370021+FineFindus@users.noreply.github.com> Date: Wed, 4 Jan 2023 20:53:30 +0100 Subject: [PATCH] feat(linkSpan/longClick): use share intent istead of copy text --- .../org/joinmastodon/android/ui/text/LinkSpan.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/text/LinkSpan.java b/mastodon/src/main/java/org/joinmastodon/android/ui/text/LinkSpan.java index 94679733f..fee86b22a 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/text/LinkSpan.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/text/LinkSpan.java @@ -1,8 +1,10 @@ package org.joinmastodon.android.ui.text; import android.content.Context; +import android.content.Intent; import android.text.TextPaint; import android.text.style.CharacterStyle; +import android.util.Log; import android.view.View; import org.joinmastodon.android.ui.utils.UiUtils; @@ -42,7 +44,14 @@ public class LinkSpan extends CharacterStyle { } public void onLongClick(View view) { - UiUtils.copyText(view, getType() == Type.URL ? link : text); + if (getType() == Type.URL) { + Intent shareIntent = new Intent(Intent.ACTION_SEND) + .setType("text/plain") + .putExtra(Intent.EXTRA_TEXT, link); + view.getContext().startActivity(Intent.createChooser(shareIntent, null)); + } else { + UiUtils.copyText(view, text); + } } public String getLink(){