當前位置: 首頁>>代碼示例>>Java>>正文


Java BaseViewHolder.getView方法代碼示例

本文整理匯總了Java中com.chad.library.adapter.base.BaseViewHolder.getView方法的典型用法代碼示例。如果您正苦於以下問題:Java BaseViewHolder.getView方法的具體用法?Java BaseViewHolder.getView怎麽用?Java BaseViewHolder.getView使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.chad.library.adapter.base.BaseViewHolder的用法示例。


在下文中一共展示了BaseViewHolder.getView方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: renderFooter

import com.chad.library.adapter.base.BaseViewHolder; //導入方法依賴的package包/類
private void renderFooter(BaseViewHolder helper, final FooterOCEntity item) {
    final int type = item.getItemType() + RecyclerViewAdapterHelper.FOOTER_TYPE_DIFFER;
    final TextView footer = helper.getView(R.id.item_footer);
    String text = String.format("我是底 title:%s flag:%s type:%s", item.getTitle(), item.getFlag(), type);
    Log.d("FooterOCEntity", "footer: " + text);
    footer.setText(text);
    footer.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (mOnFooterClickListener != null) {
                if (Constants.EXPAND.equals(item.getTitle())) {
                    mOnFooterClickListener.onFooterClick(type, false);
                    item.setTitle(Constants.FOLD);
                } else {
                    mOnFooterClickListener.onFooterClick(type, true);
                    item.setTitle(Constants.EXPAND);
                }
                footer.setText(String.format("我是底 title:%s flag:%s type:%s", item.getTitle(), item.getFlag(), type));
            }
        }
    });

}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:24,代碼來源:OpenCloseAdapter.java

示例2: convert

import com.chad.library.adapter.base.BaseViewHolder; //導入方法依賴的package包/類
@Override
protected void convert(final BaseViewHolder helper, FakeWeather.FakeForecastHourly item) {
    int width = SizeUtils.getScreenWidth(mContext) / 5;
    RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) helper.itemView.getLayoutParams();
    params.width = width;
    helper.itemView.setLayoutParams(params);
    helper.setText(R.id.tv_hourly_temp, item.getTemp() + "°");
    helper.setText(R.id.tv_hourly_time, item.getTime());
    final ImageView imageView = helper.getView(R.id.iv_hourly_weather);
    WeatherUtil.getInstance().getWeatherDict(item.getCode()).observeOn(AndroidSchedulers.mainThread()).subscribe(new SimpleSubscriber<WeatherBean>() {
        @Override
        public void onNext(WeatherBean weatherBean) {
            Glide.with(mContext).load(weatherBean.getIcon()).diskCacheStrategy(DiskCacheStrategy.ALL).into(imageView);
        }
    });
}
 
開發者ID:li-yu,項目名稱:FakeWeather,代碼行數:17,代碼來源:HourlyAdapter.java

示例3: convert

import com.chad.library.adapter.base.BaseViewHolder; //導入方法依賴的package包/類
@Override
protected void convert(BaseViewHolder helper, VideoItem item) {
	helper.setText(R.id.topic_init_title,item.title);
	helper.setText(R.id.date_text,new SimpleDateFormat("MM/dd/yyyy").format(item.date));
	ImageView topicImg=helper.getView(R.id.topic_init_img);
	Glide.with(helper.getConvertView().getContext()).load(item.img).into(topicImg);
	String[] tags = item.tags;
	for (int i = 0; i < tags.length; i++) {
		helper.setText(ids[i],tags[i]);
	}

	View main = helper.getView(R.id.video_layout);
	main.setTag(item);
	main.setOnClickListener(listener);

}
 
開發者ID:JackChan1999,項目名稱:GoogleVR,代碼行數:17,代碼來源:VrVideoAdapter.java

示例4: convert

