private ColorStateList applyTextAppearance(Paint p,int resId){
  TextView tv=new TextView(mContext);
  if (SUtils.isApi_23_OrHigher()) {
    tv.setTextAppearance(resId);
  }
 else {
    tv.setTextAppearance(mContext,resId);
  }
  p.setTypeface(tv.getTypeface());
  p.setTextSize(tv.getTextSize());
  final ColorStateList textColor=tv.getTextColors();
  if (textColor != null) {
    final int enabledColor=textColor.getColorForState(ENABLED_STATE_SET,0);
    p.setColor(enabledColor);
  }
  return textColor;
}

private ColorStateList applyTextAppearance ( Paint p , int resId ) { TextView tv = new TextView ( mContext ) ; if ( SUtils . isApi_23_OrHigher ( ) ) { tv . setTextAppearance ( resId ) ; } else { tv . setTextAppearance ( mContext , resId ) ; } p . setTypeface ( tv . getTypeface ( ) ) ; p . setTextSize ( tv . getTextSize ( ) ) ; final ColorStateList textColor = tv . getTextColors ( ) ; if ( textColor != null ) { final int enabledColor = textColor . getColorForState ( ENABLED_STATE_SET , 0 ) ; p . setColor ( enabledColor ) ; } return textColor ; }
applies the specified text appearance resource to a paint , returning the text color if one is set in the text appearance .
