本文整理汇总了Java中com.facebook.csslayout.CSSPositionType类的典型用法代码示例。如果您正苦于以下问题:Java CSSPositionType类的具体用法?Java CSSPositionType怎么用?Java CSSPositionType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CSSPositionType类属于com.facebook.csslayout包,在下文中一共展示了CSSPositionType类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testPosition
import com.facebook.csslayout.CSSPositionType; //导入依赖的package包/类
@Test
public void testPosition() {
LayoutShadowNode reactShadowNode = spy(new LayoutShadowNode());
ReactStylesDiffMap map = spy(buildStyles(
"position", "absolute",
"bottom", 10.0,
"right", 5.0));
reactShadowNode.updateProperties(map);
verify(reactShadowNode).setPositionBottom(anyFloat());
verify(reactShadowNode).setPositionRight(anyFloat());
verify(reactShadowNode).setPositionType(any(CSSPositionType.class));
verify(map).getFloat("bottom", Float.NaN);
verify(map).getFloat("right", Float.NaN);
reactShadowNode = spy(new LayoutShadowNode());
map = spy(buildStyles());
reactShadowNode.updateProperties(map);
verify(reactShadowNode, never()).setPositionBottom(anyFloat());
verify(reactShadowNode, never()).setPositionRight(anyFloat());
verify(reactShadowNode, never()).setPositionType(any(CSSPositionType.class));
verify(map, never()).getFloat("bottom", Float.NaN);
verify(map, never()).getFloat("right", Float.NaN);
}
示例2: setPosition
import com.facebook.csslayout.CSSPositionType; //导入依赖的package包/类
private static void setPosition() {
String position = mInlineMap.get(POSITION);
Log.d(TAG, "setPosition: with postion" + position);
if (position != null && position.equals(ABSOLUTE)) {
mNode.setPositionType(CSSPositionType.ABSOLUTE);
String top = mInlineMap.get(TOP);
if (top != null) {
mNode.setPositionTop(pixelFloat(top));
}
String left = mInlineMap.get(LEFT);
if (left != null) {
mNode.setPositionLeft(pixelFloat(left));
}
String bottom = mInlineMap.get(BOTTOM);
if (bottom != null) {
mNode.setPositionBottom(pixelFloat(bottom));
}
String right = mInlineMap.get(RIGHT);
if (right != null) {
mNode.setPositionRight(pixelFloat(right));
}
}
}
示例3: testEnumerations
import com.facebook.csslayout.CSSPositionType; //导入依赖的package包/类
@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));
}
示例4: testPosition
import com.facebook.csslayout.CSSPositionType; //导入依赖的package包/类
@Test
public void testPosition() {
LayoutShadowNode reactShadowNode = spy(new LayoutShadowNode());
ReactStylesDiffMap map = spy(buildStyles(
"position",
"absolute",
"bottom",
10.0,
"right",
5.0));
reactShadowNode.updateProperties(map);
verify(reactShadowNode).setPosition(eq(Spacing.BOTTOM), anyFloat());
verify(reactShadowNode).setPosition(eq(Spacing.END), anyFloat());
verify(reactShadowNode).setPositionType(any(CSSPositionType.class));
verify(map).getFloat("bottom", Float.NaN);
verify(map).getFloat("right", Float.NaN);
reactShadowNode = spy(new LayoutShadowNode());
map = spy(buildStyles());
reactShadowNode.updateProperties(map);
verify(reactShadowNode, never()).setPosition(eq(Spacing.BOTTOM), anyFloat());
verify(reactShadowNode, never()).setPosition(eq(Spacing.END), anyFloat());
verify(reactShadowNode, never()).setPositionType(any(CSSPositionType.class));
verify(map, never()).getFloat("bottom", Float.NaN);
verify(map, never()).getFloat("right", Float.NaN);
}
示例5: testEnumerations
import com.facebook.csslayout.CSSPositionType; //导入依赖的package包/类
@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));
}
示例6: createShadowNodeInstance
import com.facebook.csslayout.CSSPositionType; //导入依赖的package包/类
@Override
public KeyboardShadowNode createShadowNodeInstance() {
KeyboardShadowNode keyboardShadowNode = new KeyboardShadowNode();
keyboardShadowNode.setPositionType(CSSPositionType.ABSOLUTE);
keyboardShadowNode.setPositionValues(0, 0);
keyboardShadowNode.setPositionValues(3, 0);
return keyboardShadowNode;
}
示例7: clear
import com.facebook.csslayout.CSSPositionType; //导入依赖的package包/类
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;
}
示例8: setPosition
import com.facebook.csslayout.CSSPositionType; //导入依赖的package包/类
@ReactProp(name = ViewProps.POSITION)
public void setPosition(@Nullable String position) {
CSSPositionType positionType = position == null ?
CSSPositionType.RELATIVE : CSSPositionType.valueOf(position.toUpperCase(Locale.US));
setPositionType(positionType);
}
示例9: testPropertiesResetToDefault
import com.facebook.csslayout.CSSPositionType; //导入依赖的package包/类
@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);
}
示例10: parseCssAttribute
import com.facebook.csslayout.CSSPositionType; //导入依赖的package包/类
private void parseCssAttribute(Context context, AttributeSet attrs) {
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.CSSLayout_LayoutParams);
final int N = a.getIndexCount();
for (int i = 0; i < N; i++) {
int attr = a.getIndex(i);
switch (attr) {
//case R.styleable.CSSLayout_LayoutParams_layout_width:
// node.setStyleWidth(a.getDimension(attr, 0));
// break;
//case R.styleable.CSSLayout_LayoutParams_layout_height:
// node.setStyleHeight(a.getDimension(attr, 0));
// break;
case R.styleable.CSSLayout_LayoutParams_layout_minWidth:
minHeight = a.getDimension(attr, 0);
break;
case R.styleable.CSSLayout_LayoutParams_layout_minHeight:
minHeight = a.getDimension(attr, 0);
break;
case R.styleable.CSSLayout_LayoutParams_layout_maxWidth:
maxWidth = a.getDimension(attr, 0);
break;
case R.styleable.CSSLayout_LayoutParams_layout_maxHeight:
maxHeight = a.getDimension(attr, 0);
break;
case R.styleable.CSSLayout_LayoutParams_layout_left:
left = a.getDimension(attr, 0);
break;
case R.styleable.CSSLayout_LayoutParams_layout_right:
right = a.getDimension(attr, 0);
break;
case R.styleable.CSSLayout_LayoutParams_layout_top:
top = a.getDimension(attr, 0);
break;
case R.styleable.CSSLayout_LayoutParams_layout_bottom:
bottom = a.getDimension(attr, 0);
break;
case R.styleable.CSSLayout_LayoutParams_layout_margin:
margin = a.getDimension(attr, 0);
break;
case R.styleable.CSSLayout_LayoutParams_layout_marginLeft:
marginLeft = a.getDimension(attr, 0);
break;
case R.styleable.CSSLayout_LayoutParams_layout_marginRight:
marginRight = a.getDimension(attr, 0);
break;
case R.styleable.CSSLayout_LayoutParams_layout_marginTop:
marginTop = a.getDimension(attr, 0);
break;
case R.styleable.CSSLayout_LayoutParams_layout_marginBottom:
marginBottom = a.getDimension(attr, 0);
break;
case R.styleable.CSSLayout_LayoutParams_layout_alignSelf:
alignSelf = getEnum(a.getInt(attr, 0), CSSAlign.class);
break;
case R.styleable.CSSLayout_LayoutParams_layout_flex:
flex = a.getFloat(attr, 0);
break;
case R.styleable.CSSLayout_LayoutParams_layout_position:
position = getEnum(a.getInt(attr, 0), CSSPositionType.class);
break;
}
}
a.recycle();
}