Java Code Examples for com.chad.library.adapter.base.viewholder.BaseViewHolder#setText()

The following examples show how to use com.chad.library.adapter.base.viewholder.BaseViewHolder#setText() . 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: EmptyViewAdapter.java    From BaseRecyclerViewAdapterHelper with MIT License 6 votes vote down vote up
@Override
protected void convert(@NotNull BaseViewHolder helper, @NotNull Status item) {
    switch (helper.getLayoutPosition() % 3) {
        case 0:
            helper.setImageResource(R.id.img, R.mipmap.animation_img1);
            break;
        case 1:
            helper.setImageResource(R.id.img, R.mipmap.animation_img2);
            break;
        case 2:
            helper.setImageResource(R.id.img, R.mipmap.animation_img3);
            break;
        default:
            break;
    }
    helper.setText(R.id.tweetName, "Hoteis in Rio de Janeiro");
    helper.setText(R.id.tweetText, "O ever youthful,O ever weeping");
}
 
Example 2
Source File: LoadMoreAdapter.java    From BaseRecyclerViewAdapterHelper with MIT License 6 votes vote down vote up
@Override
protected void convert(@NotNull BaseViewHolder helper, @Nullable Status item) {
    switch (helper.getLayoutPosition() % 3) {
        case 0:
            helper.setImageResource(R.id.img, R.mipmap.animation_img1);
            break;
        case 1:
            helper.setImageResource(R.id.img, R.mipmap.animation_img2);
            break;
        case 2:
            helper.setImageResource(R.id.img, R.mipmap.animation_img3);
            break;
        default:
            break;
    }
    helper.setText(R.id.tweetName, "Hoteis in Rio de Janeiro");
    String msg = "\"He was one of Australia's most of distinguished artistes, renowned for his portraits\"";
    ((TextView) helper.getView(R.id.tweetText)).setText(SpannableStringUtils.getBuilder(msg).append("landscapes and nedes").setClickSpan(clickableSpan).create());
    ((TextView) helper.getView(R.id.tweetText)).setMovementMethod(LinkMovementMethod.getInstance());
}
 
Example 3
Source File: MultipleItemQuickAdapter.java    From BaseRecyclerViewAdapterHelper with MIT License 6 votes vote down vote up
@Override
protected void convert(@NonNull BaseViewHolder helper, QuickMultipleEntity item) {
    switch (helper.getItemViewType()) {
        case QuickMultipleEntity.TEXT:
            helper.setText(R.id.tv, item.getContent());
            break;
        case QuickMultipleEntity.IMG_TEXT:
            switch (helper.getLayoutPosition() % 2) {
                case 0:
                    helper.setImageResource(R.id.iv, R.mipmap.animation_img1);
                    break;
                case 1:
                    helper.setImageResource(R.id.iv, R.mipmap.animation_img2);
                    break;
                default:
                    break;
            }
            break;
        default:
            break;
    }
}
 
Example 4
Source File: NestAdapter.java    From BaseRecyclerViewAdapterHelper with MIT License 6 votes vote down vote up
@Override
protected void convert(@NonNull BaseViewHolder helper, Status item) {
    switch (helper.getLayoutPosition() % 3) {
        case 0:
            helper.setImageResource(R.id.img, R.mipmap.animation_img1);
            break;
        case 1:
            helper.setImageResource(R.id.img, R.mipmap.animation_img2);
            break;
        case 2:
            helper.setImageResource(R.id.img, R.mipmap.animation_img3);
            break;
        default:
            break;
    }
    helper.setText(R.id.tweetName, "Hoteis in Rio de Janeiro");
    String msg = "\"He was one of Australia's most of distinguished artistes, renowned for his portraits\"";
    ((TextView) helper.getView(R.id.tweetText)).setText(SpannableStringUtils.getBuilder(msg).append("landscapes and nedes").setClickSpan(clickableSpan).create());
    ((TextView) helper.getView(R.id.tweetText)).setMovementMethod(LinkMovementMethod.getInstance());
}
 
Example 5
Source File: DragAndSwipeAdapter.java    From BaseRecyclerViewAdapterHelper with MIT License 6 votes vote down vote up
@Override
protected void convert(@NotNull BaseViewHolder helper, @NotNull String item) {
    switch (helper.getLayoutPosition() % 3) {
        case 0:
            helper.setImageResource(R.id.iv_head, R.mipmap.head_img0);
            break;
        case 1:
            helper.setImageResource(R.id.iv_head, R.mipmap.head_img1);
            break;
        case 2:
            helper.setImageResource(R.id.iv_head, R.mipmap.head_img2);
            break;
        default:
            break;
    }
    helper.setText(R.id.tv, item);
}
 
