当前位置: 首页>>代码示例>>Java>>正文


Java CSSNode.getClass方法代码示例

本文整理汇总了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())));
  }
}
 
开发者ID:john1jan,项目名称:ReactNativeSignatureExample,代码行数:67,代码来源:ReactTextShadowNode.java

示例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())));
  }
}
 
开发者ID:ManrajGrover,项目名称:react-native-box-loaders,代码行数:73,代码来源:ReactTextShadowNode.java


注:本文中的com.facebook.csslayout.CSSNode.getClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。