@OnCreateLayout static Component onCreateLayout(ComponentContext c, @State boolean left) { return Column.create(c) .alignItems(left ? YogaAlign.FLEX_START : YogaAlign.FLEX_END) .child( Row.create(c) .heightDip(40) .widthDip(40) .backgroundColor(Color.parseColor("#ee1111")) .transitionKey("red") .build()) .child( Row.create(c) .heightDip(40) .widthDip(40) .backgroundColor(Color.parseColor("#1111ee")) .transitionKey("blue") .build()) .child( Row.create(c) .heightDip(40) .widthDip(40) .backgroundColor(Color.parseColor("#11ee11")) .transitionKey("green") .build()) .clickHandler(LeftRightBlocksSequenceComponent.onClick(c)) .build(); }
@OnCreateLayout static Component onCreateLayout(ComponentContext c, @State boolean top) { return Row.create(c) .heightDip(200) .alignItems(top ? YogaAlign.FLEX_START : YogaAlign.FLEX_END) .child( Row.create(c) .heightDip(40) .flexGrow(1) .backgroundColor(Color.parseColor("#ee1111")) .transitionKey("red") .build()) .child( Row.create(c) .heightDip(40) .flexGrow(1) .backgroundColor(Color.parseColor("#1111ee")) .transitionKey("blue") .build()) .child( Row.create(c) .heightDip(40) .flexGrow(1) .backgroundColor(Color.parseColor("#11ee11")) .transitionKey("green") .build()) .clickHandler(UpDownBlocksComponent.onClick(c)) .build(); }
.heightDip(40) .widthDip(40) .backgroundColor(Color.parseColor("#ee1111")) .transitionKey("red") .build()) .heightDip(40) .widthDip(40) .backgroundColor(Color.parseColor("#1111ee")) .transitionKey("blue") .build()) .heightDip(40) .widthDip(40) .backgroundColor(Color.parseColor("#11ee11")) .transitionKey("green") .build()) .heightDip(40) .widthDip(40) .backgroundColor(Color.BLACK) .transitionKey("black") .build())
return !commentText ? Row.create(c) .backgroundColor(Color.WHITE) .heightDip(56) .child( .build() : Row.create(c) .backgroundColor(Color.WHITE) .heightDip(56) .child( .clickHandler(StoryFooterComponent.onClick(c)) .paddingDip(YogaEdge.ALL, 16) .backgroundColor(0xff0000ff) .child( Column.create(c)
.heightDip(60) .paddingDip(YogaEdge.ALL, 6) .backgroundColor(Color.GRAY) .child( Column.create(c) .marginDip(YogaEdge.TOP, 8) .paddingDip(YogaEdge.ALL, 6) .backgroundColor(Color.GRAY) .child( Column.create(c)
.heightDip(40) .widthDip(40) .backgroundColor(Color.parseColor("#ee1111")) .transitionKey(TRANSITION_KEY_RED) .build())) .heightDip(40) .widthDip(40) .backgroundColor(Color.parseColor("#1111ee")) .transitionKey(TRANSITION_KEY_BLUE) .build())) .heightDip(40) .widthDip(40) .backgroundColor(Color.parseColor("#11ee11")) .transitionKey(TRANSITION_KEY_GREEN) .build()))
.child(Text.create(c).text("textLeft1")) .child(Text.create(c).text("textRight1")) .backgroundColor(0xFFFF0000) .foregroundColor(0xFFFF0000) .paddingPx(ALL, paddingSize)
.child( Row.create(c) .backgroundColor(Color.LTGRAY) .child( Text.create(c)
private static Component affectedChildren(ComponentContext c, boolean flag1) { return Row.create(c) .transitionKey(TRANSITION_KEY_CONTAINER_1) .transitionKeyType(Transition.TransitionKeyType.GLOBAL) .heightDip(60 + 2 * 8) .widthDip((3 * 60) * (flag1 ? 0.5f : 1) + 4 * 8) .paddingDip(YogaEdge.ALL, 8) .backgroundColor(Color.YELLOW) .child( Column.create(c) .transitionKey(TRANSITION_KEY_CHILD_1_1) .transitionKeyType(Transition.TransitionKeyType.GLOBAL) .flex(1) .backgroundColor(Color.RED)) .child( Column.create(c) .transitionKey(TRANSITION_KEY_CHILD_1_2) .transitionKeyType(Transition.TransitionKeyType.GLOBAL) .flex(1) .backgroundColor(Color.RED) .marginDip(YogaEdge.HORIZONTAL, 8)) .child( Column.create(c) .flex(1) .transitionKey(TRANSITION_KEY_CHILD_1_3) .transitionKeyType(Transition.TransitionKeyType.GLOBAL) .backgroundColor(Color.RED)) .clickHandler(BoundsAnimationComponent.onFirstComponentClick(c)) .build(); }
.child( Row.create(c) .backgroundColor(saved ? Color.BLUE : Color.TRANSPARENT) .alignSelf(STRETCH) .paddingDip(HORIZONTAL, CARD_INSET)
private static Component affectedSiblings(ComponentContext c, boolean flag2) { return Row.create(c) .transitionKey(TRANSITION_KEY_CONTAINER_2) .transitionKeyType(Transition.TransitionKeyType.GLOBAL) .heightDip(60 + 2 * 8) .widthDip(3 * 60 + 3 * 8) .paddingDip(YogaEdge.ALL, 8) .backgroundColor(Color.LTGRAY) .child( Column.create(c) .transitionKey(TRANSITION_KEY_CHILD_2_1) .transitionKeyType(Transition.TransitionKeyType.GLOBAL) .flex(1) .backgroundColor(Color.RED)) .child( Column.create(c) .transitionKey(TRANSITION_KEY_CHILD_2_2) .transitionKeyType(Transition.TransitionKeyType.GLOBAL) .flex(flag2 ? 1 : 2) .backgroundColor(Color.YELLOW) .marginDip(YogaEdge.LEFT, 8)) .clickHandler(BoundsAnimationComponent.onSecondComponentClick(c)) .build(); }
@OnCreateLayout static Component onCreateLayout(ComponentContext c, @Prop final Decade decade) { return Row.create(c) .alignItems(YogaAlign.CENTER) .paddingDip(YogaEdge.ALL, 16) .child( Row.create(c) .heightPx(1) .backgroundColor(0xFFAAAAAA) .flex(1)) .child( Text.create(c) .text(String.valueOf(decade.year)) .textSizeDip(14) .textColor(0xFFAAAAAA) .marginDip(YogaEdge.HORIZONTAL, 10) .flex(0)) .child( Row.create(c) .heightPx(1) .backgroundColor(0xFFAAAAAA) .flex(1)) .backgroundColor(0xFFFAFAFA) .build(); } }
private static Component affectedParent(ComponentContext c, boolean flag3) { return Row.create(c) .justifyContent(YogaJustify.CENTER) .child( Row.create(c) .transitionKey(TRANSITION_KEY_CONTAINER_3) .transitionKeyType(Transition.TransitionKeyType.GLOBAL) .heightDip(60 + 2 * 8) .paddingDip(YogaEdge.ALL, 8) .backgroundColor(Color.LTGRAY) .child( Column.create(c) .transitionKey(TRANSITION_KEY_CHILD_3_1) .transitionKeyType(Transition.TransitionKeyType.GLOBAL) .widthDip(60 * (flag3 ? 1 : 2)) .backgroundColor(Color.YELLOW)) .clickHandler(BoundsAnimationComponent.onThirdComponentClick(c))) .build(); }
@OnEvent(RenderEvent.class) static RenderInfo onRender(ComponentContext c, @FromEvent Object model, @FromEvent int index) { return ComponentRenderInfo.create() .component( Row.create(c) .justifyContent(YogaJustify.CENTER) .widthDip(120) .heightDip(120) .backgroundColor((int) model) .child( Text.create(c) .textSizeSp(20) .textColor(Color.LTGRAY) .text(Integer.toString(index)) .verticalGravity(VerticalGravity.CENTER))) .build(); }
@OnCreateLayout static Component onCreateLayout(ComponentContext c) { return Row.create(c) .backgroundColor(0xDDFFFFFF) .positionType(YogaPositionType.ABSOLUTE) .positionDip(YogaEdge.RIGHT, 4) .positionDip(YogaEdge.TOP, 4) .paddingDip(YogaEdge.ALL, 2) .child(FavouriteButton.create(c)) .build(); } }