Java 类com.facebook.litho.widget.LinearLayoutInfo 实例源码

项目:litho-picasso    文件:Demos.java   
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());
}
项目:redux-observable    文件:HomeActivity.java   
@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));
}
项目:litho-glide    文件:GlideArtist.java   
@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();
}
项目:litho-glide    文件:DemoListComponentSpec.java   
@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();
}
项目:litho-glide    文件:Demos.java   
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());
}
项目:litho-picasso    文件:PicassoArtist.java   
@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();
}
项目:litho-picasso    文件:DemoListComponentSpec.java   
@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();
}
项目:redux-observable    文件:HomeActivity.java   
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()
    );
}