import com.chad.library.adapter.base.BaseViewHolder; //導入方法依賴的package包/類
@Override
protected void convert(final BaseViewHolder helper, final SectionChildListBean.StoriesBean item) {

    if (item.getImages()!=null&&item.getImages().size()>0){
        GlideUtils.load(mContext,item.getImages().get(0), (ImageView) helper.getView(R.id.iv_theme_item_image));
    }
    TextView tvThemeItemTitle= helper.getView(R.id.tv_theme_item_title);
    tvThemeItemTitle.setText(item.getTitle());

    helper.itemView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (onItemClick!=null){
                onItemClick.onItemClick(item.getId(),helper.getView(R.id.iv_theme_item_image));
            }
        }
    });

}
 
開發者ID:paterWang,項目名稱:EasyReader,代碼行數:20,代碼來源:ZhihuSectionAdapter.java

示例5: showLineraLayoutGroup

import com.chad.library.adapter.base.BaseViewHolder; //導入方法依賴的package包/類
/**
 * 顯示是否線性布局時的分組信息
 *
 * @param helper
 * @param isShow 是否顯示
 * @param time   時間戳
 * @describe
 */
private void showLineraLayoutGroup(boolean isShow, BaseViewHolder helper, long time) {
    // 有分組的列,marginTop為8dp,否則,為0dp
    LinearLayout ll = helper.getView(R.id.ll_note_list_linear);
    LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) ll.getLayoutParams();
    if (isShow) {
        helper.setVisible(R.id.tv_note_list_linear_month, true);
        setLinearGroupStyle(helper, time);

        params.setMargins(SizeUtils.dp2px(0), SizeUtils.dp2px(8), SizeUtils.dp2px(0), SizeUtils.dp2px(0));
        ll.setLayoutParams(params);

    } else {
        helper.setVisible(R.id.tv_note_list_linear_month, false);
        params.setMargins(SizeUtils.dp2px(0), SizeUtils.dp2px(0), SizeUtils.dp2px(0), SizeUtils.dp2px(0));
        ll.setLayoutParams(params);
    }
}
 
開發者ID:ifadai,項目名稱:SuperNote,代碼行數:26,代碼來源:RvNoteListAdapter.java

示例6: convert

import com.chad.library.adapter.base.BaseViewHolder; //導入方法依賴的package包/類
@Override
protected void convert(BaseViewHolder helper, ListBean item) {
    switch (helper.getItemViewType()) {
        case ListItemType.ITEM_NORMAL:
            helper.setText(R.id.tv_arrow_text, item.getText());
            helper.setText(R.id.tv_arrow_value, item.getValue());
            break;

        case ListItemType.ITEM_AVATAR:
            Glide.with(mContext)
                    .load(item.getImageUrl())
                    .diskCacheStrategy(DiskCacheStrategy.ALL).centerCrop().dontAnimate()
                    .into((ImageView) helper.getView(R.id.img_arrow_avatar));

            break;
        case ListItemType.ITEM_SWITCH:
            helper.setText(R.id.tv_arrow_switch_text,item.getText());
            final SwitchCompat switchCompat = helper.getView(R.id.list_item_switch);
            switchCompat.setChecked(true);
            switchCompat.setOnCheckedChangeListener(item.getOnCheckedChangeListener());
            break;

    }
}
 
開發者ID:remerber,項目名稱:FastEc,代碼行數:25,代碼來源:ListAdapter.java

示例7: convert

import com.chad.library.adapter.base.BaseViewHolder; //導入方法依賴的package包/類
@Override
protected void convert(BaseViewHolder helper, ReplySection item) {
    ImageView img = helper.getView(R.id.iv_pic);
    AppComponent mAppComponent = ((App)img.getContext().getApplicationContext())
            .getAppComponent();
    if (item.t.getData().getUser()!=null){
        mAppComponent.imageLoader().loadImage(img.getContext(),
                ImageConfigImpl
                        .builder()
                        .transformation(new GlideCircleTransform())
                        .url(item.t.getData().getUser().getAvatar())
                        .imageView(img)
                        .build());
    }
    DateFormat df = new SimpleDateFormat("yyyy/MM/dd");
    if (item.t.getData().getUser()!=null){
        helper.setText(R.id.tv_nickname,item.t.getData().getUser().getNickname());
    }
    helper.setText(R.id.tv_comment,item.t.getData().getMessage())
            .setText(R.id.tv_good_num,item.t.getData().getLikeCount()+"")
            .setText(R.id.tv_reply_time,df.format(item.t.getData().getCreateTime()));
}
 
