use of com.benmu.framework.utils.BMRichUtil in project WeexErosFramework by bmfe.
the class BMRich method aggregateChild.
private void aggregateChild(WXComponent child) {
if (child != null) {
ImmutableDomObject domObject = child.getDomObject();
if (domObject instanceof WXTextDomObject) {
WXTextDomObject textDomObject = (WXTextDomObject) domObject;
// Layout extra = textDomObject.getExtra();
// Log.e("extra", "extra>>>>>>" + extra + "count>>>>" + mSubCount);
BMRichUtil util = new BMRichUtil();
Spanned test = util.createSpan(textDomObject.getAttrs(), textDomObject.getStyles());
// if (extra instanceof StaticLayout) {
// CharSequence text = ((StaticLayout) extra).getText();
SpannableString spannableString = ((SpannableString) test);
Object[] spans = spannableString.getSpans(0, spannableString.length(), Object.class);
for (Object span : spans) {
mSpans.add(new RichTextDomObject.BMRichSpan(span, mText.length(), spannableString.length() + mText.length()));
}
// 设置span的事件
WXEvent events = domObject.getEvents();
for (String event : events) {
appendChildEvent(event, spannableString, textDomObject);
}
mText.append(spannableString.toString());
spannableStringBuilder.append(spannableString);
// }
}
}
mSubCount--;
// if (mSubCount == 0) {
// 子控件添加完毕 更新
update();
// }
}
use of com.benmu.framework.utils.BMRichUtil in project WeexErosFramework by bmfe.
the class BMRich method organizeChild.
private void organizeChild(WXDomObject object) {
if (object instanceof WXTextDomObject) {
WXTextDomObject textDomObject = (WXTextDomObject) object;
BMRichUtil util = new BMRichUtil();
Spanned test = util.createSpan(textDomObject.getAttrs(), textDomObject.getStyles());
SpannableString spannableString = ((SpannableString) test);
Object[] spans = spannableString.getSpans(0, spannableString.length(), Object.class);
for (Object span : spans) {
mSpans.add(new RichTextDomObject.BMRichSpan(span, mText.length(), spannableString.length() + mText.length()));
}
// 设置span的事件
WXEvent events = object.getEvents();
for (String event : events) {
appendChildEvent(event, spannableString, textDomObject);
}
mText.append(spannableString.toString());
spannableStringBuilder.append(spannableString);
}
update();
}
Aggregations