@Override protected Object createViewHolder(View itemView, DialpadMenuItem item) { ItemViewHolder viewHolder = new ItemViewHolder(); viewHolder.mMenuIcon = (ImageView) itemView.findViewById(R.id.img_dp_menu_icon); viewHolder.mMenuTitle = (TextView) itemView.findViewById(R.id.txt_dp_menu_title); return viewHolder; }
@Override protected void bindData(ItemViewHolder holder, int position) { CommentsModel.Comment comment = mDatas.get(position); ImageLoader.loadImage(comment.getAvatar(), holder.getImageView(R.id.iv_avatar)); holder.getTextView(R.id.tv_create_time).setText(comment.getCreateTime()); holder.getTextView(R.id.tv_username).setText(comment.getUserName()); holder.getTextView(R.id.tv_rank).setText(comment.getRank()); ((RichTextView) holder.getTextView(R.id.tv_content)).setRichText(comment.getContent()); }
@Override public void onBindViewHolder(final RecyclerView.ViewHolder holder, int position) { int type = holder.getItemViewType(); if (type == LIST_HEADER) { return; } Reply reply = replyList.get(position - 1); ItemViewHolder viewHolder = (ItemViewHolder) holder; viewHolder.reply = reply; viewHolder.replyView.parse(reply); viewHolder.replyView.setContentAttributes(); }
@Override public void onBindViewHolder(ItemViewHolder holder, int position) { holder.position = position; wordInfo = itemData.wordInfoList.get(position); holder.winfo = new WordInfo(wordInfo.engword, wordInfo.korword, wordInfo.bmkstate); bmkDAO.checkState(holder.winfo); holder.btn_star.setChecked(holder.winfo.bmkstate); holder.tv_engword.setText(holder.winfo.engword); holder.tv_korword.setText(holder.winfo.korword); // Log.e("@@@onBindView wordInfo", wordInfo.engword); // Log.e("@@@onBindView wordInfo.bmkstate", wordInfo.bmkstate + ""); // Log.e("@@@onBindView winfo.bmkstate", holder.winfo.bmkstate + ""); }
@Override protected BaseViewHolder onCreateItemViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()) .inflate(R.layout.adapter_add_channel_list_item, parent, false); return ItemViewHolder.newInstance(view, _clickListener); }
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { if (holder instanceof ItemViewHolder) { JobBean job = mData.get(position); if (job == null) { return; } ImageLoadUtils.display(mContext, ((ItemViewHolder) holder).mCompanyLogo, job.getLogo()); ((ItemViewHolder) holder).mCompanyName.setText(job.getCompanyName()); ((ItemViewHolder) holder).mJobName.setText(job.getName()); if (job.getCompanyLocation().length() >= 7) { ((ItemViewHolder) holder).mLocation.setText(job.getCompanyLocation().substring(0, 6)); } ((ItemViewHolder) holder).mSalary.setText(job.getSalary()); ((ItemViewHolder) holder).mTime.setText(job.getTime()); } }
private View getFastOrderMenu(int position, View convertView) { ItemViewHolder viewHolder; Dish dishDetail = mDishes.getDish(position); if (convertView == null) { viewHolder = new ItemViewHolder(); convertView = LayoutInflater.from(MenuActivity.this).inflate(R.layout.item_fastorder, null); viewHolder.findViews(convertView, ItemViewHolder.ITEM_FASTORDER_VIEW); convertView.setTag(viewHolder); } else { viewHolder = (ItemViewHolder) convertView.getTag(); } viewHolder.setData(dishDetail); viewHolder.setOnClickListener(); viewHolder.setTag(position); return convertView; }
@Override public void onBindViewHolder(final ItemViewHolder viewHolder, int position) { int itemViewType = viewHolder.getItemViewType(); if (itemViewType == IS_NORMAL) { imageViewList.clear(); mMyPagerAdapter = new MyPagerAdapter( EntyList, layoutUtil, ApplicationData.context, imageViewList, viewHolder.mTextView2, viewHolder.mtotal_count, viewHolder.mindex_tv, options_base); viewHolder.mAutoScrollViewPager.setAdapter(mMyPagerAdapter); viewHolder.mTextView2.setText(EntyList.get(0).title); viewHolder.mAutoScrollViewPager.setOnPageChangeListener( new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled( int position, float positionOffset, int positionOffsetPixels) {} @Override public void onPageSelected(int position) { if (null != viewHolder.mindex_tv) { viewHolder.mindex_tv.setText((position + 1) + ""); viewHolder.mTextView2.setText(EntyList.get(position).title); } } @Override public void onPageScrollStateChanged(int state) {} }); } else { ImageLoader.getInstance() .displayImage(resultsEntityList.get(position).thumbnail, viewHolder.mIv, options_base); viewHolder.mTextView.setText(resultsEntityList.get(position).title); layoutUtil.drawViewFramLayout(viewHolder.rl, 1f, 0f, 0f, 0f); viewHolder.mIv.setTag( resultsEntityList.get(position).commentsUrl + "," + resultsEntityList.get(position).title); viewHolder.mIv.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { String countUri = v.getTag().toString(); Intent mIntent = new Intent(ApplicationData.context, CountActivity.class); mIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mIntent.putExtra(ConstanceData.COUNT_URI, countUri); ApplicationData.context.startActivity(mIntent); } }); } }
@Override public void onBindViewHolder(BaseViewHolder holder, int position) { final UserDataHolder dataHolder = mDatas.get(position); final int itemViewType = dataHolder.getType(); switch (itemViewType) { case 0: HeaderViewHolder userViewHolder = (HeaderViewHolder) holder; userViewHolder.bind(mContext, dataHolder, position); break; case 1: ItemViewHolder itemViewHolder = (ItemViewHolder) holder; itemViewHolder.bind(mContext, dataHolder, position); break; case 2: DividerViewHolder dividerViewHolder = (DividerViewHolder) holder; dividerViewHolder.bind(mContext, dataHolder, position); break; default: break; } }
@Override public View getView(int position, View convertView, ViewGroup parent) { TerminalItem item = list.get(position); View view = null; if (convertView != null) { view = convertView; } else { view = inflater.inflate(R.layout.terminal_list_item, parent, false); } ItemViewHolder holder = (ItemViewHolder) view.getTag(); if (holder == null) { holder = new ItemViewHolder(); holder.tv_terminalname = (TextView) view.findViewById(R.id.tv_terminalname); holder.tv_terminaladdress = (TextView) view.findViewById(R.id.tv_terminaladdress); holder.tv_terminalman = (TextView) view.findViewById(R.id.tv_terminalman); holder.tv_terminalphone = (TextView) view.findViewById(R.id.tv_terminalphone); view.setTag(holder); } if (item != null) { holder.tv_terminalname.setText(item.getTerminalname()); holder.tv_terminalname.setOnTouchListener(new TextViewDrawableOnTouchListener()); holder.tv_terminalname.setTag(item.getTerminalid() + "," + position); holder.tv_terminaladdress.setText(item.getTerminaladdress()); if (TextUtils.isEmpty(item.getTerminalman())) { holder.tv_terminalman.setText("无联系人"); } else { holder.tv_terminalman.setText(item.getTerminalman()); } if (TextUtils.isEmpty(item.getTerminalphone())) { holder.tv_terminalphone.setText("无联系电话"); } else { holder.tv_terminalphone.setText(item.getTerminalphone()); } } return view; }
@Override public void onBindViewHolder(ViewHolder holder, int position) { if (holder instanceof ItemViewHolder && listObject.get(position) instanceof ItemEntity) { ((ItemViewHolder) holder) .lblDescription.setText(((ItemEntity) listObject.get(position)).getDescription()); } if (holder instanceof LoadingViewHolder) { ((LoadingViewHolder) holder).pbLoading.setIndeterminate(true); } if (holder instanceof ErrorViewHolder && listObject.get(position) instanceof ErrorEntity) { ((ErrorViewHolder) holder) .lblError.setText(((ErrorEntity) listObject.get(position)).getDescription()); } }
@Override public View getView(int position, View convertView, ViewGroup parent) { ShowInfo showInfo = this.getItem(position); ItemViewHolder holder = null; if (convertView == null) { LayoutInflater inflater = LayoutInflater.from(getContext()); convertView = inflater.inflate(R.layout.show_item, null, false); holder = new ItemViewHolder(); holder.tvShowName = (TextView) convertView.findViewById(R.id.tvShowName); holder.tvEpisodeTitle = (TextView) convertView.findViewById(R.id.tvEpisodeTitle); holder.tvEpisodeDate = (TextView) convertView.findViewById(R.id.tvEpisodeDate); holder.tvEpisodeTime = (TextView) convertView.findViewById(R.id.tvEpisodeTime); holder.tvShowImage = (SmartImageView) convertView.findViewById(R.id.tvShowImage); convertView.setTag(holder); } else { holder = (ItemViewHolder) convertView.getTag(); holder.tvShowImage.setImageResource(android.R.color.transparent); } holder.tvShowName.setText(showInfo.getName()); holder.tvEpisodeTitle.setText(showInfo.getNextEpisodeTitle()); holder.tvEpisodeDate.setText(showInfo.getNextEpisodeDateAsLabel()); String showImage = showInfo.getImage(); if (showImage == null || showImage.length() == 0) { holder.tvShowImage.setImageResource(R.drawable.ic_tv); } else { holder.tvShowImage.setImageUrl(showImage); } Schedule schedule = showInfo.getSchedule(); if (schedule == Schedule.TBD) { holder.tvEpisodeTime.setText("TBA"); } else if (schedule == Schedule.TODAY) { holder.tvEpisodeTime.setText(showInfo.getNextEpisodeTimeAsLabel() + " TODAY"); } else if (schedule == Schedule.TOMORROW) { holder.tvEpisodeTime.setText(showInfo.getNextEpisodeTimeAsLabel() + " TOMORROW"); } else { holder.tvEpisodeTime.setText(showInfo.getNextEpisodeDaysLeft() + " DAYS"); } return convertView; }
@Override public View getChildView( int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { View view = convertView; ItemViewHolder holder; if (view == null) { view = inflater.inflate(R.layout.list_item_student, null, false); holder = new ItemViewHolder(); holder.editStudentEmail = (ImageButton) view.findViewById(R.id.editStudentEmail); holder.studentEmail = (TextView) view.findViewById(R.id.studentEmail); // holder.parentEmail = (TextView) view.findViewById(R.id.parentEmail); // holder.parentEmailList = (ListView) view.findViewById(R.id.parentEmailList); holder.studentPanel = (LinearLayout) view.findViewById(R.id.studentPanel); holder.parentEmailLayout = (LinearLayout) view.findViewById(R.id.parentEmailLayout); view.setTag(holder); } else { holder = (ItemViewHolder) view.getTag(); } Student student = studentList.get(groupPosition); holder.student = student; holder.position = childPosition; holder.studentEmail.setText(student.getEmail()); for (String s : student.getParentEmailList()) { TextView textView = new TextView(context); textView.setText(s); textView.setTextColor(context.getResources().getColor(R.color.dark_blue)); textView.setPadding(5, 5, 5, 5); holder.parentEmailLayout.addView(textView); } // holder.parentEmailList.setAdapter(new ParentAdapter(context, // student.getParentEmailList())); holder.editStudentEmail.setTag(student); holder.editStudentEmail.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Student student1 = (Student) v.getTag(); Intent updateStudent = new Intent(context, TeacherInviteStudent.class); updateStudent.putExtra( TeacherInviteStudent.EXTRA_CLASS_CODE, teacherClass.getClassCode()); updateStudent.putExtra(TeacherInviteStudent.EXTRA_CLASS_ID, teacherClass.getId()); updateStudent.putExtra(TeacherInviteStudent.EXTRA_STUDENT_ID, student1.getUserId()); updateStudent.putExtra(TeacherInviteStudent.EXTRA_STUDENT_EMAIL, student1.getEmail()); updateStudent.putStringArrayListExtra( TeacherInviteStudent.EXTRA_PARENT_EMAIL, student1.getParentEmailList()); updateStudent.putExtra(TeacherInviteStudent.EXTRA_IS_FIRST_TIME, false); context.startActivityForResult( updateStudent, TeacherShowClassStudentsActivity.REQUEST_UPDATE_STUDENT); } }); return view; }
@Override public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) { if (viewHolder instanceof ItemViewHolder) { ((ItemViewHolder) viewHolder).textView.setText(mItems.get(position - 1)); } }
@Override public void onBindViewHolder(ViewHolder viewHolder, int pos) { if (viewHolder instanceof AbsRecyclerAdapter.ItemViewHolder) { ((ItemViewHolder) viewHolder).bind(pos); } }