com.facebook.litho.widget.RecyclerBinder Java Examples
The following examples show how to use
com.facebook.litho.widget.RecyclerBinder.
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: ExamplesActivityComponentSpec.java From litho with Apache License 2.0 | 6 votes |
@OnCreateLayout static Component onCreateLayout(ComponentContext c) { final RecyclerBinder recyclerBinder = new RecyclerBinder.Builder() .layoutInfo(new LinearLayoutInfo(c, OrientationHelper.VERTICAL, false)) .build(c); Populator.with(recyclerBinder, c) .addRow("Layout Specs", ExamplesActivityComponent.onClickLayoutSpecs(c)) .addRow("Text Widget", ExamplesActivityComponent.onClickTextWidget(c)) .addRow("Containers", ExamplesActivityComponent.onClickContainers(c)) .addRow("Props", ExamplesActivityComponent.onClickProps(c)) .addRow("Layout Props", ExamplesActivityComponent.onClickLayoutProps(c)) .addRow("Click Events", ExamplesActivityComponent.onClickClickEvents(c)) .addRow("State", ExamplesActivityComponent.onClickState(c)) .addRow("Recycler Binder", ExamplesActivityComponent.onClickRecyclerBinder(c)); return Recycler.create(c).binder(recyclerBinder).build(); }
Example #2
Source File: LithographyRootComponentSpec.java From litho-glide with MIT License | 5 votes |
@OnCreateLayout static Component onCreateLayout(ComponentContext c, @Prop final RecyclerBinder recyclerBinder) { return Recycler.create(c) .binder(recyclerBinder) .flexShrink(0) .paddingDip(YogaEdge.TOP, 8) .testKey(MAIN_SCREEN) .build(); }
Example #3
Source File: Demos.java From litho-picasso with MIT License | 5 votes |
public static void addAllToBinder(RecyclerBinder recyclerBinder, ComponentContext c) { for (String name : demoModels.keySet()) { ComponentRenderInfo.Builder componentInfoBuilder = ComponentRenderInfo.create(); componentInfoBuilder.component( DemoListItemComponent.create(c) .name(name) .build()); recyclerBinder.insertItemAt(recyclerBinder.getItemCount(), componentInfoBuilder.build()); } }
Example #4
Source File: Demos.java From litho-picasso with MIT License | 5 votes |
public static void initialize(Context context) { final ComponentContext c = new ComponentContext(context); final RecyclerBinder glideRecyclerBinder = new RecyclerBinder.Builder().layoutInfo( new LinearLayoutInfo(c, OrientationHelper.VERTICAL, false)).build(c); DataModel.populateBinderWithSampleDataForPicasso(glideRecyclerBinder, c); demoModels = new LinkedHashMap<>(); demoModels.put( "Lithography - Picasso", LithographyRootComponent.create(c) .recyclerBinder(glideRecyclerBinder) .build()); demoModels.put("Playground", PlaygroundComponent.create(c).build()); }
Example #5
Source File: DemoListComponentSpec.java From litho-picasso with MIT License | 5 votes |
@OnCreateLayout static Component onCreateLayout(ComponentContext c) { final RecyclerBinder recyclerBinder = new RecyclerBinder.Builder().layoutInfo( new LinearLayoutInfo(c, OrientationHelper.VERTICAL, false)).build(c); Demos.addAllToBinder(recyclerBinder, c); return Recycler.create(c) .binder(recyclerBinder) .flexShrink(0) .testKey(MAIN_SCREEN) .build(); }
Example #6
Source File: LithographyRootComponentSpec.java From litho-picasso with MIT License | 5 votes |
@OnCreateLayout static Component onCreateLayout( ComponentContext c, @Prop final RecyclerBinder recyclerBinder) { return Recycler.create(c) .binder(recyclerBinder) .flexShrink(0) .paddingDip(YogaEdge.TOP, 8) .testKey(MAIN_SCREEN) .build(); }
Example #7
Source File: PicassoArtist.java From litho-picasso with MIT License | 5 votes |
@Override public Component createComponent(ComponentContext c) { final RecyclerBinder imageRecyclerBinder = new RecyclerBinder.Builder().layoutInfo( new LinearLayoutInfo(c, OrientationHelper.HORIZONTAL, false)).build(c); for (String image : images) { ComponentRenderInfo.Builder imageComponentInfoBuilder = ComponentRenderInfo.create(); imageComponentInfoBuilder.component( PicassoSingleImageComponent.create(c).image(image).fit(true).build()); imageRecyclerBinder.insertItemAt(imageRecyclerBinder.getItemCount(), imageComponentInfoBuilder.build()); } return FeedItemCard.create(c).artist(this).binder(imageRecyclerBinder).build(); }
Example #8
Source File: DataModel.java From litho-picasso with MIT License | 5 votes |
public static void populateBinderWithSampleDataForPicasso(RecyclerBinder recyclerBinder, ComponentContext c) { final Datum[] dataModels = SampleData(); for (Datum datum : dataModels) { ComponentRenderInfo.Builder componentInfoBuilder = ComponentRenderInfo.create(); componentInfoBuilder.component(datum.createComponent(c)).isSticky(datum instanceof Decade); recyclerBinder.insertItemAt(recyclerBinder.getItemCount(), componentInfoBuilder.build()); } }
Example #9
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(); }
Example #10
Source File: FeedItemComponentSpec.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) .child(Column.create(c) .child(artist.getImages().length == 1 ? getImageComponent(c, artist) : getRecyclerComponent(c, binder)) .child(TitleComponent.create(c).title(artist.getName())) .child(ActionsComponent.create(c))) .child(FooterComponent.create(c).text(artist.getBiography())) .build(); }
Example #11
Source File: Demos.java From litho-glide with MIT License | 5 votes |
public static void addAllToBinder(RecyclerBinder recyclerBinder, ComponentContext c) { for (String name : demoModels.keySet()) { ComponentRenderInfo.Builder componentInfoBuilder = ComponentRenderInfo.create(); componentInfoBuilder.component(DemoListItemComponent.create(c).name(name).build()); recyclerBinder.insertItemAt(recyclerBinder.getItemCount(), componentInfoBuilder.build()); } }
Example #12
Source File: Demos.java From litho-glide with MIT License | 5 votes |
public static void initialize(Context context) { final ComponentContext c = new ComponentContext(context); final RecyclerBinder glideRecyclerBinder = new RecyclerBinder.Builder().layoutInfo( new LinearLayoutInfo(c, OrientationHelper.VERTICAL, false)).build(c); DataModel.populateBinderWithSampleDataForGlide(glideRecyclerBinder, c); demoModels = new LinkedHashMap<>(); demoModels.put("Lithography - Glide", LithographyRootComponent.create(c).recyclerBinder(glideRecyclerBinder).build()); demoModels.put("Playground", PlaygroundComponent.create(c).build()); }
Example #13
Source File: DemoListComponentSpec.java From litho-glide with MIT License | 5 votes |
@OnCreateLayout static Component onCreateLayout(ComponentContext c) { final RecyclerBinder recyclerBinder = new RecyclerBinder.Builder().layoutInfo( new LinearLayoutInfo(c, OrientationHelper.VERTICAL, false)).build(c); Demos.addAllToBinder(recyclerBinder, c); return Recycler.create(c) .binder(recyclerBinder) .flexShrink(0) .testKey(MAIN_SCREEN) .build(); }
Example #14
Source File: LithoStartupLoggerTest.java From litho with Apache License 2.0 | 5 votes |
@Before public void setup() { mTestLithoStartupLogger = new TestLithoStartupLogger(); mComponentContext = new ComponentContext(getApplicationContext()); mRecyclerBinder = new RecyclerBinder.Builder() .startupLogger(mTestLithoStartupLogger) .build(mComponentContext); }
Example #15
Source File: GlideArtist.java From litho-glide with MIT License | 5 votes |
@Override public Component createComponent(ComponentContext c) { final RecyclerBinder imageRecyclerBinder = new RecyclerBinder.Builder().layoutInfo( new LinearLayoutInfo(c, OrientationHelper.HORIZONTAL, false)).build(c); for (String image : images) { ComponentRenderInfo.Builder imageComponentInfoBuilder = ComponentRenderInfo.create(); imageComponentInfoBuilder.component( GlideSingleImageComponent.create(c).image(image).aspectRatio(2).build()); imageRecyclerBinder.insertItemAt(imageRecyclerBinder.getItemCount(), imageComponentInfoBuilder.build()); } return FeedItemCard.create(c).artist(this).binder(imageRecyclerBinder).build(); }
Example #16
Source File: DataModel.java From litho-glide with MIT License | 5 votes |
public static void populateBinderWithSampleDataForGlide(RecyclerBinder recyclerBinder, ComponentContext c) { final Datum[] dataModels = SampleDataForGlide(); for (Datum datum : dataModels) { ComponentRenderInfo.Builder componentInfoBuilder = ComponentRenderInfo.create(); componentInfoBuilder.component(datum.createComponent(c)).isSticky(datum instanceof Decade); recyclerBinder.insertItemAt(recyclerBinder.getItemCount(), componentInfoBuilder.build()); } }
Example #17
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 #18
Source File: FeedItemComponentSpec.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) .child(Column.create(c) .child(artist.getImages().length == 1 ? getImageComponent(c, artist) : getRecyclerComponent(c, binder)) .child(TitleComponent.create(c).title(artist.getName())) .child(ActionsComponent.create(c))) .child(FooterComponent.create(c).text(artist.getBiography())) .build(); }
Example #19
Source File: LearningRecyclerBinderComponentSpec.java From litho with Apache License 2.0 | 5 votes |
@OnCreateLayout static Component onCreateLayout(ComponentContext c) { final RecyclerBinder recyclerBinder = new RecyclerBinder.Builder() .layoutInfo(new LinearLayoutInfo(c, OrientationHelper.VERTICAL, false)) .build(c); for (int i = 0; i < 32; i++) { recyclerBinder.insertItemAt( i, LearningPropsComponent.create(c).text1("Item: " + i).text2("Item: " + i).build()); } return Recycler.create(c).binder(recyclerBinder).build(); }
Example #20
Source File: FeedItemComponentSpec.java From litho-picasso with MIT License | 4 votes |
private static Component.Builder getRecyclerComponent(ComponentContext c, RecyclerBinder binder) { return Recycler.create(c).binder(binder).flexShrink(0).aspectRatio(2); }
Example #21
Source File: FeedItemComponentSpec.java From litho-glide with MIT License | 4 votes |
private static Component getRecyclerComponent(ComponentContext c, RecyclerBinder binder) { return Recycler.create(c).binder(binder).flexShrink(0).aspectRatio(2).build(); }
Example #22
Source File: ExamplesActivityComponentSpec.java From litho with Apache License 2.0 | 4 votes |
private static Populator with(RecyclerBinder recyclerBinder, ComponentContext c) { return new Populator(recyclerBinder, c); }
Example #23
Source File: ExamplesActivityComponentSpec.java From litho with Apache License 2.0 | 4 votes |
private Populator(RecyclerBinder recyclerBinder, ComponentContext c) { this.recyclerBinder = recyclerBinder; this.c = c; }
Example #24
Source File: SectionBinderTarget.java From litho with Apache License 2.0 | 4 votes |
public SectionBinderTarget(RecyclerBinder recyclerBinder, boolean useBackgroundChangeSets) { mRecyclerBinder = recyclerBinder; mUseBackgroundChangeSets = useBackgroundChangeSets; }
Example #25
Source File: SectionBinderTarget.java From litho with Apache License 2.0 | 4 votes |
public SectionBinderTarget(RecyclerBinder recyclerBinder) { this(recyclerBinder, SectionsConfiguration.useBackgroundChangeSets); }