package com.lsjwzh.widget.text;

import android.content.Context;
import android.graphics.Canvas;
import android.os.Build;
import android.support.annotation.Nullable;
import android.support.annotation.RequiresApi;
import android.text.Spanned;
import android.util.AttributeSet;
import android.util.Log;

public class StrokableTextView extends FastTextView {
  private static final String TAG = "StrokableTextView";

  public StrokableTextView(Context context) {
    super(context);
  }

  public StrokableTextView(Context context, @Nullable AttributeSet attrs) {
    super(context, attrs);
  }

  public StrokableTextView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
  }

  @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
  public StrokableTextView(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    super(context, attrs, defStyleAttr, defStyleRes);
  }


  @Override
  protected void onDraw(Canvas canvas) {
    long start = System.currentTimeMillis();
    CharSequence text = getText();
    if (text instanceof Spanned) {
      StrokeSpan[] strokeSpans = StrokeSpanUtil.getStrokeSpans((Spanned) text);
      StrokeSpanUtil.startStroke(strokeSpans);
      super.onDraw(canvas);
      StrokeSpanUtil.endStroke(strokeSpans);
    }
    super.onDraw(canvas);
    long end = System.currentTimeMillis();
    if (BuildConfig.DEBUG) {
      Log.d(TAG, "onDraw cost:" + (end - start));
    }
  }
}

@@ -1196,16 +1196,77 @@
  text);%0A
+      if (strokeSpans != null && strokeSpans.length %3E 0) %7B%0A  
       St
@@ -1306,24 +1306,26 @@
 ans);%0A      
+  
 super.onDraw
@@ -1336,24 +1336,26 @@
 vas);%0A      
+ 
+ 
 StrokeSpanUt
@@ -1377,24 +1377,32 @@
 rokeSpans);%0A
+      %7D%0A
     %7D%0A    su

Change Stroke Text implementation