Java Code Examples for com.facebook.litho.widget.RecyclerBinder#insertItemAt()
The following examples show how to use
com.facebook.litho.widget.RecyclerBinder#insertItemAt() .
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: 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 2
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 3
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 4
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 5
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 6
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 7
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()); } }