@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; View view = convertView; if (view == null) { view = LayoutInflater.from(mContext).inflate(R.layout.adapter_nodelist, parent, false); viewHolder = new ViewHolder(); viewHolder.tvDate = (TextView) view.findViewById(R.id.note_date_text); viewHolder.tvTitle = (TextView) view.findViewById(R.id.note_title_text); viewHolder.tvContent = (TextView) view.findViewById(R.id.note_content_text); view.setTag(viewHolder); } else { viewHolder = (ViewHolder) view.getTag(); } Note note = noteList.get(position); viewHolder.tvTitle.setText(note.getTitle()); viewHolder.tvContent.setText(note.getContent()); viewHolder.tvDate.setText(note.getDateUpdated()); return view; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { convertView = View.inflate(mActivity, R.layout.list_item_news, null); holder = new ViewHolder(); holder.ivIcon = (ImageView) convertView.findViewById(R.id.iv_icon); holder.tvTitle = (TextView) convertView.findViewById(R.id.tv_title); holder.tvDate = (TextView) convertView.findViewById(R.id.tv_date); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } News news = getItem(position); holder.tvTitle.setText(news.title); holder.tvDate.setText(news.pubdate); mBitmapUtils.display(holder.ivIcon, news.listimage); String ids = SharePreferenceUtils.getString(mActivity, PREF_NEWS_READ, ""); // 如果再已读列表中 if (ids.contains(getItem(position).id)) { holder.tvTitle.setTextColor(Color.GRAY); } else { holder.tvTitle.setTextColor(Color.BLACK); } return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder vh; if (convertView == null) { convertView = LayoutInflater.from(mContext).inflate(R.layout.item_daily, null); vh = new ViewHolder(); vh.ivPic = (ImageView) convertView.findViewById(R.id.ivPic); vh.tvDate = (TextView) convertView.findViewById(R.id.tvDate); vh.tvTemp = (TextView) convertView.findViewById(R.id.tvTemp); vh.tvDescription = (TextView) convertView.findViewById(R.id.tvDescription); vh.tvWind = (TextView) convertView.findViewById(R.id.tvWind); vh.tvClouds = (TextView) convertView.findViewById(R.id.tvClouds); convertView.setTag(vh); } else { vh = (ViewHolder) convertView.getTag(); } Forecast forecast = mForecastList.get(position); vh.ivPic.setImageResource(R.drawable.no_image); if (forecast.getPicUrl() != null) { ImageLoader.getInstance().displayImage(forecast.getPicUrl(), vh.ivPic); } vh.tvDate.setText(forecast.getMonth() + " " + forecast.getDay()); vh.tvTemp.setText(getTemperature(forecast)); vh.tvDescription.setText(forecast.getDescription()); vh.tvWind.setText(forecast.getWindSpeed() + ", " + forecast.getWindDegree()); vh.tvClouds.setText(forecast.getCloudiness()); return convertView; }
public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { holder = new ViewHolder(); convertView = inflater.inflate(R.layout.itemintervention, null); holder.tvDescription = (TextView) convertView.findViewById(R.id.tvDescription); holder.tvAddress = (TextView) convertView.findViewById(R.id.tvAddress); holder.tvDate = (TextView) convertView.findViewById(R.id.tvDate); holder.tvState = (TextView) convertView.findViewById(R.id.tvState); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.tvDescription.setText(lst.get(position).getInformation()); holder.tvAddress.setText(lst.get(position).getMachineName()); if (lst.get(position).getType().equals("incident")) if (lst.get(position).getCallDay() != null) holder.tvDate.setText(lst.get(position).getCallDay().toLocaleString()); else if (lst.get(position).getMaintenanceDeadline() != null) holder.tvDate.setText(lst.get(position).getMaintenanceDeadline().toLocaleString()); holder.tvState.setText( res.getString( res.getIdentifier(lst.get(position).getState(), "string", "lift.maintenance.android"))); return convertView; }
@Override public View getView(final int position, View convertView, ViewGroup parent) { ViewHolder holder; if (isEmpty) { ListNoneView listNoneView = new ListNoneView(context); listNoneView.setInfo("没有相关的信息"); return listNoneView; } if (convertView == null && !(convertView instanceof ListNoneView)) { holder = new ViewHolder(); convertView = LayoutInflater.from(context).inflate(R.layout.home_ask_price_me_listview_item, null); holder.tvAllReplay = (TextView) convertView.findViewById(R.id.home_ask_price_me_listview_item_tv_all_replay); holder.tvFromAndTo = (TextView) convertView.findViewById(R.id.home_ask_price_me_listview_item_tv_fromAndTo); holder.tvInfo = (TextView) convertView.findViewById(R.id.home_ask_price_me_listview_item_tv_info); holder.tvDate = (TextView) convertView.findViewById(R.id.home_ask_price_me_listview_item_tv_date); holder.tvCommentCount = (TextView) convertView.findViewById(R.id.home_ask_price_me_listview_item_tv_commentCount); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } GoodsListDataForAskMe data = datas.get(position); holder.tvInfo.setText(data.getGoodsName()); holder.tvFromAndTo.setText(data.getDeparture() + " 至 " + data.getArrival()); holder.tvDate.setText("承运日期:" + data.getAcceptStartTime() + " 至 " + data.getAcceptEndTime()); holder.tvCommentCount.setText("有" + data.getInquiryAccountIds().length + "人询价"); holder.tvAllReplay.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(AskPriceActivity.this, AskPriceRelpyActivity.class); intent.putExtra("itemCode", adapterRight.getData(position).getInquiryItemCode()); intent.putExtra(AskPriceRelpyActivity.TYPE, AskPriceRelpyActivity.TYPE_REPLY_ALL); startActivity(intent); } }); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { View rowView = convertView; // reuse views if (rowView == null) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); rowView = inflater.inflate(R.layout.list_item, null); // configure view holder ViewHolder viewHolder = new ViewHolder(); viewHolder.tvDate = (TextView) rowView.findViewById(R.id.tvDate); rowView.setTag(viewHolder); } else { ViewHolder holder = (ViewHolder) rowView.getTag(); } return rowView; }
/* * * /** {@inheritDoc} */ @Override public final void bindView(final View view, final Context context, final Cursor cursor) { final Conversation c = Conversation.getConversation(context, cursor, false); final Contact contact = c.getContact(); ViewHolder holder = (ViewHolder) view.getTag(); if (holder == null) { holder = new ViewHolder(); holder.tvPerson = (TextView) view.findViewById(R.id.addr); holder.tvCount = (TextView) view.findViewById(R.id.count); holder.tvBody = (TextView) view.findViewById(R.id.body); holder.tvDate = (TextView) view.findViewById(R.id.date); holder.ivPhoto = (ImageView) view.findViewById(R.id.photo); holder.vRead = view.findViewById(R.id.read); view.setTag(holder); } if (useGridLayout) { holder.tvCount.setVisibility(View.GONE); } else { final int count = c.getCount(); if (count < 0) { holder.tvCount.setText(""); } else { holder.tvCount.setText("(" + c.getCount() + ")"); } } if (textSize > 0) { holder.tvBody.setTextSize(textSize); } final int col = textColor; if (col != 0) { holder.tvPerson.setTextColor(col); holder.tvBody.setTextColor(col); holder.tvCount.setTextColor(col); holder.tvDate.setTextColor(col); } if (useGridLayout || ConversationListActivity.showContactPhoto) { holder.ivPhoto.setImageDrawable(contact.getAvatar(activity, defaultContactAvatar)); holder.ivPhoto.setVisibility(View.VISIBLE); if (!useGridLayout) { holder.ivPhoto.setOnClickListener( WRAPPER.getQuickContact( context, holder.ivPhoto, contact.getLookUpUri(context.getContentResolver()), 2, null)); } } else { holder.ivPhoto.setVisibility(View.GONE); } if (isBlocked(contact.getNumber())) { holder.tvPerson.setText("[" + contact.getDisplayName() + "]"); } else { holder.tvPerson.setText(contact.getDisplayName()); } // read status if (c.getRead() == 0) { holder.vRead.setVisibility(View.VISIBLE); } else { holder.vRead.setVisibility(View.INVISIBLE); } // body CharSequence text = c.getBody(); if (text == null) { text = context.getString(R.string.mms_conversation); } if (convertNCR) { text = Converter.convertDecNCR2Char(text); } if (showEmoticons) { text = SmileyParser.getInstance(context).addSmileySpans(text); } holder.tvBody.setText(text); // date long time = c.getDate(); holder.tvDate.setText(ConversationListActivity.getDate(context, time)); // presence ImageView ivPresence = (ImageView) view.findViewById(R.id.presence); if (contact.getPresenceState() > 0) { ivPresence.setImageResource(Contact.getPresenceRes(contact.getPresenceState())); ivPresence.setVisibility(View.VISIBLE); } else { ivPresence.setVisibility(View.GONE); } }
@SuppressLint("NewApi") @Override public View getView(final int position, View convertView, ViewGroup parent) { final Order data = buyList.get(position); ViewHolder holder; if (convertView == null) { holder = new ViewHolder(); convertView = LayoutInflater.from(context).inflate(R.layout.search_source_listview_item, null); holder.tvPlace = (TextView) convertView.findViewById( R.id.search_source_listview_item_tv_departrue_and_destination); holder.tvCarState = (TextView) convertView.findViewById(R.id.search_source_listview_item_tv_car_state); holder.ivIsEfficacy = (ImageView) convertView.findViewById(R.id.search_source_listview_item_iv_isEfficacy); holder.ivShopping = (ImageView) convertView.findViewById(R.id.search_source_listview_item_iv_shopping); holder.ivColletion = (ImageView) convertView.findViewById(R.id.search_source_listview_item_iv_colletion); holder.tvEqualTitle = (TextView) convertView.findViewById(R.id.search_source_listview_item_tv_equaltitle); holder.tvDate = (TextView) convertView.findViewById(R.id.serch_source_listview_item_tv_date); holder.tvDescribe = (TextView) convertView.findViewById(R.id.serch_source_listview_item_tv_describe); holder.tvDeal = (TextView) convertView.findViewById(R.id.serch_source_listview_item_deal); holder.tvName = (TextView) convertView.findViewById(R.id.search_source_listview_item_company_name); holder.llStar = (LinearLayout) convertView.findViewById(R.id.search_source_listview_item_ll_star); holder.spinner = (ProgressBar) convertView.findViewById(R.id.download_progressBar); holder.imDownload = (ImageView) convertView.findViewById(R.id.search_source_listview_item_iv_company_logo); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } final ImageView imageView = holder.imDownload; final ProgressBar progressBar = holder.spinner; setShareImgPath(data.getIconUrl(), imageView, progressBar); holder.tvName.setText(data.getCompanyName()); holder.tvEqualTitle.setText("¥" + data.getTransportPrice() + "元"); holder.tvPlace.setText(data.getDeparture() + " 至 " + data.getArrival()); holder.tvDate.setText( "承运日期:" + dateStringtoString(data.getAcceptStartTime()) + " 至 " + dateStringtoString(data.getAcceptEndTime())); String describe = ""; String type = data.getInfoType(); if (type != null) { if (type.equals("car")) { describe = "[运力]"; } else if (type.equals("line")) { describe = "[路线]"; } else if (type.equals("goods")) { describe = "[物品]"; } } holder.tvDeal.setText("成交单数:" + data.getOrderCount()); holder.tvDescribe.setText(describe + data.getInfoName()); holder.tvCarState.setVisibility(View.VISIBLE); final int index = position; switch (data.getExecuteState()) { case 100: holder.tvCarState.setText("同意发车"); // bn holder.tvCarState.setBackground(getResources().getDrawable(R.drawable.no_click)); break; case 0: holder.tvCarState.setText("同意发车"); // n holder.tvCarState.setBackground(getResources().getDrawable(R.drawable.btn_orange_bg)); holder.tvCarState.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { CarDepartureAllowRequest req1 = new CarDepartureAllowRequest(); req1.setOrderCode(data.getOrderCode()); sendCarRequest(req1, index); } }); break; case 1: holder.tvCarState.setText("同意结算"); holder.tvCarState.setBackground(getResources().getDrawable(R.drawable.no_click)); break; case 2: holder.tvCarState.setText("同意结算"); holder.tvCarState.setBackground(getResources().getDrawable(R.drawable.no_click)); break; case 3: holder.tvCarState.setText("同意结算"); holder.tvCarState.setBackground(getResources().getDrawable(R.drawable.no_click)); break; case 4: holder.tvCarState.setText("同意结算"); // n holder.tvCarState.setBackground(getResources().getDrawable(R.drawable.btn_orange_bg)); holder.tvCarState.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(context, AgreePayForActivity.class); intent.putExtra(AgreePayForActivity.ORDERID, data.getOrderCode()); intent.putExtra(AgreePayForActivity.AMOUNT, data.getTransportPrice()); startActivity(intent); } }); break; case 5: holder.tvCarState.setText("同意结算"); // n holder.tvCarState.setBackground(getResources().getDrawable(R.drawable.btn_orange_bg)); holder.tvCarState.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // SettlementAllowRequest req3 = new SettlementAllowRequest(); // req3.setOrderCode(data.getOrderCode()); // sendCarRequest(req3, index); Intent intent = new Intent(context, AgreePayForActivity.class); intent.putExtra(AgreePayForActivity.ORDERID, data.getOrderCode()); intent.putExtra(AgreePayForActivity.AMOUNT, data.getTransportPrice()); startActivity(intent); } }); holder.tvCarState.setVisibility(View.GONE); break; case 6: holder.tvCarState.setText("同意结算"); holder.tvCarState.setVisibility(View.GONE); holder.tvCarState.setBackground(getResources().getDrawable(R.drawable.no_click)); break; case 7: holder.tvCarState.setText("同意结算"); holder.tvCarState.setVisibility(View.GONE); break; default: break; } holder.ivShopping.setVisibility(View.GONE); holder.ivColletion.setVisibility(View.GONE); final String state = holder.tvCarState.getText().toString(); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (isEmpty) { ListNoneView listNoneView = new ListNoneView(context); listNoneView.setInfo("没有相关的信息"); return listNoneView; } if (convertView == null && !(convertView instanceof ListNoneView)) { holder = new ViewHolder(); convertView = LayoutInflater.from(context).inflate(R.layout.search_source_listview_item, null); holder.tvCarState = (TextView) convertView.findViewById(R.id.search_source_listview_item_tv_car_state); holder.ivIsEfficacy = (ImageView) convertView.findViewById(R.id.search_source_listview_item_iv_isEfficacy); holder.ivShopping = (ImageView) convertView.findViewById(R.id.search_source_listview_item_iv_shopping); holder.ivColletion = (ImageView) convertView.findViewById(R.id.search_source_listview_item_iv_colletion); holder.tvEqualTitle = (TextView) convertView.findViewById(R.id.search_source_listview_item_tv_equaltitle); holder.tvCompany = (TextView) convertView.findViewById(R.id.search_source_listview_item_company_name); holder.tvStartAndTarget = (TextView) convertView.findViewById( R.id.search_source_listview_item_tv_departrue_and_destination); holder.tvDate = (TextView) convertView.findViewById(R.id.serch_source_listview_item_tv_date); holder.tvDescribe = (TextView) convertView.findViewById(R.id.serch_source_listview_item_tv_describe); holder.tvDeal = (TextView) convertView.findViewById(R.id.serch_source_listview_item_deal); holder.tvPrice = (TextView) convertView.findViewById(R.id.search_source_listview_item_tv_equaltitle); holder.ivCompanyLogo = (ImageView) convertView.findViewById(R.id.search_source_listview_item_iv_company_logo); holder.drawGradeView = (DrawGradeView) convertView.findViewById(R.id.search_source_listview_item_ll_star); holder.ivCompanyLogo = (ImageView) convertView.findViewById(R.id.search_source_listview_item_iv_company_logo); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } final GoodsListData goodsListData = datas.get(position); holder.tvStartAndTarget.setText( goodsListData.getDeparture() + " 至 " + goodsListData.getArrival()); // holder.tvPrice.setText((int)goodsListData.getTransportPrice()+"¥"); holder.tvCompany.setText(goodsListData.getCompanyName()); holder.tvDate.setText( "承运日期:" + goodsListData.getAcceptStartTime() + " -- " + goodsListData.getAcceptEndTime()); holder.tvDescribe.setText(goodsListData.getInfoType() + " " + goodsListData.getInfoName()); holder.tvDeal.setText("成交单数:" + goodsListData.getOrderCount()); holder.ivShopping.setVisibility(View.GONE); // holder.ivCompanyLogo.setImageBitmap(ImageLoader.getInstance().loadImageSync(goodsListData.getIconUrl())); holder.tvCarState.setVisibility(View.GONE); // holder.ivShopping.setVisibility(View.VISIBLE); holder.ivColletion.setVisibility(View.GONE); switch (goodsListData.getInquiryState()) { case AskConstant.WU_XIAO: holder.tvPrice.setText("无效"); break; case AskConstant.XUN_JIA_ZHONG: holder.tvPrice.setText("未回复"); break; case AskConstant.YI_CHE_XIAO: holder.tvPrice.setText("已撤销"); break; case AskConstant.YI_CHENG_JIAO: holder.tvPrice.setText("已成交"); break; case AskConstant.YI_HUI_FU: holder.tvPrice.setText("已回复"); break; case AskConstant.YI_JU_JUE: holder.tvPrice.setText("已拒绝"); break; default: break; } imageLoader.displayImage(datas.get(position).getIconUrl(), holder.ivCompanyLogo, options); holder.ivShopping.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(context, MyShoppingCarActivity.class); startActivity(intent); } }); holder.ivColletion.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // Intent intent = new Intent(context, PayForActivity.class); // startActivity(intent); Intent intent = new Intent(context, PayForActivity.class); Bundle bundle = new Bundle(); bundle.putString(PayForActivity.ORDERID, goodsListData.getOrderCode()); bundle.putString(PayForActivity.INFOTYPE, goodsListData.getInfoTypeCode()); bundle.putInt(PayForActivity.PRICEID, goodsListData.getPriceId()); bundle.putInt(PayForActivity.NUMBER, 1); bundle.putString(PayForActivity.TYPE, PayForActivity.ASKTOORDER); intent.putExtras(bundle); startActivity(intent); } }); holder.drawGradeView.setScore(goodsListData.getDegree(), "car"); return convertView; }