com.facebook.litho.widget.Recycler Java Examples

The following examples show how to use com.facebook.litho.widget.Recycler. 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 vote down vote up
@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: LearningRecyclerBinderComponentSpec.java    From litho with Apache License 2.0 5 votes vote down vote up
@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 #3
Source File: LithographyRootComponentSpec.java    From litho-glide with MIT License 5 votes vote down vote up
@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 #4
Source File: DemoListComponentSpec.java    From litho-glide with MIT License 5 votes vote down vote up
@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 #5
Source File: LithographyRootComponentSpec.java    From litho-picasso with MIT License 5 votes vote down vote up
@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 #6
Source File: DemoListComponentSpec.java    From litho-picasso with MIT License 5 votes vote down vote up
@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 #7
Source File: FeedItemComponentSpec.java    From litho-glide with MIT License 4 votes vote down vote up
private static Component getRecyclerComponent(ComponentContext c,
    RecyclerBinder binder) {
  return Recycler.create(c).binder(binder).flexShrink(0).aspectRatio(2).build();
}
 
Example #8
Source File: FeedItemComponentSpec.java    From litho-picasso with MIT License 4 votes vote down vote up
private static Component.Builder getRecyclerComponent(ComponentContext c,
    RecyclerBinder binder) {
  return Recycler.create(c).binder(binder).flexShrink(0).aspectRatio(2);
}