|
3 | 3 | import android.animation.ValueAnimator;
|
4 | 4 | import android.content.Context;
|
5 | 5 | import android.content.Intent;
|
6 |
| -import android.graphics.BitmapFactory; |
7 |
| -import android.graphics.BitmapShader; |
8 |
| -import android.graphics.BlurMaskFilter; |
9 | 6 | import android.graphics.Color;
|
10 | 7 | import android.graphics.LinearGradient;
|
11 | 8 | import android.graphics.Matrix;
|
12 | 9 | import android.graphics.Shader;
|
13 |
| -import android.graphics.Typeface; |
14 | 10 | import android.os.Bundle;
|
15 | 11 | import android.support.annotation.Nullable;
|
16 | 12 | import android.support.v4.content.ContextCompat;
|
17 |
| -import android.text.Layout; |
18 | 13 | import android.text.SpannableStringBuilder;
|
19 | 14 | import android.text.TextPaint;
|
20 | 15 | import android.text.method.LinkMovementMethod;
|
@@ -106,57 +101,57 @@ public void updateDrawState(TextPaint ds) {
|
106 | 101 | textSize = tvAboutSpan.getTextSize();
|
107 | 102 | density = getResources().getDisplayMetrics().density;
|
108 | 103 |
|
109 |
| - initAnimSpan(); |
110 |
| - startAnim(); |
| 104 | +// initAnimSpan(); |
| 105 | +// startAnim(); |
111 | 106 |
|
112 | 107 |
|
113 | 108 | tvAboutSpan.setText(new SpanUtils()
|
114 |
| - .appendLine("SpanUtils").setBackgroundColor(Color.LTGRAY).setBold().setForegroundColor(Color.YELLOW).setAlign(Layout.Alignment.ALIGN_CENTER) |
115 |
| - .appendLine("前景色").setForegroundColor(Color.GREEN) |
116 |
| - .appendLine("背景色").setBackgroundColor(Color.LTGRAY) |
117 |
| - .appendLine("行高顶部对齐").setLineHeight(2 * lineHeight, SpanUtils.ALIGN_TOP).setBackgroundColor(Color.GREEN) |
118 |
| - .appendLine("行高居中对齐").setLineHeight(2 * lineHeight, SpanUtils.ALIGN_CENTER).setBackgroundColor(Color.LTGRAY) |
119 |
| - .appendLine("行高底部对齐").setLineHeight(2 * lineHeight, SpanUtils.ALIGN_BOTTOM).setBackgroundColor(Color.GREEN) |
120 |
| - .appendLine("测试段落缩,首行缩进两字,其他行不缩进").setLeadingMargin((int) textSize * 2, 10).setBackgroundColor(Color.GREEN) |
121 |
| - .appendLine("测试引用,后面的字是为了凑到两行的效果").setQuoteColor(Color.GREEN, 10, 10).setBackgroundColor(Color.LTGRAY) |
122 |
| - .appendLine("测试列表项,后面的字是为了凑到两行的效果").setBullet(Color.GREEN, 20, 10).setBackgroundColor(Color.LTGRAY).setBackgroundColor(Color.GREEN) |
123 |
| - .appendLine("32dp 字体").setFontSize(32, true) |
124 |
| - .appendLine("2 倍字体").setFontProportion(2) |
125 |
| - .appendLine("横向 2 倍字体").setFontXProportion(1.5f) |
126 |
| - .appendLine("删除线").setStrikethrough() |
127 |
| - .appendLine("下划线").setUnderline() |
128 |
| - .append("测试").appendLine("上标").setSuperscript() |
129 |
| - .append("测试").appendLine("下标").setSubscript() |
130 |
| - .appendLine("粗体").setBold() |
131 |
| - .appendLine("斜体").setItalic() |
132 |
| - .appendLine("粗斜体").setBoldItalic() |
133 |
| - .appendLine("monospace 字体").setFontFamily("monospace") |
134 |
| - .appendLine("自定义字体").setTypeface(Typeface.createFromAsset(getAssets(), "fonts/dnmbhs.ttf")) |
135 |
| - .appendLine("相反对齐").setAlign(Layout.Alignment.ALIGN_OPPOSITE) |
136 |
| - .appendLine("居中对齐").setAlign(Layout.Alignment.ALIGN_CENTER) |
137 |
| - .appendLine("正常对齐").setAlign(Layout.Alignment.ALIGN_NORMAL) |
138 |
| - .append("测试").appendLine("点击事件").setClickSpan(clickableSpan) |
139 |
| - .append("测试").appendLine("Url").setUrl("https://github.com/Blankj/AndroidUtilCode") |
140 |
| - .append("测试").appendLine("模糊").setBlur(3, BlurMaskFilter.Blur.NORMAL) |
141 |
| - .appendLine("颜色渐变").setShader(new LinearGradient(0, 0, |
142 |
| - 64 * density * 4, 0, |
143 |
| - getResources().getIntArray(R.array.rainbow), |
144 |
| - null, |
145 |
| - Shader.TileMode.REPEAT)).setFontSize(64, true) |
146 |
| - .appendLine("图片着色").setFontSize(64, true).setShader(new BitmapShader(BitmapFactory.decodeResource(getResources(), R.drawable.span_cheetah), |
147 |
| - Shader.TileMode.REPEAT, |
148 |
| - Shader.TileMode.REPEAT)) |
149 |
| - .appendLine("阴影效果").setFontSize(64, true).setBackgroundColor(Color.BLACK).setShadow(24, 8, 8, Color.WHITE) |
150 |
| - |
151 |
| - .append("小图").setBackgroundColor(Color.GREEN) |
152 |
| - .appendImage(R.drawable.shape_spannable_block_low, SpanUtils.ALIGN_TOP) |
153 |
| - .append("顶部").setBackgroundColor(Color.GREEN) |
154 |
| - .appendImage(R.drawable.shape_spannable_block_low, SpanUtils.ALIGN_CENTER) |
155 |
| - .append("居中").setBackgroundColor(Color.GREEN) |
156 |
| - .appendImage(R.drawable.shape_spannable_block_low, SpanUtils.ALIGN_BASELINE) |
157 |
| - .append("底部").setBackgroundColor(Color.GREEN) |
158 |
| - .appendImage(R.drawable.shape_spannable_block_low, SpanUtils.ALIGN_BOTTOM) |
159 |
| - .appendLine("对齐").setBackgroundColor(Color.GREEN) |
| 109 | +// .appendLine("SpanUtils").setBackgroundColor(Color.LTGRAY).setBold().setForegroundColor(Color.YELLOW).setAlign(Layout.Alignment.ALIGN_CENTER) |
| 110 | +// .appendLine("前景色").setForegroundColor(Color.GREEN) |
| 111 | +// .appendLine("背景色").setBackgroundColor(Color.LTGRAY) |
| 112 | +// .appendLine("行高顶部对齐").setLineHeight(2 * lineHeight, SpanUtils.ALIGN_TOP).setBackgroundColor(Color.GREEN) |
| 113 | +// .appendLine("行高居中对齐").setLineHeight(2 * lineHeight, SpanUtils.ALIGN_CENTER).setBackgroundColor(Color.LTGRAY) |
| 114 | +// .appendLine("行高底部对齐").setLineHeight(2 * lineHeight, SpanUtils.ALIGN_BOTTOM).setBackgroundColor(Color.GREEN) |
| 115 | +// .appendLine("测试段落缩,首行缩进两字,其他行不缩进").setLeadingMargin((int) textSize * 2, 10).setBackgroundColor(Color.GREEN) |
| 116 | +// .appendLine("测试引用,后面的字是为了凑到两行的效果").setQuoteColor(Color.GREEN, 10, 10).setBackgroundColor(Color.LTGRAY) |
| 117 | +// .appendLine("测试列表项,后面的字是为了凑到两行的效果").setBullet(Color.GREEN, 20, 10).setBackgroundColor(Color.LTGRAY).setBackgroundColor(Color.GREEN) |
| 118 | +// .appendLine("32dp 字体").setFontSize(32, true) |
| 119 | +// .appendLine("2 倍字体").setFontProportion(2) |
| 120 | +// .appendLine("横向 2 倍字体").setFontXProportion(1.5f) |
| 121 | +// .appendLine("删除线").setStrikethrough() |
| 122 | +// .appendLine("下划线").setUnderline() |
| 123 | +// .append("测试").appendLine("上标").setSuperscript() |
| 124 | +// .append("测试").appendLine("下标").setSubscript() |
| 125 | +// .appendLine("粗体").setBold() |
| 126 | +// .appendLine("斜体").setItalic() |
| 127 | +// .appendLine("粗斜体").setBoldItalic() |
| 128 | +// .appendLine("monospace 字体").setFontFamily("monospace") |
| 129 | +// .appendLine("自定义字体").setTypeface(Typeface.createFromAsset(getAssets(), "fonts/dnmbhs.ttf")) |
| 130 | +// .appendLine("相反对齐").setAlign(Layout.Alignment.ALIGN_OPPOSITE) |
| 131 | +// .appendLine("居中对齐").setAlign(Layout.Alignment.ALIGN_CENTER) |
| 132 | +// .appendLine("正常对齐").setAlign(Layout.Alignment.ALIGN_NORMAL) |
| 133 | +// .append("测试").appendLine("点击事件").setClickSpan(clickableSpan) |
| 134 | +// .append("测试").appendLine("Url").setUrl("https://github.com/Blankj/AndroidUtilCode") |
| 135 | +// .append("测试").appendLine("模糊").setBlur(3, BlurMaskFilter.Blur.NORMAL) |
| 136 | +// .appendLine("颜色渐变").setShader(new LinearGradient(0, 0, |
| 137 | +// 64 * density * 4, 0, |
| 138 | +// getResources().getIntArray(R.array.rainbow), |
| 139 | +// null, |
| 140 | +// Shader.TileMode.REPEAT)).setFontSize(64, true) |
| 141 | +// .appendLine("图片着色").setFontSize(64, true).setShader(new BitmapShader(BitmapFactory.decodeResource(getResources(), R.drawable.span_cheetah), |
| 142 | +// Shader.TileMode.REPEAT, |
| 143 | +// Shader.TileMode.REPEAT)) |
| 144 | +// .appendLine("阴影效果").setFontSize(64, true).setBackgroundColor(Color.BLACK).setShadow(24, 8, 8, Color.WHITE) |
| 145 | +// |
| 146 | +// .append("小图").setBackgroundColor(Color.GREEN) |
| 147 | +// .appendImage(R.drawable.shape_spannable_block_low, SpanUtils.ALIGN_TOP) |
| 148 | +// .append("顶部").setBackgroundColor(Color.GREEN) |
| 149 | +// .appendImage(R.drawable.shape_spannable_block_low, SpanUtils.ALIGN_CENTER) |
| 150 | +// .append("居中").setBackgroundColor(Color.GREEN) |
| 151 | +// .appendImage(R.drawable.shape_spannable_block_low, SpanUtils.ALIGN_BASELINE) |
| 152 | +// .append("底部").setBackgroundColor(Color.GREEN) |
| 153 | +// .appendImage(R.drawable.shape_spannable_block_low, SpanUtils.ALIGN_BOTTOM) |
| 154 | +// .appendLine("对齐").setBackgroundColor(Color.GREEN) |
160 | 155 |
|
161 | 156 | .appendImage(R.drawable.shape_spannable_block_high, SpanUtils.ALIGN_TOP)
|
162 | 157 | .append("大图").setBackgroundColor(Color.LTGRAY)
|
|
0 commit comments