@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) { 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; }