@@ -43,27 +43,7 @@ public static void buildSpannableFromTextFragmentList(Context context, TextFragm
4343
4444 addInlineViewPlaceholderSpan (ops , sb , reactTag , width , height );
4545 } else if (end >= start ) {
46- addColorSpanIfApplicable (ops , textAttributes , start , end );
47-
48- addBackgroundColorSpanIfApplicable (ops , textAttributes , start , end );
49-
50- addLinkSpanIfApplicable (ops , textAttributes , reactTag , start , end );
51-
52- addLetterSpacingSpanIfApplicable (ops , textAttributes , start , end );
53-
54- addFontSizeSpanIfApplicable (ops , textAttributes , start , end );
55-
56- addCustomStyleSpanIfApplicable (ops , textAttributes , context , start , end );
57-
58- addUnderlineSpanIfApplicable (ops , textAttributes , start , end );
59-
60- addStrikethroughSpanIfApplicable (ops , textAttributes , start , end );
61-
62- addShadowStyleSpanIfApplicable (ops , textAttributes , start , end );
63-
64- addLineHeightSpanIfApplicable (ops , textAttributes , start , end );
65-
66- addReactTagSpan (ops , start , end , reactTag );
46+ addApplicableTextAttributeSpans (ops , textAttributes , reactTag , context , start , end );
6747 }
6848 }
6949 }
@@ -79,8 +59,33 @@ public static void addInlineViewPlaceholderSpan(List<SetSpanOperation> ops, Span
7959 new TextInlineViewPlaceholderSpan (reactTag , (int ) width , (int ) height )));
8060 }
8161
62+ public static void addApplicableTextAttributeSpans (List <SetSpanOperation > ops ,
63+ EffectiveTextAttributeProvider textAttributeProvider , int reactTag , Context context ,
64+ int start , int end ) {
65+ addColorSpanIfApplicable (ops , textAttributeProvider , start , end );
66+
67+ addBackgroundColorSpanIfApplicable (ops , textAttributeProvider , start , end );
68+
69+ addLinkSpanIfApplicable (ops , textAttributeProvider , reactTag , start , end );
70+
71+ addLetterSpacingSpanIfApplicable (ops , textAttributeProvider , start , end );
72+
73+ addFontSizeSpanIfApplicable (ops , textAttributeProvider , start , end );
74+
75+ addCustomStyleSpanIfApplicable (ops , textAttributeProvider , context , start , end );
76+
77+ addUnderlineSpanIfApplicable (ops , textAttributeProvider , start , end );
78+
79+ addStrikethroughSpanIfApplicable (ops , textAttributeProvider , start , end );
80+
81+ addShadowStyleSpanIfApplicable (ops , textAttributeProvider , start , end );
82+
83+ addLineHeightSpanIfApplicable (ops , textAttributeProvider , start , end );
84+
85+ addReactTagSpan (ops , start , end , reactTag );
86+ }
8287
83- public static void addLinkSpanIfApplicable (List <SetSpanOperation > ops ,
88+ private static void addLinkSpanIfApplicable (List <SetSpanOperation > ops ,
8489 EffectiveTextAttributeProvider textAttributeProvider , int reactTag ,
8590 int start , int end ) {
8691 boolean roleIsLink = textAttributeProvider .getRole () != null ?
@@ -91,15 +96,15 @@ public static void addLinkSpanIfApplicable(List<SetSpanOperation> ops,
9196 }
9297 }
9398
94- public static void addColorSpanIfApplicable (List <SetSpanOperation > ops ,
99+ private static void addColorSpanIfApplicable (List <SetSpanOperation > ops ,
95100 EffectiveTextAttributeProvider textAttributeProvider , int start ,
96101 int end ) {
97102 if (textAttributeProvider .isColorSet ()) {
98103 ops .add (new SetSpanOperation (start , end , new ReactForegroundColorSpan (textAttributeProvider .getColor ())));
99104 }
100105 }
101106
102- public static void addBackgroundColorSpanIfApplicable (List <SetSpanOperation > ops ,
107+ private static void addBackgroundColorSpanIfApplicable (List <SetSpanOperation > ops ,
103108 EffectiveTextAttributeProvider textAttributeProvider ,
104109 int start , int end ) {
105110 if (textAttributeProvider .isBackgroundColorSet ()) {
@@ -108,7 +113,7 @@ public static void addBackgroundColorSpanIfApplicable(List<SetSpanOperation> ops
108113 }
109114 }
110115
111- public static void addLetterSpacingSpanIfApplicable (List <SetSpanOperation > ops ,
116+ private static void addLetterSpacingSpanIfApplicable (List <SetSpanOperation > ops ,
112117 EffectiveTextAttributeProvider textAttributeProvider , int start
113118 , int end ) {
114119 final float effectiveLetterSpacing = textAttributeProvider .getEffectiveLetterSpacing ();
@@ -119,7 +124,7 @@ public static void addLetterSpacingSpanIfApplicable(List<SetSpanOperation> ops,
119124 }
120125
121126
122- public static void addFontSizeSpanIfApplicable (List <SetSpanOperation > ops ,
127+ private static void addFontSizeSpanIfApplicable (List <SetSpanOperation > ops ,
123128 EffectiveTextAttributeProvider textAttributeProvider , int start ,
124129 int end ) {
125130 final int effectiveFontSize = textAttributeProvider .getEffectiveFontSize ();
@@ -129,7 +134,7 @@ public static void addFontSizeSpanIfApplicable(List<SetSpanOperation> ops,
129134 }
130135 }
131136
132- public static void addCustomStyleSpanIfApplicable (List <SetSpanOperation > ops ,
137+ private static void addCustomStyleSpanIfApplicable (List <SetSpanOperation > ops ,
133138 EffectiveTextAttributeProvider textAttributeProvider ,
134139 Context context , int start , int end ) {
135140 final int fontStyle = textAttributeProvider .getFontStyle ();
@@ -143,15 +148,15 @@ public static void addCustomStyleSpanIfApplicable(List<SetSpanOperation> ops,
143148 }
144149 }
145150
146- public static void addUnderlineSpanIfApplicable (List <SetSpanOperation > ops ,
151+ private static void addUnderlineSpanIfApplicable (List <SetSpanOperation > ops ,
147152 EffectiveTextAttributeProvider textAttributeProvider , int start ,
148153 int end ) {
149154 if (textAttributeProvider .isUnderlineTextDecorationSet ()) {
150155 ops .add (new SetSpanOperation (start , end , new ReactUnderlineSpan ()));
151156 }
152157 }
153158
154- public static void addStrikethroughSpanIfApplicable (List <SetSpanOperation > ops ,
159+ private static void addStrikethroughSpanIfApplicable (List <SetSpanOperation > ops ,
155160 EffectiveTextAttributeProvider textAttributeProvider , int start
156161 , int end ) {
157162 if (textAttributeProvider .isLineThroughTextDecorationSet ()) {
@@ -160,7 +165,7 @@ public static void addStrikethroughSpanIfApplicable(List<SetSpanOperation> ops,
160165 }
161166
162167
163- public static void addShadowStyleSpanIfApplicable (List <SetSpanOperation > ops ,
168+ private static void addShadowStyleSpanIfApplicable (List <SetSpanOperation > ops ,
164169 EffectiveTextAttributeProvider textAttributeProvider , int start ,
165170 int end ) {
166171 if ((textAttributeProvider .getTextShadowOffsetDx () != 0 || textAttributeProvider .getTextShadowOffsetDy () != 0 || textAttributeProvider .getTextShadowRadius () != 0 ) && Color .alpha (textAttributeProvider .getTextShadowColor ()) != 0 ) {
@@ -170,7 +175,7 @@ public static void addShadowStyleSpanIfApplicable(List<SetSpanOperation> ops,
170175 }
171176 }
172177
173- public static void addLineHeightSpanIfApplicable (List <SetSpanOperation > ops ,
178+ private static void addLineHeightSpanIfApplicable (List <SetSpanOperation > ops ,
174179 EffectiveTextAttributeProvider textAttributeProvider , int start ,
175180 int end ) {
176181 final float effectiveLineHeight = textAttributeProvider .getEffectiveLineHeight ();
@@ -179,7 +184,7 @@ public static void addLineHeightSpanIfApplicable(List<SetSpanOperation> ops,
179184 }
180185 }
181186
182- public static void addReactTagSpan (List <SetSpanOperation > ops , int start , int end , int reactTag ) {
187+ private static void addReactTagSpan (List <SetSpanOperation > ops , int start , int end , int reactTag ) {
183188 ops .add (new SetSpanOperation (start , end , new ReactTagSpan (reactTag )));
184189
185190 }
0 commit comments