本文整理汇总了Java中com.chad.library.adapter.base.BaseViewHolder.addOnClickListener方法的典型用法代码示例。如果您正苦于以下问题:Java BaseViewHolder.addOnClickListener方法的具体用法?Java BaseViewHolder.addOnClickListener怎么用?Java BaseViewHolder.addOnClickListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.chad.library.adapter.base.BaseViewHolder
的用法示例。
在下文中一共展示了BaseViewHolder.addOnClickListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, Status item) {
helper.addOnClickListener(R.id.tweetText);
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;
}
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());
}
示例2: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, AppsListModel.ItemsBean item) {
if (item != null) {
helper.setText(R.id.tv_time, DateUtils.millisecondToDate(item.getUpdated_at() * 1000L, DateUtils.YMD_PATTERN3));
((FrescoImageView) helper.getView(R.id.fiv_icon)).setImageURL(item.getIcon_url());
helper.setText(R.id.tv_app_name, mContext.getString(R.string.name, item.getName()));
helper.setText(R.id.tv_platform, mContext.getString(R.string.platform, item.getType()));
helper.setText(R.id.tv_packagename, mContext.getString(R.string.packagename, item.getBundle_id()));
AppsListModel.ItemsBean.MasterReleaseBean master_release = item.getMaster_release();
if (master_release != null) {
helper.setText(R.id.tv_version, mContext.getString(R.string.version, master_release.getVersion()));
helper.setText(R.id.tv_build_number, mContext.getString(R.string.build, master_release.getBuild()));
}
//tips
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
helper.getView(R.id.tv_app_name).setTooltipText(item.getName());
helper.getView(R.id.tv_packagename).setTooltipText(item.getBundle_id());
}
helper.addOnClickListener(R.id.btn_qrcode);
}
}
示例3: setGridLayout
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
/**
* 设置网格布局
*
* @describe
*/
private void setGridLayout(BaseViewHolder helper, Note item) {
helper.addOnClickListener(R.id.cv_note_list_grid);
helper.addOnLongClickListener(R.id.cv_note_list_grid);
helper.setVisible(R.id.ll_note_list_linear, false);
helper.setVisible(R.id.cv_note_list_grid, true);
TextView tvContent=helper.getView(R.id.tv_note_list_grid_content);
if(isPrivacyAndRecycle(item))
helper.setText(R.id.tv_note_list_grid_content,Utils.getContext().getResources().getString(R.string.note_privacy_and_recycle));
else
parseTextContent(tvContent,item.getNoteContent());
// 设置便签的时间显示
setNoteTime(helper, item.getModifiedTime());
// 设置多选按钮
setCheckBox(helper);
}
示例4: setLinearLayout
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
/**
* 设置线性布局
*
* @describe
*/
private void setLinearLayout(BaseViewHolder helper, Note item) {
helper.addOnClickListener(R.id.ll_note_list_line);
helper.addOnLongClickListener(R.id.ll_note_list_line);
// 显示竖排布局,隐藏网格布局
helper.setVisible(R.id.cv_note_list_grid, false);
helper.setVisible(R.id.ll_note_list_linear, true);
TextView tvContent=helper.getView(R.id.tv_note_list_linear_content);
if(isPrivacyAndRecycle(item))
helper.setText(R.id.tv_note_list_linear_content,Utils.getContext().getResources().getString(R.string.note_privacy_and_recycle));
else
parseTextContent(tvContent,item.getNoteContent());
// 设置便签的时间显示
setNoteTime(helper, item.getModifiedTime());
// 设置便签的分组显示
setLinearLayoutGroup(helper, item.getCreatedTime());
// 设置多选按钮
setCheckBox(helper);
}
示例5: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(final BaseViewHolder helper, final ClickEntity item) {
switch (helper.getItemViewType()) {
case ClickEntity.CLICK_ITEM_VIEW:
helper.addOnClickListener(R.id.btn);
break;
case ClickEntity.CLICK_ITEM_CHILD_VIEW:
helper.addOnClickListener(R.id.iv_num_reduce).addOnClickListener(R.id.iv_num_add)
.addOnLongClickListener(R.id.iv_num_reduce).addOnLongClickListener(R.id.iv_num_add);
// set img data
break;
case ClickEntity.LONG_CLICK_ITEM_VIEW:
helper.addOnLongClickListener(R.id.btn);
break;
case ClickEntity.LONG_CLICK_ITEM_CHILD_VIEW:
helper.addOnLongClickListener(R.id.iv_num_reduce).addOnLongClickListener(R.id.iv_num_add)
.addOnClickListener(R.id.iv_num_reduce).addOnClickListener(R.id.iv_num_add);
break;
case ClickEntity.NEST_CLICK_ITEM_CHILD_VIEW:
helper.setNestView(R.id.item_click); // u can set nestview id
final RecyclerView recyclerView = helper.getView(R.id.nest_list);
recyclerView.setLayoutManager(new LinearLayoutManager(helper.itemView.getContext(), LinearLayoutManager.VERTICAL, false));
recyclerView.setHasFixedSize(true);
nestAdapter = new NestAdapter();
nestAdapter.setOnItemClickListener(this);
nestAdapter.setOnItemChildClickListener(this);
recyclerView.setAdapter(nestAdapter);
break;
}
}
示例6: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder holper, NewsDataBean.ResultBean.DataBean item) {
holper.setText(R.id.tv_news_detail_title,item.getTitle());
holper.setText(R.id.tv_news_detail_author_name, item.getAuthor_name());
holper.setText(R.id.tv_news_detail_date, item.getDate());
holper.addOnClickListener(R.id.ll_news_detail);
Glide.with(mContext).
load(item.getThumbnail_pic_s()).
placeholder(R.mipmap.ic_error).
error(R.mipmap.ic_error).
crossFade().
centerCrop().
into((ImageView) holper.getView(R.id.iv_news_detail_pic));
}
示例7: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, MyFriend.ApplicantInfo item) {
CircleImageView profileImg = helper.getView(R.id.apply_profile);
Utility.loadFriendProfileImg(mContext.getApplicationContext(), item.getApplicant(), profileImg);
helper.setText(R.id.apply_username, item.getApplicant());
helper.setText(R.id.apply_time, item.getDate());
helper.addOnClickListener(R.id.refuse_apply_button);
helper.addOnClickListener(R.id.agree_apply_button);
}
示例8: convertHead
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convertHead(BaseViewHolder helper, ReplySection item) {
helper.setText(R.id.tv_name,item.t.getData().getText());
helper.getView(R.id.iv_arrow).setVisibility(View.GONE);
helper.addOnClickListener(R.id.iv_arrow_right);
if (helper.getLayoutPosition() == 0){
helper.getView(R.id.iv_arrow_right).setVisibility(View.VISIBLE);
helper.getView(R.id.view).setVisibility(View.VISIBLE);
}else {
helper.getView(R.id.view).setVisibility(View.GONE);
helper.getView(R.id.iv_arrow_right).setVisibility(View.GONE);
}
}
示例9: convertHead
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convertHead(BaseViewHolder helper, final MySection item) {
helper.setText(R.id.header, item.header);
helper.setVisible(R.id.more, item.isMore());
helper.addOnClickListener(R.id.more);
}
示例10: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder baseViewHolder, String s) {
baseViewHolder.addOnClickListener(R.id.iv_close);
}
示例11: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, TodayOfHistoryBean.ResultBean item) {
helper.setText(R.id.tv_today_title, item.getTitle());
helper.setText(R.id.tv_today_date, item.getDate());
helper.addOnClickListener(R.id.ll_today_detail);
}
示例12: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, GankIoDayItemBean item) {
helper.setText(R.id.tv_type_item_title, item.getType());
helper.setText(R.id.tv_item_title, item.getDesc());
switch (item.getType()) {
case "福利":
helper.setImageResource(R.id.iv_type_item_title, R.drawable
.ic_vector_title_welfare);
Glide.with(mContext).load(item.getUrl()).crossFade().into((ImageView) helper
.getView(R.id.iv_item_title));
break;
case "Android":
helper.setImageResource(R.id.iv_type_item_title, R.drawable
.ic_vector_title_android);
helper.setImageResource(R.id.iv_item_title, mResAndroid[mAndroidIndex % 6]);
break;
case "iOS":
helper.setImageResource(R.id.iv_type_item_title, R.drawable.ic_vector_title_ios);
helper.setImageResource(R.id.iv_item_title, mResIOS[mIOSIndex % 3]);
break;
case "前端":
helper.setImageResource(R.id.iv_type_item_title, R.drawable.ic_vector_title_front);
helper.setImageResource(R.id.iv_item_title, R.mipmap.gank_io_day_item_web);
break;
case "休息视频":
helper.setImageResource(R.id.iv_type_item_title, R.drawable.ic_vector_title_video);
helper.setImageResource(R.id.iv_item_title, R.mipmap.gank_io_day_item_video);
break;
case "瞎推荐":
helper.setImageResource(R.id.iv_type_item_title, R.drawable.ic_vector_item_tuijian);
break;
case "拓展资源":
helper.setImageResource(R.id.iv_type_item_title, R.drawable.ic_vector_item_tuozhan);
break;
case "App":
helper.setImageResource(R.id.iv_type_item_title, R.drawable.ic_vector_item_app);
break;
}
switch (helper.getItemViewType()) {
case GankIoDayItemBean.GANK_IO_DAY_ITEM_DAY_NORMAL:
helper.addOnClickListener(R.id.ll_more);
break;
case GankIoDayItemBean.GANK_IO_DAY_ITEM_DAY_REFESH:
helper.addOnClickListener(R.id.ll_more).addOnClickListener(R.id.ll_refesh);
break;
default:
break;
}
//GankIo 返回数据中,很多没有images,这里不用GankIo的图,直接写死
// if(item.getImages() == null)
// return;
//
// Glide.with(mContext).load(item.getImages().get(0)).crossFade().into((ImageView)
// helper.getView(R.id.iv_item_title));
}
示例13: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, MultipleItem item) {
switch (helper.getItemViewType()) {
case MultipleItem.TYPE_COUNT:
helper.setText(R.id.my_favorites, item.mString1).addOnClickListener(R.id.my_favorites);
helper.setText(R.id.my_bands, item.mString2).addOnClickListener(R.id.my_bands);
break;
case MultipleItem.TYPE_ORDER_HEADER:
helper.addOnClickListener(R.id.ll_my_order);
break;
case MultipleItem.TYPE_ORDER:
helper.setImageDrawable(R.id.my_order_image, ContextCompat.getDrawable(mContext, R.drawable.ic_launcher));
helper.setText(R.id.my_order_name, item.mString1);
if (item.isShow) {
helper.getView(R.id.my_order_count).setVisibility(View.VISIBLE);
if (item.count > 0) {
if (item.count < 99) {
helper.setText(R.id.my_order_count, String.valueOf(item.count));
} else {
helper.setText(R.id.my_order_count, String.valueOf("99+"));
}
} else {
helper.getView(R.id.my_order_count).setVisibility(View.GONE);
}
} else {
helper.getView(R.id.my_order_count).setVisibility(View.GONE);
}
break;
case MultipleItem.TYPE_BALANCE:
helper.setText(R.id.my_balance_text, item.mString1);
helper.addOnClickListener(R.id.my_balance_btn);
break;
case MultipleItem.TYPE_TOOLS_HEADER:
//helper.setText(R.id.tv_item_name, item.mString1);
break;
case MultipleItem.TYPE_TOOLS:
helper.setImageDrawable(R.id.my_tools_image, ContextCompat.getDrawable(mContext, R.drawable.ic_launcher));
helper.setText(R.id.my_tools_text, item.mString1);
if (item.isShow) {
helper.getView(R.id.my_tools_count).setVisibility(View.VISIBLE);
if (item.count > 0) {
if (item.count < 99) {
helper.setText(R.id.my_tools_count, String.valueOf(item.count));
} else {
helper.setText(R.id.my_tools_count, String.valueOf("99+"));
}
} else {
helper.getView(R.id.my_tools_count).setVisibility(View.GONE);
}
} else {
helper.getView(R.id.my_tools_count).setVisibility(View.GONE);
}
break;
}
}
示例14: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, VideoDownLoadInfo item) {
AppComponent mAppComponent = ((App)helper.getView(R.id.iv_bg).getContext().getApplicationContext())
.getAppComponent();
ImageView imgMian = helper.getView(R.id.iv_bg);
Context context = imgMian.getContext();
helper.setText(R.id.tv_title,item.getVideo().getTitle());
if (item.getVideo().getAuthor()!=null){
helper.setText(R.id.tv_author,item.getVideo().getAuthor().getName());
}
helper.setText(R.id.tv_size, StringUtils.getPrintSize(item.getContentLength() == null ?0:item.getContentLength(),true));
helper.addOnClickListener(R.id.iv_more);
helper.addOnClickListener(R.id.ll_detail);
helper.addOnClickListener(R.id.ll_progress);
helper.addOnClickListener(R.id.ctl_layout);
if (!type.contains("正在")){
helper.getView(R.id.ll_detail).setVisibility(View.VISIBLE);
}else {
helper.getView(R.id.ll_detail).setVisibility(View.GONE);
}
if (item.getFinish()){
helper.getView(R.id.ll_progress).setVisibility(View.GONE);
helper.getView(R.id.tv_size).setVisibility(View.VISIBLE);
}else {
helper.getView(R.id.tv_size).setVisibility(View.GONE);
// if (downPosition == helper.getLayoutPosition()){
// helper.getView(R.id.ll_progress).setVisibility(View.VISIBLE);
// helper.getView(R.id.sb_progress).setVisibility(View.VISIBLE);
// ((SeekBar)helper.getView(R.id.sb_progress)).setProgress(item.getPercent());
// String size = StringUtils.getPrintSize(item.getCurrentBytes() == null ?0:item.getContentLength(),false) + "/" + StringUtils.getPrintSize(item.getContentLength() == null ?0:item.getContentLength(),true);
// helper.setText(R.id.tv_pause,size);
// }else {
if (item.isPending()){
helper.setText(R.id.tv_pause,"正在连接中...");
((ProgressBar)helper.getView(R.id.sb_progress)).setIndeterminate(true);
helper.getView(R.id.ll_progress).setVisibility(View.VISIBLE);
helper.getView(R.id.sb_progress).setVisibility(View.VISIBLE);
}else {
if (item.isLineUp()){
helper.setText(R.id.tv_pause,"排队中");
}else {
helper.setText(R.id.tv_pause,"已暂停");
}
helper.getView(R.id.ll_progress).setVisibility(View.VISIBLE);
helper.getView(R.id.sb_progress).setVisibility(View.GONE);
}
// }
}
mAppComponent.imageLoader().loadImage(context,
ImageConfigImpl
.builder()
.url(item.getVideo().getCover().getFeed())
.imageView(imgMian)
.build());
}
示例15: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(final BaseViewHolder helper, final MeiZi.ResultsBean item) {
ImageUtils.showPic(MeiZiFragment.this, item.getUrl(), (ImageView) helper.getView(R.id.meizi_pic));
helper.addOnClickListener(R.id.meizi_pic);
}