Java 类com.facebook.litho.Row 实例源码

项目:litho-glide    文件:ActionsComponentSpec.java   
@OnCreateLayout
static ComponentLayout onCreateLayout(
    ComponentContext c) {
  return Row.create(c)
      .backgroundColor(0xDDFFFFFF)
      .positionType(YogaPositionType.ABSOLUTE)
      .positionDip(YogaEdge.RIGHT, 4)
      .positionDip(YogaEdge.TOP, 4)
      .paddingDip(YogaEdge.ALL, 2)
      .child(FavouriteButton.create(c))
      .build();
}
项目:litho-glide    文件:DecadeSeparatorSpec.java   
@OnCreateLayout
static ComponentLayout onCreateLayout(
    ComponentContext c,
    @Prop final Decade decade) {
  return Row.create(c)
      .alignItems(YogaAlign.CENTER)
      .paddingDip(YogaEdge.ALL, 16)
      .child(
          Row.create(c)
              .heightPx(1)
              .backgroundColor(0xFFAAAAAA)
              .flex(1))
      .child(
          Text.create(c)
              .text(String.valueOf(decade.year))
              .textSizeDip(14)
              .textColor(0xFFAAAAAA)
              .withLayout()
              .marginDip(YogaEdge.HORIZONTAL, 10)
              .flex(0))
      .child(
          Row.create(c)
              .heightPx(1)
              .backgroundColor(0xFFAAAAAA)
              .flex(1))
      .backgroundColor(0xFFFAFAFA)
      .build();
}
项目:litho-glide    文件:FavouriteButtonSpec.java   
@OnCreateLayout
static ComponentLayout onCreateLayout(
    ComponentContext c,
    @State boolean favourited) {
  return Row.create(c)
      .backgroundRes(favourited ? star_on : star_off)
      .widthDip(32)
      .heightDip(32)
      .clickHandler(FavouriteButton.onClick(c))
      .build();
}
项目:litho-picasso    文件:ActionsComponentSpec.java   
@OnCreateLayout
static ComponentLayout onCreateLayout(
    ComponentContext c) {
  return Row.create(c)
      .backgroundColor(0xDDFFFFFF)
      .positionType(YogaPositionType.ABSOLUTE)
      .positionDip(YogaEdge.RIGHT, 4)
      .positionDip(YogaEdge.TOP, 4)
      .paddingDip(YogaEdge.ALL, 2)
      .child(FavouriteButton.create(c))
      .build();
}
项目:litho-picasso    文件:DecadeSeparatorSpec.java   
@OnCreateLayout
static ComponentLayout onCreateLayout(
    ComponentContext c,
    @Prop final Decade decade) {
  return Row.create(c)
      .alignItems(YogaAlign.CENTER)
      .paddingDip(YogaEdge.ALL, 16)
      .child(
          Row.create(c)
              .heightPx(1)
              .backgroundColor(0xFFAAAAAA)
              .flex(1))
      .child(
          Text.create(c)
              .text(String.valueOf(decade.year))
              .textSizeDip(14)
              .textColor(0xFFAAAAAA)
              .withLayout()
              .marginDip(YogaEdge.HORIZONTAL, 10)
              .flex(0))
      .child(
          Row.create(c)
              .heightPx(1)
              .backgroundColor(0xFFAAAAAA)
              .flex(1))
      .backgroundColor(0xFFFAFAFA)
      .build();
}
项目:litho-picasso    文件:FavouriteButtonSpec.java   
@OnCreateLayout
static ComponentLayout onCreateLayout(
    ComponentContext c,
    @State boolean favourited) {
  return Row.create(c)
      .backgroundRes(favourited ? star_on : star_off)
      .widthDip(32)
      .heightDip(32)
      .clickHandler(FavouriteButton.onClick(c))
      .build();
}
项目:redux-observable    文件:TripleBannersComponentSpec.java   
@OnCreateLayout
static ComponentLayout onCreateLayout(ComponentContext c, @Prop TripleBannerSection payload) {
    final DraweeController controllerBanner1 = Fresco.newDraweeControllerBuilder()
            .setUri(payload.banners().get(0).imageUrl())
            .build();
    final DraweeController controllerBanner2 = Fresco.newDraweeControllerBuilder()
            .setUri(payload.banners().get(1).imageUrl())
            .build();

    final DraweeController controllerBanner3 = Fresco.newDraweeControllerBuilder()
            .setUri(payload.banners().get(2).imageUrl())
            .build();
    return Column.create(c)
            .child(
                    Text.create(c)
                            .text(payload.title())
                            .glyphWarming(true)
                            .textSizeSp(16)
                            .withLayout()
                            .paddingDip(TOP, 8)
                            .paddingDip(BOTTOM, 4)
                            .heightDip(44)
            )
            .paddingDip(LEFT, 8)
            .paddingDip(RIGHT, 8)
            .child(
                    Row.create(c)
                            .heightPx((int) (DisplayUtil.getScreenWidth(c) / payload.banners().get(0).ratio()))
                            .child(
                                    FrescoImage.create(c)
                                            .controller(controllerBanner1)
                                            .actualImageScaleType(ScalingUtils
                                                    .ScaleType.FIT_XY)
                                            .withLayout()
                                            .flex(1)
                                            .widthPercent(50)

                            )
                            .clickHandler(TripleBannersComponent.onClickFirstBanner(c))
                            .child(
                                    Column.create(c)
                                            .child(
                                                    FrescoImage.create(c)
                                                            .controller(controllerBanner2)
                                                            .actualImageScaleType(ScalingUtils.ScaleType.CENTER_CROP)
                                                            .withLayout()
                                                            .heightPercent(50)
                                                            .flex(1)
                                            )
                                            .clickHandler(TripleBannersComponent.onClickSecondBanner(c))
                                            .child(
                                                    FrescoImage.create(c)
                                                            .controller(controllerBanner3)
                                                            .actualImageScaleType(ScalingUtils.ScaleType.CENTER_CROP)
                                                            .withLayout()
                                                            .flex(1)
                                                            .heightPercent(50)
                                            )
                                            .widthPercent(100)
                                            .clickHandler(TripleBannersComponent.onClickThirdBanner(c)))
            )
            .build();
}