Java 类com.facebook.csslayout.CSSJustify 实例源码

项目:LuaViewPlayground    文件:FlexboxCSSParser.java   
private static void setJustfiyContent() {
    String justifyContent = mInlineMap.get(JUSTIFYCONTENT);
    if (justifyContent != null) {
        CSSJustify juc = justifyMap.get(justifyContent);
        if (juc != null) {
            mNode.setJustifyContent(juc);
        }
    }
}
项目:ReactNativeSignatureExample    文件:LayoutPropertyApplicatorTest.java   
@Test
public void testEnumerations() {
  LayoutShadowNode reactShadowNode = spy(new LayoutShadowNode());
  ReactStylesDiffMap map = buildStyles(
      "flexDirection", "column",
      "alignSelf", "stretch",
      "alignItems", "center",
      "justifyContent", "space_between",
      "position", "relative");

  reactShadowNode.updateProperties(map);
  verify(reactShadowNode).setFlexDirection(CSSFlexDirection.COLUMN);
  verify(reactShadowNode).setAlignSelf(CSSAlign.STRETCH);
  verify(reactShadowNode).setAlignItems(CSSAlign.CENTER);
  verify(reactShadowNode).setJustifyContent(CSSJustify.SPACE_BETWEEN);
  verify(reactShadowNode).setPositionType(CSSPositionType.RELATIVE);

  reactShadowNode = spy(new LayoutShadowNode());
  map = buildStyles();
  reactShadowNode.updateProperties(map);

  verify(reactShadowNode, never()).setFlexDirection(any(CSSFlexDirection.class));
  verify(reactShadowNode, never()).setAlignSelf(any(CSSAlign.class));
  verify(reactShadowNode, never()).setAlignItems(any(CSSAlign.class));
  verify(reactShadowNode, never()).setJustifyContent(any(CSSJustify.class));
  verify(reactShadowNode, never()).setPositionType(any(CSSPositionType.class));
}
项目:react-native-ibeacon-android    文件:LayoutPropertyApplicatorTest.java   
@Test
public void testEnumerations() {
  LayoutShadowNode reactShadowNode = spy(new LayoutShadowNode());
  ReactStylesDiffMap map = buildStyles(
      "flexDirection", "column",
      "alignSelf", "stretch",
      "alignItems", "center",
      "justifyContent", "space_between",
      "position", "relative");

  reactShadowNode.updateProperties(map);
  verify(reactShadowNode).setFlexDirection(CSSFlexDirection.COLUMN);
  verify(reactShadowNode).setAlignSelf(CSSAlign.STRETCH);
  verify(reactShadowNode).setAlignItems(CSSAlign.CENTER);
  verify(reactShadowNode).setJustifyContent(CSSJustify.SPACE_BETWEEN);
  verify(reactShadowNode).setPositionType(CSSPositionType.RELATIVE);

  reactShadowNode = spy(new LayoutShadowNode());
  map = buildStyles();
  reactShadowNode.updateProperties(map);

  verify(reactShadowNode, never()).setFlexDirection(any(CSSFlexDirection.class));
  verify(reactShadowNode, never()).setAlignSelf(any(CSSAlign.class));
  verify(reactShadowNode, never()).setAlignItems(any(CSSAlign.class));
  verify(reactShadowNode, never()).setJustifyContent(any(CSSJustify.class));
  verify(reactShadowNode, never()).setPositionType(any(CSSPositionType.class));
}
项目:react-native-box-loaders    文件:LayoutPropertyApplicatorTest.java   
@Test
public void testEnumerations() {
  LayoutShadowNode reactShadowNode = spy(new LayoutShadowNode());
  ReactStylesDiffMap map = buildStyles(
      "flexDirection", "column",
      "alignSelf", "stretch",
      "alignItems", "center",
      "justifyContent", "space_between",
      "position", "relative");

  reactShadowNode.updateProperties(map);
  verify(reactShadowNode).setFlexDirection(CSSFlexDirection.COLUMN);
  verify(reactShadowNode).setAlignSelf(CSSAlign.STRETCH);
  verify(reactShadowNode).setAlignItems(CSSAlign.CENTER);
  verify(reactShadowNode).setJustifyContent(CSSJustify.SPACE_BETWEEN);
  verify(reactShadowNode).setPositionType(CSSPositionType.RELATIVE);

  reactShadowNode = spy(new LayoutShadowNode());
  map = buildStyles();
  reactShadowNode.updateProperties(map);

  verify(reactShadowNode, never()).setFlexDirection(any(CSSFlexDirection.class));
  verify(reactShadowNode, never()).setAlignSelf(any(CSSAlign.class));
  verify(reactShadowNode, never()).setAlignItems(any(CSSAlign.class));
  verify(reactShadowNode, never()).setJustifyContent(any(CSSJustify.class));
  verify(reactShadowNode, never()).setPositionType(any(CSSPositionType.class));
}
项目:Ironman    文件:LayoutPropertyApplicatorTest.java   
@Test
public void testEnumerations() {
  LayoutShadowNode reactShadowNode = spy(new LayoutShadowNode());
  ReactStylesDiffMap map = buildStyles(
      "flexDirection",
      "column",
      "alignSelf",
      "stretch",
      "alignItems",
      "center",
      "justifyContent",
      "space_between",
      "position",
      "relative");

  reactShadowNode.updateProperties(map);
  verify(reactShadowNode).setFlexDirection(CSSFlexDirection.COLUMN);
  verify(reactShadowNode).setAlignSelf(CSSAlign.STRETCH);
  verify(reactShadowNode).setAlignItems(CSSAlign.CENTER);
  verify(reactShadowNode).setJustifyContent(CSSJustify.SPACE_BETWEEN);
  verify(reactShadowNode).setPositionType(CSSPositionType.RELATIVE);

  reactShadowNode = spy(new LayoutShadowNode());
  map = buildStyles();
  reactShadowNode.updateProperties(map);

  verify(reactShadowNode, never()).setFlexDirection(any(CSSFlexDirection.class));
  verify(reactShadowNode, never()).setAlignSelf(any(CSSAlign.class));
  verify(reactShadowNode, never()).setAlignItems(any(CSSAlign.class));
  verify(reactShadowNode, never()).setJustifyContent(any(CSSJustify.class));
  verify(reactShadowNode, never()).setPositionType(any(CSSPositionType.class));
}
项目:CSSLayout    文件:CSSLayout.java   
public void clear() {
    style.direction = CSSDirection.INHERIT;
    style.flexDirection = CSSFlexDirection.COLUMN;
    style.justifyContent = CSSJustify.FLEX_START;
    style.alignContent = CSSAlign.FLEX_START;
    style.alignItems = CSSAlign.STRETCH;
    style.alignSelf = CSSAlign.AUTO;
    style.positionType = CSSPositionType.RELATIVE;
    style.flexWrap = CSSWrap.NOWRAP;
    style.flex = 0;

    style.margin = new Spacing();
    style.padding = new Spacing();
    style.border = new Spacing();

    style.positionTop = CSSConstants.UNDEFINED;
    style.positionBottom = CSSConstants.UNDEFINED;
    style.positionLeft = CSSConstants.UNDEFINED;
    style.positionRight = CSSConstants.UNDEFINED;

    style.width = CSSConstants.UNDEFINED;
    style.height = CSSConstants.UNDEFINED;

    style.minWidth = CSSConstants.UNDEFINED;
    style.minHeight = CSSConstants.UNDEFINED;

    style.maxWidth = CSSConstants.UNDEFINED;
    style.maxHeight = CSSConstants.UNDEFINED;
}
项目:ReactNativeSignatureExample    文件:LayoutShadowNode.java   
@ReactProp(name = ViewProps.JUSTIFY_CONTENT)
public void setJustifyContent(@Nullable String justifyContent) {
  setJustifyContent(justifyContent == null ? CSSJustify.FLEX_START : CSSJustify.valueOf(
          justifyContent.toUpperCase(Locale.US).replace("-", "_")));
}
项目:ReactNativeSignatureExample    文件:LayoutPropertyApplicatorTest.java   
@Test
public void testPropertiesResetToDefault() {
  DisplayMetrics displayMetrics = new DisplayMetrics();
  displayMetrics.density = 1.0f;
  DisplayMetricsHolder.setWindowDisplayMetrics(displayMetrics);

  LayoutShadowNode reactShadowNode = spy(new LayoutShadowNode());
  ReactStylesDiffMap map = buildStyles(
      "width", 10.0,
      "height", 10.0,
      "left", 10.0,
      "top", 10.0,
      "flex", 1.0,
      "padding", 10.0,
      "marginLeft", 10.0,
      "borderTopWidth", 10.0,
      "flexDirection", "row",
      "alignSelf", "stretch",
      "alignItems", "center",
      "justifyContent", "space_between",
      "position", "absolute");

  reactShadowNode.updateProperties(map);
  verify(reactShadowNode).setStyleWidth(10.f);
  verify(reactShadowNode).setStyleHeight(10.f);
  verify(reactShadowNode).setPositionLeft(10.f);
  verify(reactShadowNode).setPositionTop(10.f);
  verify(reactShadowNode).setFlex(1.0f);
  verify(reactShadowNode).setPadding(Spacing.ALL, 10.f);
  verify(reactShadowNode).setMargin(Spacing.LEFT, 10.f);
  verify(reactShadowNode).setBorder(Spacing.TOP, 10.f);
  verify(reactShadowNode).setFlexDirection(CSSFlexDirection.ROW);
  verify(reactShadowNode).setAlignSelf(CSSAlign.STRETCH);
  verify(reactShadowNode).setAlignItems(CSSAlign.CENTER);
  verify(reactShadowNode).setJustifyContent(CSSJustify.SPACE_BETWEEN);
  verify(reactShadowNode).setPositionType(CSSPositionType.ABSOLUTE);

  map = buildStyles(
      "width", null,
      "height", null,
      "left", null,
      "top", null,
      "flex", null,
      "padding", null,
      "marginLeft", null,
      "borderTopWidth", null,
      "flexDirection", null,
      "alignSelf", null,
      "alignItems", null,
      "justifyContent", null,
      "position", null);

  reset(reactShadowNode);
  reactShadowNode.updateProperties(map);
  verify(reactShadowNode).setStyleWidth(CSSConstants.UNDEFINED);
  verify(reactShadowNode).setStyleHeight(CSSConstants.UNDEFINED);
  verify(reactShadowNode).setPositionLeft(CSSConstants.UNDEFINED);
  verify(reactShadowNode).setPositionTop(CSSConstants.UNDEFINED);
  verify(reactShadowNode).setFlex(0.f);
  verify(reactShadowNode).setPadding(Spacing.ALL, CSSConstants.UNDEFINED);
  verify(reactShadowNode).setMargin(Spacing.LEFT, CSSConstants.UNDEFINED);
  verify(reactShadowNode).setBorder(Spacing.TOP, CSSConstants.UNDEFINED);
  verify(reactShadowNode).setFlexDirection(CSSFlexDirection.COLUMN);
  verify(reactShadowNode).setAlignSelf(CSSAlign.AUTO);
  verify(reactShadowNode).setAlignItems(CSSAlign.STRETCH);
  verify(reactShadowNode).setJustifyContent(CSSJustify.FLEX_START);
  verify(reactShadowNode).setPositionType(CSSPositionType.RELATIVE);
}
项目:react-native-ibeacon-android    文件:LayoutShadowNode.java   
@ReactProp(name = ViewProps.JUSTIFY_CONTENT)
public void setJustifyContent(@Nullable String justifyContent) {
  setJustifyContent(justifyContent == null ? CSSJustify.FLEX_START : CSSJustify.valueOf(
          justifyContent.toUpperCase(Locale.US).replace("-", "_")));
}
项目:react-native-ibeacon-android    文件:LayoutPropertyApplicatorTest.java   
@Test
public void testPropertiesResetToDefault() {
  DisplayMetrics displayMetrics = new DisplayMetrics();
  displayMetrics.density = 1.0f;
  DisplayMetricsHolder.setWindowDisplayMetrics(displayMetrics);

  LayoutShadowNode reactShadowNode = spy(new LayoutShadowNode());
  ReactStylesDiffMap map = buildStyles(
      "width", 10.0,
      "height", 10.0,
      "left", 10.0,
      "top", 10.0,
      "flex", 1.0,
      "padding", 10.0,
      "marginLeft", 10.0,
      "borderTopWidth", 10.0,
      "flexDirection", "row",
      "alignSelf", "stretch",
      "alignItems", "center",
      "justifyContent", "space_between",
      "position", "absolute");

  reactShadowNode.updateProperties(map);
  verify(reactShadowNode).setStyleWidth(10.f);
  verify(reactShadowNode).setStyleHeight(10.f);
  verify(reactShadowNode).setPositionLeft(10.f);
  verify(reactShadowNode).setPositionTop(10.f);
  verify(reactShadowNode).setFlex(1.0f);
  verify(reactShadowNode).setPadding(Spacing.ALL, 10.f);
  verify(reactShadowNode).setMargin(Spacing.LEFT, 10.f);
  verify(reactShadowNode).setBorder(Spacing.TOP, 10.f);
  verify(reactShadowNode).setFlexDirection(CSSFlexDirection.ROW);
  verify(reactShadowNode).setAlignSelf(CSSAlign.STRETCH);
  verify(reactShadowNode).setAlignItems(CSSAlign.CENTER);
  verify(reactShadowNode).setJustifyContent(CSSJustify.SPACE_BETWEEN);
  verify(reactShadowNode).setPositionType(CSSPositionType.ABSOLUTE);

  map = buildStyles(
      "width", null,
      "height", null,
      "left", null,
      "top", null,
      "flex", null,
      "padding", null,
      "marginLeft", null,
      "borderTopWidth", null,
      "flexDirection", null,
      "alignSelf", null,
      "alignItems", null,
      "justifyContent", null,
      "position", null);

  reset(reactShadowNode);
  reactShadowNode.updateProperties(map);
  verify(reactShadowNode).setStyleWidth(CSSConstants.UNDEFINED);
  verify(reactShadowNode).setStyleHeight(CSSConstants.UNDEFINED);
  verify(reactShadowNode).setPositionLeft(CSSConstants.UNDEFINED);
  verify(reactShadowNode).setPositionTop(CSSConstants.UNDEFINED);
  verify(reactShadowNode).setFlex(0.f);
  verify(reactShadowNode).setPadding(Spacing.ALL, CSSConstants.UNDEFINED);
  verify(reactShadowNode).setMargin(Spacing.LEFT, CSSConstants.UNDEFINED);
  verify(reactShadowNode).setBorder(Spacing.TOP, CSSConstants.UNDEFINED);
  verify(reactShadowNode).setFlexDirection(CSSFlexDirection.COLUMN);
  verify(reactShadowNode).setAlignSelf(CSSAlign.AUTO);
  verify(reactShadowNode).setAlignItems(CSSAlign.STRETCH);
  verify(reactShadowNode).setJustifyContent(CSSJustify.FLEX_START);
  verify(reactShadowNode).setPositionType(CSSPositionType.RELATIVE);
}
项目:react-native-box-loaders    文件:LayoutShadowNode.java   
@ReactProp(name = ViewProps.JUSTIFY_CONTENT)
public void setJustifyContent(@Nullable String justifyContent) {
  setJustifyContent(justifyContent == null ? CSSJustify.FLEX_START : CSSJustify.valueOf(
          justifyContent.toUpperCase(Locale.US).replace("-", "_")));
}
项目:react-native-box-loaders    文件:LayoutPropertyApplicatorTest.java   
@Test
public void testPropertiesResetToDefault() {
  DisplayMetrics displayMetrics = new DisplayMetrics();
  displayMetrics.density = 1.0f;
  DisplayMetricsHolder.setWindowDisplayMetrics(displayMetrics);

  LayoutShadowNode reactShadowNode = spy(new LayoutShadowNode());
  ReactStylesDiffMap map = buildStyles(
      "width", 10.0,
      "height", 10.0,
      "left", 10.0,
      "top", 10.0,
      "flex", 1.0,
      "padding", 10.0,
      "marginLeft", 10.0,
      "borderTopWidth", 10.0,
      "flexDirection", "row",
      "alignSelf", "stretch",
      "alignItems", "center",
      "justifyContent", "space_between",
      "position", "absolute");

  reactShadowNode.updateProperties(map);
  verify(reactShadowNode).setStyleWidth(10.f);
  verify(reactShadowNode).setStyleHeight(10.f);
  verify(reactShadowNode).setPositionLeft(10.f);
  verify(reactShadowNode).setPositionTop(10.f);
  verify(reactShadowNode).setFlex(1.0f);
  verify(reactShadowNode).setPadding(Spacing.ALL, 10.f);
  verify(reactShadowNode).setMargin(Spacing.LEFT, 10.f);
  verify(reactShadowNode).setBorder(Spacing.TOP, 10.f);
  verify(reactShadowNode).setFlexDirection(CSSFlexDirection.ROW);
  verify(reactShadowNode).setAlignSelf(CSSAlign.STRETCH);
  verify(reactShadowNode).setAlignItems(CSSAlign.CENTER);
  verify(reactShadowNode).setJustifyContent(CSSJustify.SPACE_BETWEEN);
  verify(reactShadowNode).setPositionType(CSSPositionType.ABSOLUTE);

  map = buildStyles(
      "width", null,
      "height", null,
      "left", null,
      "top", null,
      "flex", null,
      "padding", null,
      "marginLeft", null,
      "borderTopWidth", null,
      "flexDirection", null,
      "alignSelf", null,
      "alignItems", null,
      "justifyContent", null,
      "position", null);

  reset(reactShadowNode);
  reactShadowNode.updateProperties(map);
  verify(reactShadowNode).setStyleWidth(CSSConstants.UNDEFINED);
  verify(reactShadowNode).setStyleHeight(CSSConstants.UNDEFINED);
  verify(reactShadowNode).setPositionLeft(CSSConstants.UNDEFINED);
  verify(reactShadowNode).setPositionTop(CSSConstants.UNDEFINED);
  verify(reactShadowNode).setFlex(0.f);
  verify(reactShadowNode).setPadding(Spacing.ALL, CSSConstants.UNDEFINED);
  verify(reactShadowNode).setMargin(Spacing.LEFT, CSSConstants.UNDEFINED);
  verify(reactShadowNode).setBorder(Spacing.TOP, CSSConstants.UNDEFINED);
  verify(reactShadowNode).setFlexDirection(CSSFlexDirection.COLUMN);
  verify(reactShadowNode).setAlignSelf(CSSAlign.AUTO);
  verify(reactShadowNode).setAlignItems(CSSAlign.STRETCH);
  verify(reactShadowNode).setJustifyContent(CSSJustify.FLEX_START);
  verify(reactShadowNode).setPositionType(CSSPositionType.RELATIVE);
}
项目:Ironman    文件:LayoutShadowNode.java   
@ReactProp(name = ViewProps.JUSTIFY_CONTENT)
public void setJustifyContent(@Nullable String justifyContent) {
  setJustifyContent(justifyContent == null ? CSSJustify.FLEX_START : CSSJustify.valueOf(
          justifyContent.toUpperCase(Locale.US).replace("-", "_")));
}
项目:CSSLayout    文件:CSSLayout.java   
private void parseCssAttribute(Context context, AttributeSet attrs) {
    TypedArray a = context.obtainStyledAttributes(attrs,
            R.styleable.CSSLayout);

    final int N = a.getIndexCount();
    for (int i = 0; i < N; i++) {
        int attr = a.getIndex(i);
        switch (attr) {
            case R.styleable.CSSLayout_direction:
                setDirection(getEnum(a.getInt(attr, 0), CSSDirection.class));
                break;
            case R.styleable.CSSLayout_flexDirection:
                setFlexDirection(getEnum(a.getInt(attr, 0), CSSFlexDirection.class));
                break;
            case R.styleable.CSSLayout_justifyContent:
                setJustifyContent(getEnum(a.getInt(attr, 0), CSSJustify.class));
                break;
            case R.styleable.CSSLayout_alignContent:
                setAlignContent(getEnum(a.getInt(attr, 0), CSSAlign.class));
                break;
            case R.styleable.CSSLayout_alignItems:
                setAlignItems(getEnum(a.getInt(attr, 0), CSSAlign.class));
                break;
            case R.styleable.CSSLayout_flexWrap:
                setFlexWrap(getEnum(a.getInt(attr, 0), CSSWrap.class));
                break;

            case R.styleable.CSSLayout_padding:
                setPadding(a.getDimension(attr, 0));
                break;
            case R.styleable.CSSLayout_paddingLeft:
                setPaddingLeft(a.getDimension(attr, 0));
                break;
            case R.styleable.CSSLayout_paddingRight:
                setPaddingRight(a.getDimension(attr, 0));
                break;
            case R.styleable.CSSLayout_paddingTop:
                setPaddingTop(a.getDimension(attr, 0));
                break;
            case R.styleable.CSSLayout_paddingBottom:
                setPaddingBottom(a.getDimension(attr, 0));
                break;


            case R.styleable.CSSLayout_borderWidth:
                setBorderWidth(a.getDimension(attr, 0));
                break;
            case R.styleable.CSSLayout_borderLeftWidth:
                setBorderLeftWidth(a.getDimension(attr, 0));
                break;
            case R.styleable.CSSLayout_borderRightWidth:
                setBorderRightWidth(a.getDimension(attr, 0));
                break;
            case R.styleable.CSSLayout_borderTopWidth:
                setBorderTopWidth(a.getDimension(attr, 0));
                break;
            case R.styleable.CSSLayout_borderBottomWidth:
                setBorderBottomWidth(a.getDimension(attr, 0));
                break;
        }
    }
    a.recycle();
}
项目:CSSLayout    文件:CSSLayout.java   
public void setJustifyContent(CSSJustify justifyContent) {
    mCSSNode.setJustifyContent(justifyContent);
    requestLayoutWhithoutDirty();
}