Package ai.nexconn.chatui.utils.text
Class TextViewUtils
-
- All Implemented Interfaces:
public class TextViewUtilsHandles text content for TextMessage and ReferenceMessage.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceTextViewUtils.RegularCallBackpublic classTextViewUtils.URLSpanUnderlineSameColorCustom link style: keeps the underline while preserving the original text color instead of the theme's default link color.
-
Constructor Summary
Constructors Constructor Description TextViewUtils()
-
Method Summary
Modifier and Type Method Description static SpannableStringBuildergetSpannable(String content, TextViewUtils.RegularCallBack callBack)static SpannableStringBuildergetSpannable(String content, boolean regular, TextViewUtils.RegularCallBack callBack)static SpannableStringBuildergetRichSpannable(String content, TextViewUtils.RegularCallBack callBack, int foregroundColor)static voidsetCompoundDrawables(TextView textView, int gravity, int resId)Sets compound drawables on a TextView using setCompoundDrawablesRelative. static voidenableDrawableAutoMirror(TextView textView)Enables auto-mirroring for the TextView's compound Drawables, useful for directional Drawables in RTL layouts. -
-
Method Detail
-
getSpannable
static SpannableStringBuilder getSpannable(String content, TextViewUtils.RegularCallBack callBack)
- Parameters:
content- the text contentcallBack- async callback for regex processing result- Returns:
the spannable content
-
getSpannable
static SpannableStringBuilder getSpannable(String content, boolean regular, TextViewUtils.RegularCallBack callBack)
- Parameters:
content- the text contentcallBack- async callback for regex processing result- Returns:
the spannable content
-
getRichSpannable
static SpannableStringBuilder getRichSpannable(String content, TextViewUtils.RegularCallBack callBack, int foregroundColor)
- Parameters:
content- the text contentcallBack- async callback for regex processing result- Returns:
the spannable content
-
setCompoundDrawables
static void setCompoundDrawables(TextView textView, int gravity, int resId)
Sets compound drawables on a TextView using setCompoundDrawablesRelative.
- Parameters:
textView- the TextViewgravity- only supports Gravity.START, Gravity.TOP, Gravity.END, or Gravity.resId- drawable resource ID
-
enableDrawableAutoMirror
static void enableDrawableAutoMirror(TextView textView)
Enables auto-mirroring for the TextView's compound Drawables, useful for directional Drawables in RTL layouts.
- Parameters:
textView- the TextView
-
-
-
-