Update various message request UI.

This commit is contained in:
Michelle Tang
2025-03-07 15:15:22 -05:00
committed by Greyson Parrelli
parent caa1d0a2b3
commit 9eba978da6
11 changed files with 113 additions and 58 deletions

View File

@@ -27,6 +27,7 @@ import android.text.style.StyleSpan;
import android.text.style.TextAppearanceSpan;
import android.text.style.TypefaceSpan;
import android.text.style.URLSpan;
import android.text.style.UnderlineSpan;
import android.view.View;
import androidx.annotation.ColorInt;
@@ -99,6 +100,17 @@ public final class SpanUtil {
return spannable;
}
public static CharSequence underlineSubstring(CharSequence fullString, CharSequence substring) {
SpannableString spannable = new SpannableString(fullString);
int start = TextUtils.indexOf(fullString, substring);
int end = start + substring.length();
if (start >= 0 && end <= fullString.length()) {
spannable.setSpan(new UnderlineSpan(), start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
return spannable;
}
public static CharSequence color(int color, CharSequence sequence) {
SpannableString spannable = new SpannableString(sequence);
spannable.setSpan(new ForegroundColorSpan(color), 0, sequence.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);