開發者ID:Zweihui,項目名稱:Aurora,代碼行數:23,代碼來源:ReplyAdapter.java

示例8: convert

import com.chad.library.adapter.base.BaseViewHolder; //導入方法依賴的package包/類
@Override
protected void convert(final BaseViewHolder helper, final NBAListBean.NBABean item) {
    ImageView ivAndroidPic = helper.getView(R.id.iv_android_pic);
    // 顯示gif圖片會很耗內存
    if (item.getImgsrc() != null
            && !TextUtils.isEmpty(item.getImgsrc())) {
        ivAndroidPic.setVisibility(View.VISIBLE);
        GlideUtils.loadMovieTopImg(ivAndroidPic, item.getImgsrc());
    } else {
        ivAndroidPic.setVisibility(View.GONE);
    }
    helper.setText(R.id.tv_android_des, item.getTitle());
    helper.setText(R.id.tv_android_who, item.getEname());
    helper.setText(R.id.tv_android_time, TimeUtil.getTime(item.getPtime()));
    helper.itemView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onItemClickListener.onItemClickListener(item.getDocid(), item.getImgsrc(),helper.getView(R.id.iv_android_pic));
        }
    });
}
 
開發者ID:paterWang,項目名稱:EasyReader,代碼行數:22,代碼來源:NBAAdapter.java

示例9: 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;
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:32,代碼來源:ItemClickAdapter.java

示例10: convert

import com.chad.library.adapter.base.BaseViewHolder; //導入方法依賴的package包/類
@Override
protected void convert(BaseViewHolder helper, String item) {
    helper.setText(R.id.tv_history_item, item);
    helper.setTextColor(R.id.tv_history_item, historyTextColor);
    ImageView iconImageView = helper.getView(R.id.right_icon);
    iconImageView.setImageResource(historyIcon);
}
 
開發者ID:paradoxie,項目名稱:DizzyPassword,代碼行數:8,代碼來源:SearchRecyclerViewAdapter.java

示例11: convert

import com.chad.library.adapter.base.BaseViewHolder; //導入方法依賴的package包/類
@Override
protected void convert(BaseViewHolder helper, Category item) {
    AppComponent mAppComponent = ((App)helper.getView(R.id.iv_bg).getContext().getApplicationContext())
            .getAppComponent();
    ImageView bg = helper.getView(R.id.iv_bg);
    helper.setText(R.id.tv_name,item.getName());
    mAppComponent.imageLoader().loadImage(bg.getContext(),
            ImageConfigImpl
                    .builder()
                    .url(item.getBgPicture())
                    .imageView(bg)
                    .build());
}
 
開發者ID:Zweihui,項目名稱:Aurora,代碼行數:14,代碼來源:CategoryAdapter.java

示例12: convert

import com.chad.library.adapter.base.BaseViewHolder; //導入方法依賴的package包/類
@Override
protected void convert(BaseViewHolder baseViewHolder, ItemBean itemBean) {
    ZKImageView imageView = baseViewHolder.getView(R.id.pic_img);
    int width = ScreenUtils.getScreenWidth() / 2;
    ViewGroup.LayoutParams params = imageView.getLayoutParams();
    params.width = width;
    if(randomHeight.containsKey(itemBean.getId())){
        params.height = randomHeight.get(itemBean.getId());
    }
    imageView.setLayoutParams(params);
    ImageLoader.loadImage(imageView, itemBean.getPicTinyUrl());
}
 
開發者ID:ZhuoKeTeam,項目名稱:JueDiQiuSheng,代碼行數:13,代碼來源:RecycleAdapter.java

示例13: renderHeader

