diff options
author | Stefan Niedermann <info@niedermann.it> | 2020-12-21 12:21:04 +0300 |
---|---|---|
committer | Niedermann IT-Dienstleistungen <stefan-niedermann@users.noreply.github.com> | 2020-12-21 13:49:02 +0300 |
commit | beb6c03dfb3df54ec33abf139c00b57674b31e7c (patch) | |
tree | aeef92edf4eb0c61f65cfe5b065bccf8b0c1ddbd /app/src/main/java/it/niedermann | |
parent | 88b8f9583ba6f1c6f1d3ca1f4125d6593fe388bb (diff) |
Small overall improvements
Signed-off-by: Stefan Niedermann <info@niedermann.it>
Diffstat (limited to 'app/src/main/java/it/niedermann')
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/util/SpannableUtil.java | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/util/SpannableUtil.java b/app/src/main/java/it/niedermann/nextcloud/deck/util/SpannableUtil.java index c2ba6f46a..d11631fde 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/util/SpannableUtil.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/util/SpannableUtil.java @@ -5,7 +5,6 @@ import android.content.res.Resources; import android.graphics.Typeface; import android.text.Spannable; import android.text.SpannableString; -import android.text.SpannableStringBuilder; import android.text.Spanned; import android.text.method.LinkMovementMethod; import android.text.style.ForegroundColorSpan; @@ -42,9 +41,9 @@ public class SpannableUtil { 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 SpannableStringBuilder finalTextBuilder = new SpannableStringBuilder(finalText); - finalTextBuilder.setSpan(new URLSpan(resources.getString(urlId)), finalText.indexOf(linkLabel), finalText.indexOf(linkLabel) + linkLabel.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); - textView.setText(finalTextBuilder); + final SpannableString finalSpannable = new SpannableString(finalText); + finalSpannable.setSpan(new URLSpan(resources.getString(urlId)), finalText.indexOf(linkLabel), finalText.indexOf(linkLabel) + linkLabel.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + textView.setText(finalSpannable); textView.setMovementMethod(new LinkMovementMethod()); } } |