本文整理汇总了Java中com.facebook.csslayout.CSSNode.getClass方法的典型用法代码示例。如果您正苦于以下问题:Java CSSNode.getClass方法的具体用法?Java CSSNode.getClass怎么用?Java CSSNode.getClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.facebook.csslayout.CSSNode
的用法示例。
在下文中一共展示了CSSNode.getClass方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildSpannedFromTextCSSNode
import com.facebook.csslayout.CSSNode; //导入方法依赖的package包/类
private static void buildSpannedFromTextCSSNode(
ReactTextShadowNode textCSSNode,
SpannableStringBuilder sb,
List<SetSpanOperation> ops) {
int start = sb.length();
if (textCSSNode.mText != null) {
sb.append(textCSSNode.mText);
}
for (int i = 0, length = textCSSNode.getChildCount(); i < length; i++) {
CSSNode child = textCSSNode.getChildAt(i);
if (child instanceof ReactTextShadowNode) {
buildSpannedFromTextCSSNode((ReactTextShadowNode) child, sb, ops);
} else if (child instanceof ReactTextInlineImageShadowNode) {
// We make the image take up 1 character in the span and put a corresponding character into
// the text so that the image doesn't run over any following text.
sb.append(INLINE_IMAGE_PLACEHOLDER);
ops.add(
new SetSpanOperation(
sb.length() - INLINE_IMAGE_PLACEHOLDER.length(),
sb.length(),
((ReactTextInlineImageShadowNode) child).buildInlineImageSpan()));
} else {
throw new IllegalViewOperationException("Unexpected view type nested under text node: "
+ child.getClass());
}
((ReactShadowNode) child).markUpdateSeen();
}
int end = sb.length();
if (end >= start) {
if (textCSSNode.mIsColorSet) {
ops.add(new SetSpanOperation(start, end, new ForegroundColorSpan(textCSSNode.mColor)));
}
if (textCSSNode.mIsBackgroundColorSet) {
ops.add(new SetSpanOperation(
start,
end,
new BackgroundColorSpan(textCSSNode.mBackgroundColor)));
}
if (textCSSNode.mFontSize != UNSET) {
ops.add(new SetSpanOperation(start, end, new AbsoluteSizeSpan(textCSSNode.mFontSize)));
}
if (textCSSNode.mFontStyle != UNSET ||
textCSSNode.mFontWeight != UNSET ||
textCSSNode.mFontFamily != null) {
ops.add(new SetSpanOperation(
start,
end,
new CustomStyleSpan(
textCSSNode.mFontStyle,
textCSSNode.mFontWeight,
textCSSNode.mFontFamily,
textCSSNode.getThemedContext().getAssets())));
}
if (textCSSNode.mTextShadowOffsetDx != 0 || textCSSNode.mTextShadowOffsetDy != 0) {
ops.add(new SetSpanOperation(
start,
end,
new ShadowStyleSpan(
textCSSNode.mTextShadowOffsetDx,
textCSSNode.mTextShadowOffsetDy,
textCSSNode.mTextShadowRadius,
textCSSNode.mTextShadowColor)));
}
ops.add(new SetSpanOperation(start, end, new ReactTagSpan(textCSSNode.getReactTag())));
}
}
示例2: buildSpannedFromTextCSSNode
import com.facebook.csslayout.CSSNode; //导入方法依赖的package包/类
private static void buildSpannedFromTextCSSNode(
ReactTextShadowNode textCSSNode,
SpannableStringBuilder sb,
List<SetSpanOperation> ops) {
int start = sb.length();
if (textCSSNode.mText != null) {
sb.append(textCSSNode.mText);
}
for (int i = 0, length = textCSSNode.getChildCount(); i < length; i++) {
CSSNode child = textCSSNode.getChildAt(i);
if (child instanceof ReactTextShadowNode) {
buildSpannedFromTextCSSNode((ReactTextShadowNode) child, sb, ops);
} else if (child instanceof ReactTextInlineImageShadowNode) {
// We make the image take up 1 character in the span and put a corresponding character into
// the text so that the image doesn't run over any following text.
sb.append(INLINE_IMAGE_PLACEHOLDER);
ops.add(
new SetSpanOperation(
sb.length() - INLINE_IMAGE_PLACEHOLDER.length(),
sb.length(),
((ReactTextInlineImageShadowNode) child).buildInlineImageSpan()));
} else {
throw new IllegalViewOperationException("Unexpected view type nested under text node: "
+ child.getClass());
}
((ReactShadowNode) child).markUpdateSeen();
}
int end = sb.length();
if (end >= start) {
if (textCSSNode.mIsColorSet) {
ops.add(new SetSpanOperation(start, end, new ForegroundColorSpan(textCSSNode.mColor)));
}
if (textCSSNode.mIsBackgroundColorSet) {
ops.add(new SetSpanOperation(
start,
end,
new BackgroundColorSpan(textCSSNode.mBackgroundColor)));
}
if (textCSSNode.mFontSize != UNSET) {
ops.add(new SetSpanOperation(start, end, new AbsoluteSizeSpan(textCSSNode.mFontSize)));
}
if (textCSSNode.mFontStyle != UNSET ||
textCSSNode.mFontWeight != UNSET ||
textCSSNode.mFontFamily != null) {
ops.add(new SetSpanOperation(
start,
end,
new CustomStyleSpan(
textCSSNode.mFontStyle,
textCSSNode.mFontWeight,
textCSSNode.mFontFamily,
textCSSNode.getThemedContext().getAssets())));
}
if (textCSSNode.mIsUnderlineTextDecorationSet) {
ops.add(new SetSpanOperation(start, end, new UnderlineSpan()));
}
if (textCSSNode.mIsLineThroughTextDecorationSet) {
ops.add(new SetSpanOperation(start, end, new StrikethroughSpan()));
}
if (textCSSNode.mTextShadowOffsetDx != 0 || textCSSNode.mTextShadowOffsetDy != 0) {
ops.add(new SetSpanOperation(
start,
end,
new ShadowStyleSpan(
textCSSNode.mTextShadowOffsetDx,
textCSSNode.mTextShadowOffsetDy,
textCSSNode.mTextShadowRadius,
textCSSNode.mTextShadowColor)));
}
ops.add(new SetSpanOperation(start, end, new ReactTagSpan(textCSSNode.getReactTag())));
}
}