import com.chad.library.adapter.base.BaseViewHolder; //導入方法依賴的package包/類
private void renderHeader(BaseViewHolder helper, CommonHeaderEntity item) {
    final int type = item.getItemType() + RecyclerViewAdapterHelper.HEADER_TYPE_DIFFER;
    helper.setText(R.id.header_title, item.getTitle());
    TextView optionsView = helper.getView(R.id.header_options);
    final String options = item.getOptions();
    optionsView.setText(options);
    optionsView.setTextColor(HomeAdapterHelper.getColor(type));
    optionsView.setOnClickListener(v -> {
        if (mOnHeaderClickListener != null) {
            mOnHeaderClickListener.onHeaderClick(type, options);
        }
    });
}
 
開發者ID:crazysunj,項目名稱:CrazyDaily,代碼行數:14,代碼來源:HomeAdapter.java

示例14: convert

import com.chad.library.adapter.base.BaseViewHolder; //導入方法依賴的package包/類
@Override
protected void convert(BaseViewHolder holder, Note note) {
    RelativeLayout gridItem = holder.getView(R.id.grid_item);
    ViewGroup.LayoutParams layoutParams = gridItem.getLayoutParams();
    layoutParams.width = ScreenUtil.getScreenDispaly(mContext)[0] / 2;
    layoutParams.height = ScreenUtil.getScreenDispaly(mContext)[0] / 2;
    gridItem.setLayoutParams(layoutParams);

    holder.addOnClickListener(R.id.cardview).addOnLongClickListener(R.id.cardview);
    TextView content = holder.getView(R.id.content);
    TextView time = holder.getView(R.id.time);
    ImageView thumbnail = holder.getView(R.id.thumbnail_iv);

    content.setText(note.getContent());
    if (StringUtils.isNotEmpty(note.getContent())) {
        if (note.getContent().length() > 20) {
            //TODO  字數多了換成兩行顯示,字體縮小。
            //this.content.setText(note.getContent());
        }
    }
    time.setText(mContext.getString(R.string.note_log_text, mContext.getString(R.string.create),
            TimeUtils.getTime(note.getCreateTime())));

    Logger.INSTANCE.e("" + note.getImagePath());
    if (StringUtils.isEmpty(note.getImagePath()) || "[]".equals(note.getImagePath())) {
        thumbnail.setVisibility(View.INVISIBLE);
        content.setTextColor(mContext.getResources().getColor(R.color.gray));
        time.setTextColor(mContext.getResources().getColor(R.color.gray));
    } else {
        thumbnail.setVisibility(View.VISIBLE);
        content.setTextColor(mContext.getResources().getColor(R.color.white));
        time.setTextColor(mContext.getResources().getColor(R.color.white));
        ImageUtils.INSTANCE.showThumbnail(mContext, note.getImagePath(), thumbnail);
    }
}
 
開發者ID:lpy19930103,項目名稱:MinimalismJotter,代碼行數:36,代碼來源:GridNoteAdapter.java

示例15: convert

import com.chad.library.adapter.base.BaseViewHolder; //導入方法依賴的package包/類
@Override
protected void convert(BaseViewHolder baseViewHolder, VideoBean item) {
    baseViewHolder.setText(R.id.tv_video_source, item.getTopicName());
    baseViewHolder.setText(R.id.tv_video_playcount, item.getPlayCount() + "次播放");
    ImageLoader.getInstance().withRound(mContext, item.getTopicImg(), (ImageView) baseViewHolder.getView(R.id.img_video_logo));

    JCVideoPlayerStandard standard = baseViewHolder.getView(R.id.videoplayer);
    standard.setUp(item.getMp4_url(), JCVideoPlayer.SCREEN_LAYOUT_LIST, item.getTitle());
    ImageLoader.getInstance().with(mContext, item.getCover(), standard.thumbImageView);
}
 
開發者ID:xiarunhao123,項目名稱:PureNews,代碼行數:11,代碼來源:VideoAdapter.java


注:本文中的com.chad.library.adapter.base.BaseViewHolder.getView方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。