androidx.core.text.util.LinkifyCompat Java Examples
The following examples show how to use
androidx.core.text.util.LinkifyCompat.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SubmitDebugLogActivity.java From mollyim-android with GNU General Public License v3.0 | 5 votes |
private void presentResultDialog(@NonNull String url) { AlertDialog.Builder builder = new AlertDialog.Builder(this) .setTitle(R.string.SubmitDebugLogActivity_success) .setCancelable(false) .setNeutralButton(R.string.SubmitDebugLogActivity_ok, (d, w) -> finish()) .setPositiveButton(R.string.SubmitDebugLogActivity_share, (d, w) -> { ShareCompat.IntentBuilder.from(this) .setText(url) .setType("text/plain") .setEmailTo(new String[] { "[email protected]" }) .startChooser(); }); TextView textView = new TextView(builder.getContext()); textView.setText(getResources().getString(R.string.SubmitDebugLogActivity_copy_this_url_and_add_it_to_your_issue, url)); textView.setMovementMethod(LinkMovementMethod.getInstance()); textView.setOnLongClickListener(v -> { Util.copyToClipboard(this, url); Toast.makeText(this, R.string.SubmitDebugLogActivity_copied_to_clipboard, Toast.LENGTH_SHORT).show(); return true; }); LinkifyCompat.addLinks(textView, Linkify.WEB_URLS); ViewUtil.setPadding(textView, (int) ThemeUtil.getThemedDimen(this, R.attr.dialogPreferredPadding)); builder.setView(textView); builder.show(); }
Example #2
Source File: LinkifyPlugin.java From Markwon with Apache License 2.0 | 4 votes |
@Override protected boolean addLinks(@NonNull Spannable text, @LinkifyMask int mask) { return LinkifyCompat.addLinks(text, mask); }