Skip to content

Commit 9883edb

Browse files
committed
HighlightEditText: 修复加载卡顿
1 parent da965f7 commit 9883edb

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

highLightText/src/main/java/org/evilbinary/highliter/HighlightEditText.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,23 @@ public void setHtml(String htmlSource) {
143143
}
144144
}
145145

146-
public void setSource(String source) {
146+
public void setSource(final String source) {
147147
if (source != null) {
148148
setText(source);
149-
String result = mMaker.pase(source);
150-
Spanned spanText = mConverter.convert(result);
151-
render(spanText, 0);
149+
new Thread() {
150+
@Override
151+
public void run() {
152+
super.run();
153+
String result = mMaker.pase(source);
154+
final Spanned spanText = mConverter.convert(result);
155+
post(new Runnable() {
156+
@Override
157+
public void run() {
158+
render(spanText, 0);
159+
}
160+
});
161+
}
162+
}.start();
152163
}
153164
}
154165

0 commit comments

Comments
 (0)