feat(linkSpan/longClick): use share intent istead of copy text
This commit is contained in:
parent
f510ee3b4d
commit
bcfb63b57c
|
@ -1,8 +1,10 @@
|
||||||
package org.joinmastodon.android.ui.text;
|
package org.joinmastodon.android.ui.text;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.text.TextPaint;
|
import android.text.TextPaint;
|
||||||
import android.text.style.CharacterStyle;
|
import android.text.style.CharacterStyle;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import org.joinmastodon.android.ui.utils.UiUtils;
|
import org.joinmastodon.android.ui.utils.UiUtils;
|
||||||
|
@ -42,7 +44,14 @@ public class LinkSpan extends CharacterStyle {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onLongClick(View view) {
|
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(){
|
public String getLink(){
|
||||||
|
|
Loading…
Reference in New Issue