55import android .graphics .Typeface ;
66import android .os .Bundle ;
77import android .support .v7 .app .AppCompatActivity ;
8- import android .text .Spanned ;
9- import android .text .style .ClickableSpan ;
10- import android .util .Log ;
118import android .widget .TextView ;
129import android .widget .Toast ;
1310
1411import cn .iwgang .simplifyspan .SimplifySpanBuild ;
1512import cn .iwgang .simplifyspan .customspan .CustomClickableSpan ;
1613import cn .iwgang .simplifyspan .other .OnClickableSpanListener ;
14+ import cn .iwgang .simplifyspan .other .SpecialConvertMode ;
1715import cn .iwgang .simplifyspan .other .SpecialGravity ;
1816import cn .iwgang .simplifyspan .unit .SpecialClickableUnit ;
1917import cn .iwgang .simplifyspan .unit .SpecialImageUnit ;
@@ -31,7 +29,6 @@ protected void onCreate(Bundle savedInstanceState) {
3129 TextView tvText11 = (TextView ) findViewById (R .id .tv_text11 );
3230 TextView tvText2 = (TextView ) findViewById (R .id .tv_text2 );
3331 TextView tvText21 = (TextView ) findViewById (R .id .tv_text21 );
34- TextView tvText22 = (TextView ) findViewById (R .id .tv_text22 );
3532 TextView tvText3 = (TextView ) findViewById (R .id .tv_text3 );
3633 TextView tvText4 = (TextView ) findViewById (R .id .tv_text4 );
3734 TextView tvText41 = (TextView ) findViewById (R .id .tv_text41 );
@@ -76,13 +73,15 @@ protected void onCreate(Bundle savedInstanceState) {
7673 .append (new SpecialLabelUnit ("原创" , Color .RED , sp2px (10 ), Color .TRANSPARENT ).showBorder (Color .BLACK , 2 ).setPadding (5 ).setPaddingLeft (10 ).setPaddingRight (10 ).setGravity (SpecialGravity .CENTER ));
7774 tvText11 .setText (simplifySpanBuild11 .build ());
7875
76+ SimplifySpanBuild simplifySpanBuild2 = new SimplifySpanBuild ("替换所有张字的颜色及字体大小并加粗,张歆艺、张馨予、张嘉倪、张涵予、张含韵、张韶涵、张嘉译、张佳宁、大张伟" , new SpecialTextUnit ("张" ).useTextBold ().setTextSize (20 ).setTextColor (0xFFFFA500 ).setConvertMode (SpecialConvertMode .ALL ));
77+ tvText2 .setText (simplifySpanBuild2 .build ());
7978
8079 SimplifySpanBuild simplifySpanBuild21 = new SimplifySpanBuild ();
8180 simplifySpanBuild21
8281 .append (new SpecialTextUnit ("正常字体" ).setTextSize (18 ).setTextStyle (Typeface .NORMAL ))
83- .append (new SpecialTextUnit ("粗体" ).setTextSize (18 ).setTextStyle ( Typeface . BOLD ))
84- .append (new SpecialTextUnit ("斜体" ).setTextSize (18 ).setTextStyle ( Typeface . ITALIC ))
85- .append (new SpecialTextUnit ("粗斜体" ).setTextSize (18 ).setTextStyle ( Typeface . BOLD_ITALIC ))
82+ .append (new SpecialTextUnit ("粗体" ).setTextSize (18 ).useTextBold ( ))
83+ .append (new SpecialTextUnit ("斜体" ).setTextSize (18 ).useTextItalic ( ))
84+ .append (new SpecialTextUnit ("粗斜体" ).setTextSize (18 ).useTextBold (). useTextItalic ( ))
8685 .append (new SpecialTextUnit ("黑体" ).setTextSize (18 ).setTextStyle (Typeface .DEFAULT_BOLD .getStyle ()))
8786 .append (new SpecialTextUnit ("等宽1字体" ).setTextSize (18 ).setTextStyle (Typeface .MONOSPACE .getStyle ()))
8887 .append (new SpecialTextUnit ("Sans Serif字体" ).setTextSize (18 ).setTextStyle (Typeface .SANS_SERIF .getStyle ()))
@@ -95,15 +94,6 @@ protected void onCreate(Bundle savedInstanceState) {
9594 .append (new SpecialTextUnit ("底部" ).setTextSize (12 ).setTextColor (0xFF8B658B ));
9695 tvText21 .setText (simplifySpanBuild21 .build ());
9796
98-
99- SimplifySpanBuild simplifySpanBuild22 = new SimplifySpanBuild ("正常底部正常居中正常顶部正常" ,
100- new SpecialTextUnit ("底部" ).setTextSize (30 ).setTextColor (Color .BLUE ),
101- new SpecialTextUnit ("居中" ).setTextSize (30 ).setGravity (tvText22 , SpecialGravity .CENTER ).setTextColor (0xFFB03060 ),
102- new SpecialTextUnit ("顶部" ).setTextSize (30 ).setGravity (tvText22 , SpecialGravity .TOP ).setTextColor (0xFFB0C4DE )
103-
104- );
105- tvText22 .setText (simplifySpanBuild22 .build ());
106-
10797 SimplifySpanBuild simplifySpanBuild3 = new SimplifySpanBuild ();
10898 simplifySpanBuild3 .append (new SpecialImageUnit (this , BitmapFactory .decodeResource (getResources (), R .drawable .ic_bulletin ), 50 , 50 ).setGravity (SpecialGravity .CENTER ))
10999 .append ("正常" )
@@ -132,7 +122,7 @@ protected void onCreate(Bundle savedInstanceState) {
132122 simplifySpanBuild4 .append ("完整文章见 " );
133123 simplifySpanBuild4 .appendMultiClickable (new SpecialClickableUnit (tvText4 , this ).setNormalTextColor (linkNorTextColor ).setPressBgColor (linkPressBgColor ),
134124 new SpecialImageUnit (this , BitmapFactory .decodeResource (getResources (), R .drawable .timeline_card_small_article ), 30 , 30 ).setGravity (SpecialGravity .CENTER ),
135- new SpecialTextUnit ("LOL超强攻略,不见绝对后悔 " ).showUnderline ());
125+ new SpecialTextUnit ("LOL超强攻略,不看绝对后悔 " ).showUnderline ());
136126 simplifySpanBuild4 .append (" 更多好玩的内容请点击 " );
137127 simplifySpanBuild4 .appendMultiClickable (new SpecialClickableUnit (tvText4 , this ).setNormalTextColor (linkNorTextColor ).setPressBgColor (linkPressBgColor ),
138128 new SpecialImageUnit (this , BitmapFactory .decodeResource (getResources (), R .drawable .timeline_card_small_web ), 42 , 42 ).setGravity (SpecialGravity .CENTER ),
0 commit comments