diff options
author | Stefan Niedermann <info@niedermann.it> | 2020-12-09 15:50:10 +0300 |
---|---|---|
committer | Stefan Niedermann <info@niedermann.it> | 2020-12-09 15:50:10 +0300 |
commit | 32e3f4bf5d414999af371b887691bc2f1a90ae3e (patch) | |
tree | 7a12b04e3c08ad4c88ad809800a9b36b0b6189e2 /app/src/main | |
parent | 61506f9d29daf0559fa12c70a25a45a4c6d83fa1 (diff) |
Add some unit tests
Signed-off-by: Stefan Niedermann <info@niedermann.it>
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/util/SpannableUtil.java | 12 |
1 files changed, 6 insertions, 6 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 54f3c8adc..c2ba6f46a 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 @@ -21,28 +21,28 @@ import it.niedermann.nextcloud.deck.R; public class SpannableUtil { public static SpannableString strong(@NonNull CharSequence text) { - SpannableString span = new SpannableString(text); + final SpannableString span = new SpannableString(text); span.setSpan(new StyleSpan(Typeface.BOLD), 0, span.length(), 0); return span; } public static SpannableString disabled(@NonNull CharSequence text, @NonNull Context context) { - SpannableString span = new SpannableString(text); + final SpannableString span = new SpannableString(text); span.setSpan(new StyleSpan(Typeface.ITALIC), 0, span.length(), 0); span.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, R.color.fg_secondary)), 0, span.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); return span; } public static SpannableString url(@NonNull CharSequence text, @NonNull String target) { - SpannableString span = new SpannableString(text); + final SpannableString span = new SpannableString(text); span.setSpan(new URLSpan(target), 0, span.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); return span; } public static void setTextWithURL(@NonNull TextView textView, @NonNull Resources resources, @StringRes int containerTextId, @StringRes int linkLabelId, @StringRes int urlId) { - String linkLabel = resources.getString(linkLabelId); - String finalText = resources.getString(containerTextId, linkLabel); - SpannableStringBuilder finalTextBuilder = new SpannableStringBuilder(finalText); + 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); textView.setMovementMethod(new LinkMovementMethod()); |