@Override public Builder child(@Nullable Component.Builder<?> child) { if (child == null) { return this; } return child(child.build()); }
static Component.Builder createMessageContent(ComponentContext c, String messageText) { return Row.create(c) .paddingDip(YogaEdge.ALL, 8) .marginDip(YogaEdge.ALL, 8) .background(ExpandableElementUtil.getMessageBackground(c, 0xFF0084FF)) .child(Text.create(c).textSizeDip(18).textColor(Color.WHITE).text(messageText)); } }
@Override protected Component onCreateLayout(final ComponentContext c) { return create(c).child(Row.create(c).child(innerComponent).flexShrink(0)).build(); } };
@Override protected Component onCreateLayout(ComponentContext c) { return Row.create(c) .child(Row.create(c).transitionKey("test").transitionKeyType(Transition.TransitionKeyType.GLOBAL)) .child(Row.create(c).transitionKey("test").transitionKeyType(Transition.TransitionKeyType.GLOBAL)) .build(); } };
@OnCreateLayout static Component onCreateLayout(ComponentContext c) { return Row.create(c) .child( Text.create(c) .textSizeSp(20) .text("This component has all borders specified to the same color + width")) .border( Border.create(c).color(YogaEdge.ALL, NiceColor.BLUE).widthDip(YogaEdge.ALL, 5).build()) .build(); } }
@Test public void testTransitionKeyMatcher() { final ComponentContext c = mComponentsRule.getContext(); final String key = "nocolusion"; final Component component = Row.create(c).child(Card.create(c).transitionKey(key).content(Column.create(c))).build(); assertThat(c, component) .has(subComponentWith(c, TestCard.matcher(c).transitionKey(key).build())); } }
@Override protected Component onCreateLayout(final ComponentContext c) { return create(c) .child(Row.create(c).child(innerComponent).widthPx(100).heightPx(100)) .build(); } };
static Component.Builder createMessageContent(ComponentContext c, String messageText) { return Row.create(c) .paddingDip(YogaEdge.ALL, 8) .marginDip(YogaEdge.ALL, 8) .background(ExpandableElementUtil.getMessageBackground(c, 0xFFEAEAEA)) .child(Text.create(c).textSizeDip(18).textColor(Color.BLACK).text(messageText)); } }
@OnCreateLayout static Component onCreateLayout(ComponentContext c, @State int state) { final boolean expanded1 = state == 1 || state == 2; final boolean expanded2 = state == 2 || state == 3; return Column.create(c) .paddingDip(YogaEdge.ALL, 8) .child(Row.create(c).marginDip(YogaEdge.TOP, 8).child(buildComment1(c, expanded1))) .child(Row.create(c).marginDip(YogaEdge.TOP, 16).child(buildComment2(c, expanded2))) .clickHandler(AnimatedBadge.onClick(c)) .build(); }
@Override protected Component onCreateLayout(final ComponentContext c) { return create(c) .child(Row.create(c).child(innerComponent).widthPx(100).heightPx(100)) .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(); } }
@Override protected Component onCreateLayout(ComponentContext c) { return Row.create(c) .child(Row.create(c).transitionKey("test")) .transitionKeyType(Transition.TransitionKeyType.GLOBAL) .child(Row.create(c).transitionKey("test2")) .transitionKeyType(Transition.TransitionKeyType.GLOBAL) .build(); }
@Override protected Component onCreateLayout(ComponentContext c) { return Row.create(c) .child(Row.create(c).transitionKey("test").transitionKeyType(Transition.TransitionKeyType.GLOBAL)) .child(Row.create(c).transitionKey("test2").transitionKeyType(Transition.TransitionKeyType.GLOBAL)) .build(); } };