本文整理汇总了Java中com.facebook.litho.widget.LinearLayoutInfo类的典型用法代码示例。如果您正苦于以下问题:Java LinearLayoutInfo类的具体用法?Java LinearLayoutInfo怎么用?Java LinearLayoutInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LinearLayoutInfo类属于com.facebook.litho.widget包,在下文中一共展示了LinearLayoutInfo类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import com.facebook.litho.widget.LinearLayoutInfo; //导入依赖的package包/类
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());
}
示例2: onCreate
import com.facebook.litho.widget.LinearLayoutInfo; //导入依赖的package包/类
@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));
}
示例3: createComponent
import com.facebook.litho.widget.LinearLayoutInfo; //导入依赖的package包/类
@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
import com.facebook.litho.widget.LinearLayoutInfo; //导入依赖的package包/类
@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();
}
示例5: initialize
import com.facebook.litho.widget.LinearLayoutInfo; //导入依赖的package包/类
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: createComponent
import com.facebook.litho.widget.LinearLayoutInfo; //导入依赖的package包/类
@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();
}
示例7: onCreateLayout
import com.facebook.litho.widget.LinearLayoutInfo; //导入依赖的package包/类
@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();
}
示例8: renderContent
import com.facebook.litho.widget.LinearLayoutInfo; //导入依赖的package包/类
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()
);
}