1414import android .text .style .LeadingMarginSpan ;
1515import android .util .AttributeSet ;
1616import android .util .LayoutDirection ;
17+ import android .util .Log ;
1718
1819import androidx .core .text .TextUtilsCompat ;
1920
@@ -127,13 +128,11 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
127128
128129 @ Override
129130 protected void onDraw (Canvas canvas ) {
130- ColorStateList textColor = getTextColors ();
131131 TextPaint textPaint = getPaint ();
132132 Paint .Style oldStyle = textPaint .getStyle ();
133133 textPaint .setStrokeWidth (strokeWidth );
134134 textPaint .setStyle (Paint .Style .FILL_AND_STROKE );
135135 textPaint .setStrokeJoin (strokeJoin );
136- setTextColor (strokeTextColor );
137136 if (gradientStrokeColor ){
138137 float currentAngle = strokeAngle ;
139138 if (strokeRtlAngle && isRtl ){
@@ -144,13 +143,11 @@ protected void onDraw(Canvas canvas) {
144143 @ SuppressLint ("DrawAllocation" ) LinearGradient linearGradient = new LinearGradient (xy [0 ], xy [1 ], xy [2 ], xy [3 ], gradientStrokeColors , gradientStrokePositions , Shader .TileMode .CLAMP );
145144 textPaint .setShader (linearGradient );
146145 }else {
147- textPaint .setShader (null );
146+ @ SuppressLint ("DrawAllocation" ) LinearGradient linearGradient = new LinearGradient (0 , 0 ,getWidth (),getHeight (), new int []{strokeTextColor ,strokeTextColor }, null , Shader .TileMode .CLAMP );
147+ textPaint .setShader (linearGradient );
148148 }
149149 super .onDraw (canvas );
150150 textPaint .setStrokeWidth (0 );
151- if (textColor != null ){
152- setTextColor (textColor );
153- }
154151 textPaint .setStyle (oldStyle );
155152 if (gradientColor ){
156153 float currentAngle = angle ;
0 commit comments