com.facebook.litho.widget.Card Java Examples
The following examples show how to use
com.facebook.litho.widget.Card.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ListRowComponentSpec.java From litho with Apache License 2.0 | 6 votes |
@OnCreateLayout static Component onCreateLayout(ComponentContext c, @Prop ListRow row) { return Column.create(c) .paddingDip(YogaEdge.VERTICAL, 8) .paddingDip(YogaEdge.HORIZONTAL, 32) .child( Card.create(c) .content( Column.create(c) .marginDip(YogaEdge.ALL, 32) .child(TitleComponent.create(c).title(row.title)) .child(PossiblyCrashingSubTitleComponent.create(c).subtitle(row.subtitle)) .build()) .build()) .build(); }
Example #2
Source File: FeedItemCardSpecTest.java From litho with Apache License 2.0 | 6 votes |
@Test public void testShallowSubComponents() { final ComponentContext c = mComponentsRule.getContext(); assertThat(c, mComponent) .extractingSubComponentAt(0) .extractingSubComponents(c) .hasSize(1) .has( new Condition<InspectableComponent>() { @Override public boolean matches(InspectableComponent value) { return value.getComponentClass() == Card.class; } }, atIndex(0)); }
Example #3
Source File: SubComponentDeepExtractorTest.java From litho with Apache License 2.0 | 6 votes |
@Before public void setUp() { assumeThat( "These tests can only be run in debug mode.", ComponentsConfiguration.IS_INTERNAL_BUILD, is(true)); mComponent = new InlineLayoutSpec() { @Override protected Component onCreateLayout(ComponentContext c) { return Column.create(c) .child(Card.create(c).content(Text.create(c).text("test"))) .build(); } }; }
Example #4
Source File: FeedItemCardSpec.java From litho with Apache License 2.0 | 5 votes |
@OnCreateLayout static Component onCreateLayout(ComponentContext c, @Prop final Artist artist) { return Column.create(c) .paddingDip(VERTICAL, 8) .paddingDip(HORIZONTAL, 16) .child(Card.create(c).content(FeedItemComponent.create(c).artist(artist))) .build(); }
Example #5
Source File: CommonPropMatcherTest.java From litho with Apache License 2.0 | 5 votes |
@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())); }
Example #6
Source File: FeedItemCardSpec.java From litho-glide with MIT License | 5 votes |
@OnCreateLayout static Component onCreateLayout(ComponentContext c, @Prop final ArtistDatum artist, @Prop final RecyclerBinder binder) { return Column.create(c) .flexShrink(0) .alignContent(YogaAlign.FLEX_START) .paddingDip(VERTICAL, 8) .paddingDip(HORIZONTAL, 16) .child(Card.create(c) .content(FeedItemComponent.create(c).artist(artist).binder(binder))) .build(); }
Example #7
Source File: FeedItemCardSpec.java From litho-picasso with MIT License | 5 votes |
@OnCreateLayout static Component onCreateLayout(ComponentContext c, @Prop final ArtistDatum artist, @Prop final RecyclerBinder binder) { return Column.create(c) .flexShrink(0) .alignContent(YogaAlign.FLEX_START) .paddingDip(VERTICAL, 8) .paddingDip(HORIZONTAL, 16) .child(Card.create(c) .content(FeedItemComponent.create(c).artist(artist).binder(binder))) .build(); }