use of android.text.method.LinkMovementMethod in project nextcloud-notes by stefan-niedermann.
the class AboutFragmentCreditsTab method onCreateView.
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final var binding = FragmentAboutCreditsTabBinding.inflate(inflater, container, false);
binding.aboutVersion.setText(getString(R.string.about_version, strong(BuildConfig.VERSION_NAME)));
binding.aboutMaintainer.setText(url(getString(R.string.about_maintainer), getString(R.string.url_maintainer)));
binding.aboutMaintainer.setMovementMethod(new LinkMovementMethod());
setTextWithURL(binding.aboutTranslators, getResources(), R.string.about_translators_transifex, R.string.about_translators_transifex_label, R.string.url_translations);
return binding.getRoot();
}
use of android.text.method.LinkMovementMethod in project nextcloud-notes by stefan-niedermann.
the class SupportUtil method setTextWithURL.
public static void setTextWithURL(@NonNull TextView textView, @NonNull Resources resources, @StringRes int containerTextId, @StringRes int linkLabelId, @StringRes int urlId) {
final String linkLabel = resources.getString(linkLabelId);
final String finalText = resources.getString(containerTextId, linkLabel);
final var spannable = new SpannableString(finalText);
spannable.setSpan(new URLSpan(resources.getString(urlId)), finalText.indexOf(linkLabel), finalText.indexOf(linkLabel) + linkLabel.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
textView.setText(spannable);
textView.setMovementMethod(new LinkMovementMethod());
}
Aggregations