public static void initialize(Context context) { final ComponentContext c = new ComponentContext(context); final RecyclerBinder glideRecyclerBinder = new RecyclerBinder( c, 4.0f, new LinearLayoutInfo(c, OrientationHelper.VERTICAL, false)); DataModel.populateBinderWithSampleDataForGlide(glideRecyclerBinder, c); demoModels = new LinkedHashMap<>(); demoModels.put( "Lithography - Picasso", LithographyRootComponent.create(c) .recyclerBinder(glideRecyclerBinder) .build()); demoModels.put("Playground", PlaygroundComponent.create(c).build()); }
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_repos); bindViews(this); componentContext = new ComponentContext(this); recyclerBinder = new RecyclerBinder( componentContext, 4.0f, new LinearLayoutInfo(this, OrientationHelper.VERTICAL, false)); sRefresh.setOnRefreshListener(() -> store.dispatch(HomeAction.REFRESH)); }
@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(); }
@OnCreateLayout static ComponentLayout 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) .buildWithLayout(); }
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()); }
@Override public Component createComponent(ComponentContext c) { final RecyclerBinder imageRecyclerBinder = new RecyclerBinder(c, 4.0f, new LinearLayoutInfo(c, OrientationHelper.HORIZONTAL, false)); for (String image : images) { ComponentInfo.Builder imageComponentInfoBuilder = ComponentInfo.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(); }
@OnCreateLayout static ComponentLayout onCreateLayout(ComponentContext c) { final RecyclerBinder recyclerBinder = new RecyclerBinder( c, 4.0f, new LinearLayoutInfo(c, OrientationHelper.VERTICAL, false)); Demos.addAllToBinder(recyclerBinder, c); return Recycler.create(c) .binder(recyclerBinder) .withLayout().flexShrink(0) .testKey(MAIN_SCREEN) .build(); }
private void renderContent(List<HomeSection> sections) { sRefresh.setRefreshing(false); ComponentInfo.Builder componentInfoBuilder; for (HomeSection section : sections) { componentInfoBuilder = ComponentInfo.create(); if (section instanceof SingleBannerSection) { componentInfoBuilder .component( SingleBannerComponent .create(componentContext) .payload((SingleBannerSection) section) .key(((SingleBannerSection) section).title()) .build() ); } else if (section instanceof TripleBannerSection) { componentInfoBuilder .component( TripleBannersComponent.create(componentContext) .payload((TripleBannerSection) section) .key(((TripleBannerSection) section).title()) .build() ); } else if (section instanceof ProductSlideSection) { final RecyclerBinder productSlideBinder = new RecyclerBinder(componentContext, 4.0f, new LinearLayoutInfo(this, OrientationHelper.HORIZONTAL, false)); for (Product product : ((ProductSlideSection) section).products()) { componentInfoBuilder = ComponentInfo.create(); componentInfoBuilder .component( ProductComponent.create(componentContext) .product(product) .key(product.id()) .build() ); productSlideBinder.insertItemAt(productSlideBinder.getItemCount(), componentInfoBuilder.build()); } componentInfoBuilder = ComponentInfo.create(); componentInfoBuilder .component( ProductSlideComponent.create(componentContext) .title(((ProductSlideSection) section).title()) .recyclerBinder(productSlideBinder) .key(((ProductSlideSection) section).title()) .build() ); } recyclerBinder.insertItemAt(recyclerBinder.getItemCount(), componentInfoBuilder.build()); } ltView.setComponent( HomeListComponent .create(componentContext) .binder(recyclerBinder) .build() ); }