Example 6
Source File: ArticleAdapter.java    From DevUtils with Apache License 2.0 6 votes vote down vote up
@Override
protected void convert(BaseViewHolder helper, ArticleBean.DataBean.DatasBean item) {
    // 当前索引
    int position = helper.getLayoutPosition();
    // 标题
    helper.setText(R.id.vid_aa_title_tv, item.title);
    // 时间
    helper.setText(R.id.vid_aa_time_tv, DevCommonUtils.toCheckValue(item.niceShareDate, item.niceDate));
    // 随机图片
    GlideUtils.with().displayImage("https://picsum.photos/2" + DateUtils.convertTime(position),
            helper.getView(R.id.vid_aa_pic_igview), ProjectUtils.getRoundOptions());
    // 绑定点击事件
    ListenerUtils.setOnClicks(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String link = item.link;
            if (!TextUtils.isEmpty(link)) {
                Uri uri = Uri.parse(link);
                Intent intent = new Intent(Intent.ACTION_VIEW, uri);
                AppUtils.startActivity(intent);
            }
        }
    }, helper.getView(R.id.vid_aa_cardview));
}
 
Example 7
Source File: AnimationAdapter.java    From BaseRecyclerViewAdapterHelper with MIT License 6 votes vote down vote up
@Override
protected void convert(@NonNull BaseViewHolder helper, Status item) {
    switch (helper.getLayoutPosition() % 3) {
        case 0:
            helper.setImageResource(R.id.img, R.mipmap.animation_img1);
            break;
        case 1:
            helper.setImageResource(R.id.img, R.mipmap.animation_img2);
            break;
        case 2:
            helper.setImageResource(R.id.img, R.mipmap.animation_img3);
            break;
        default:
            break;
    }
    helper.setText(R.id.tweetName, "Hoteis in Rio de Janeiro");
    String msg = "\"He was one of Australia's most of distinguished artistes, renowned for his portraits\"";
    ((TextView) helper.getView(R.id.tweetText)).setText(SpannableStringUtils.getBuilder(msg).append("landscapes and nedes").setClickSpan(clickableSpan).create());
    ((TextView) helper.getView(R.id.tweetText)).setMovementMethod(ClickableMovementMethod.getInstance());
    ((TextView) helper.getView(R.id.tweetText)).setFocusable(false);
    ((TextView) helper.getView(R.id.tweetText)).setClickable(false);
    ((TextView) helper.getView(R.id.tweetText)).setLongClickable(false);
}
 
Example 8
Source File: ItemSlideAdapter.java    From DevUtils with Apache License 2.0 6 votes vote down vote up
@Override
protected void convert(BaseViewHolder helper, CommodityEvaluateBean item) {
    // 当前索引
    int position = helper.getLayoutPosition();
    // 判断是否显示边距
    ViewUtils.setVisibility(position == 0, helper.getView(R.id.vid_ams_line));

    // ============
    // = 商品信息 =
    // ============

    // 商品名
    helper.setText(R.id.vid_ams_name_tv, item.commodityName);
    // 商品价格
    helper.setText(R.id.vid_ams_price_tv,
            "¥" + BigDecimalUtils.round(item.commodityPrice, 2));
    // 商品图片
    GlideUtils.with().displayImage(item.commodityPicture, helper.getView(R.id.vid_ams_pic_igview), ProjectUtils.getRoundOptions());
}
 
Example 9
Source File: CommentAdapter.java    From Pix-EzViewer with MIT License 5 votes vote down vote up
@Override
protected void convert(BaseViewHolder helper, IllustCommentsResponse.CommentsBean item) {
    helper.setText(R.id.commentdate, item.getDate());
    if (item.getParent_comment().getUser() != null)
        helper.setText(R.id.commentusername, item.getUser().getName() + " to " + item.getParent_comment().getUser().getName());
    else helper.setText(R.id.commentusername, item.getUser().getName());
    helper.setText(R.id.commentdetail, item.getComment());
    if (!item.getUser().getProfile_image_urls().getMedium().contentEquals("https://source.pixiv.net/common/images/no_profile.png")) {
        GlideApp.with(context).load(item.getUser().getProfile_image_urls().getMedium()).placeholder(R.mipmap.ic_noimage_foreground).circleCrop().into((ImageView) helper.getView(R.id.commentuserimage));
    } else
        GlideApp.with(context).load(R.mipmap.ic_noimage_round).into((ImageView) helper.getView(R.id.commentuserimage));
}
 
