minor code clean up
This commit is contained in:
parent
56a6b17e7e
commit
8111460913
|
@ -108,20 +108,19 @@ public class ShareUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void copyLinkToClipboard(XmppActivity activity, Message message) {
|
public static void copyLinkToClipboard(final XmppActivity activity, final Message message) {
|
||||||
SpannableStringBuilder body = message.getMergedBody();
|
final SpannableStringBuilder body = message.getMergedBody();
|
||||||
MyLinkify.addLinks(body, true);
|
MyLinkify.addLinks(body, true);
|
||||||
for (final URLSpan urlspan : body.getSpans(0, body.length() - 1, URLSpan.class)) {
|
for (final URLSpan urlspan : body.getSpans(0, body.length() - 1, URLSpan.class)) {
|
||||||
Uri uri = Uri.parse(urlspan.getURL());
|
final Uri uri = Uri.parse(urlspan.getURL());
|
||||||
if ("xmpp".equals(uri.getScheme())) {
|
if ("xmpp".equals(uri.getScheme())) {
|
||||||
try {
|
try {
|
||||||
Jid jid = new XmppUri(uri).getJid();
|
final Jid jid = new XmppUri(uri).getJid();
|
||||||
if (activity.copyTextToClipboard(jid.asBareJid().toString(), R.string.account_settings_jabber_id)) {
|
if (activity.copyTextToClipboard(jid.asBareJid().toString(), R.string.account_settings_jabber_id)) {
|
||||||
Toast.makeText(activity,R.string.jabber_id_copied_to_clipboard, Toast.LENGTH_SHORT).show();
|
Toast.makeText(activity,R.string.jabber_id_copied_to_clipboard, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} catch (Exception e) {
|
} catch (final Exception e) {
|
||||||
e.printStackTrace();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue