Java源码示例:com.facebook.litho.widget.LinearLayoutInfo

示例1
@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();
}
 
示例2
@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();
}
 
示例3
@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();
}
 
示例4
@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();
}
 
示例5
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());
}
 
示例6
@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();
}
 
示例7
@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();
}
 
示例8
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());
}
 
示例9
@Override
public LinearLayoutInfo createLinearLayoutInfo(
    Context c, int orientation, boolean reverseLayout) {
  return new LinearLayoutInfo(c, orientation, reverseLayout);
}
 
示例10
/**
 * @return a new {@link LinearLayoutInfo} that will be used to compute the layouts of the children
 *     of the {@link ListRecyclerConfiguration}.
 */
LinearLayoutInfo createLinearLayoutInfo(Context context, int orientation, boolean reverseLayout);