Example 10
Source File: SectionQuickAdapter.java    From BaseRecyclerViewAdapterHelper with MIT License 5 votes vote down vote up
@Override
protected void convert(@NotNull BaseViewHolder helper, @NotNull MySection item) {
    Video video = (Video) item.getObject();
    switch (helper.getLayoutPosition() % 2) {
        case 0:
            helper.setImageResource(R.id.iv, R.mipmap.m_img1);
            break;
        case 1:
            helper.setImageResource(R.id.iv, R.mipmap.m_img2);
            break;
        default:
            break;
    }
    helper.setText(R.id.tv, video.getName());
}
 
Example 11
Source File: SecondProvider.java    From BaseRecyclerViewAdapterHelper with MIT License 5 votes vote down vote up
@Override
public void convert(@NotNull BaseViewHolder helper, @NotNull BaseNode data) {
    SecondNode entity = (SecondNode) data;
    helper.setText(R.id.title, entity.getTitle());

    if (entity.isExpanded()) {
        helper.setImageResource(R.id.iv, R.mipmap.arrow_b);
    } else {
        helper.setImageResource(R.id.iv, R.mipmap.arrow_r);
    }
}
 
Example 12
Source File: ScheduleOtherAdapter.java    From AcgClub with MIT License 5 votes vote down vote up
@Override
protected void convert(BaseViewHolder helper, ScheduleOtherPage.ScheduleOtherItem item) {
  helper.setText(R.id.tv_schedule_other_title, item.getTitle());
  mImageLoader.loadImage(getContext(),
      GlideImageConfig
          .builder()
          .url(item.getImgUrl())
          .imageView((ImageView) helper.getView(R.id.img_schedule_other))
          .build()
  );
}
 
Example 13
Source File: ScheduleTimeAdapter.java    From AcgClub with MIT License 5 votes vote down vote up
@Override
protected void convertHeader(@NotNull BaseViewHolder helper,
    @NotNull ScheduleTimeItem item) {
  //标题
  helper.setText(R.id.schedule_time_title, item.header);
  //标题图标
  ((TextView) helper.getView(R.id.schedule_time_title)).setCompoundDrawablesWithIntrinsicBounds(
      ContextCompat.getDrawable(getContext(),
          SystemConstant.SCHEDULE_WEEK_LIST_TITLE_DRAWABLE[item.headerIndex]), null, null, null);
}
 
Example 14
Source File: PixiviSionAdapter.java    From Pix-EzViewer with MIT License 5 votes vote down vote up
@Override
protected void convert(BaseViewHolder helper, SpotlightResponse.SpotlightArticlesBean item) {
    helper.setText(R.id.textView__pixivision_title, item.getTitle());
    ImageView imageView = helper.getView(R.id.imageView_pixivision);

    GlideApp.with(helper.itemView).load(item.getThumbnail()).transition(withCrossFade()).into(imageView);

}
 
Example 15
Source File: BinderUseActivity.java    From BaseRecyclerViewAdapterHelper with MIT License 4 votes vote down vote up
@Override
public void convert(@NotNull BaseViewHolder holder, ContentEntity data) {
    holder.setText(R.id.tv, data.getContent());
}
 
Example 16
Source File: TextItemProvider.java    From BaseRecyclerViewAdapterHelper with MIT License 4 votes vote down vote up
@Override
public void convert(@NotNull BaseViewHolder helper, @Nullable ProviderMultiEntity data) {
    helper.setText(R.id.tv, "CymChad content : " + helper.getAdapterPosition());
}
 
Example 17
Source File: SectionQuickAdapter.java    From BaseRecyclerViewAdapterHelper with MIT License 4 votes vote down vote up
@Override
protected void convertHeader(@NotNull BaseViewHolder helper, @NotNull MySection item) {
    if (item.getObject() instanceof String) {
        helper.setText(R.id.header, (String) item.getObject());
    }
}
 
Example 18
Source File: RootFooterNodeProvider.java    From BaseRecyclerViewAdapterHelper with MIT License 4 votes vote down vote up
@Override
public void convert(@NotNull BaseViewHolder helper, @Nullable BaseNode data) {
    RootFooterNode entity = (RootFooterNode) data;
    helper.setText(R.id.footerTv, entity.getTitle());
}
 
Example 19
Source File: ThirdProvider.java    From BaseRecyclerViewAdapterHelper with MIT License 4 votes vote down vote up
@Override
public void convert(@NotNull BaseViewHolder helper, @NotNull BaseNode data) {
    ThirdNode entity = (ThirdNode) data;
    helper.setText(R.id.title, entity.getTitle());
}
 
Example 20
Source File: RootNodeProvider.java    From BaseRecyclerViewAdapterHelper with MIT License 4 votes vote down vote up
@Override
public void convert(@NotNull BaseViewHolder helper, @Nullable BaseNode data) {
    RootNode entity = (RootNode) data;
    helper.setText(R.id.header, entity.getTitle());
}