@Override public View getView(final int position, View convertView, ViewGroup parent) { eBean = getItem(position); final ExpressHolder nHolder; if (convertView == null) { convertView = mInflater.inflate(R.layout.item_express_received, parent, false); nHolder = new ExpressHolder(); nHolder.tv_name = (TextView) convertView.findViewById(R.id.tv_express_name); nHolder.tv_express_phone = (TextView) convertView.findViewById(R.id.tv_express_phone); nHolder.tv_reach_time = (TextView) convertView.findViewById(R.id.tv_express_reachTime); nHolder.tv_express_company = (TextView) convertView.findViewById(R.id.tv_express_company); nHolder.iv_portrait = (ImageView) convertView.findViewById(R.id.iv_portrait); nHolder.rl_notice = (RelativeLayout) convertView.findViewById(R.id.rl_express_received); nHolder.tv_express_company_num = (TextView) convertView.findViewById(R.id.tv_express_company_num); convertView.setTag(nHolder); } else { nHolder = (ExpressHolder) convertView.getTag(); } if (eBean != null) { // 头像 if (eBean.packageUserAvatar != null && !TextUtils.isEmpty(eBean.packageUserAvatar.smallPicUrl)) { ImageLoader.getInstance() .displayImage(eBean.packageUserAvatar.smallPicUrl, nHolder.iv_portrait, build); } else { nHolder.iv_portrait.setImageResource(R.mipmap.ic_launcher); } nHolder.tv_name.setText(eBean.packageUserName); nHolder.tv_express_phone.setText(eBean.packagePhone); nHolder.tv_reach_time.setText("领取时间: " + eBean.arriveTimeShow); eBean.comName = eBean.comName.replace("(", "(").replace(")", ")"); nHolder.tv_express_company.setText(eBean.comName + ":"); nHolder.tv_express_company_num.setText(eBean.expressNum); } nHolder.rl_notice.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) {} }); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { final ExpressHolder nHolder; if (convertView == null) { convertView = mInflater.inflate(R.layout.item_express_no_receive, parent, false); nHolder = new ExpressHolder(); nHolder.tv_name = (TextView) convertView.findViewById(R.id.tv_express_name); nHolder.tv_express_notice = (TextView) convertView.findViewById(R.id.tv_express_notice); nHolder.tv_express_phone = (TextView) convertView.findViewById(R.id.tv_express_phone); nHolder.tv_reach_time = (TextView) convertView.findViewById(R.id.tv_express_reachTime); nHolder.tv_express_company = (TextView) convertView.findViewById(R.id.tv_express_company); nHolder.iv_portrait = (CircleImageView) convertView.findViewById(R.id.iv_portrait); nHolder.rl_notice = (RelativeLayout) convertView.findViewById(R.id.rl_notice); nHolder.tv_express_company_num = (TextView) convertView.findViewById(R.id.tv_express_company_num); convertView.setTag(nHolder); } else { nHolder = (ExpressHolder) convertView.getTag(); } eBean = getItem(position); if (eBean != null) { if (eBean.canNotify) { // 可以通知 nHolder.tv_express_notice.setBackgroundDrawable( CommonUtils.creatRectangleDrawble("#a2e542")); nHolder.tv_express_notice.setClickable(true); nHolder.tv_express_notice.setEnabled(true); } else { // 不可以通知 nHolder.tv_express_notice.setBackgroundDrawable( CommonUtils.creatRectangleDrawble("#d0d0d0")); nHolder.tv_express_notice.setClickable(false); nHolder.tv_express_notice.setEnabled(false); } // 头像 if (eBean.packageUserAvatar != null && !TextUtils.isEmpty(eBean.packageUserAvatar.smallPicUrl)) { ImageLoader.getInstance() .displayImage(eBean.packageUserAvatar.smallPicUrl, nHolder.iv_portrait, build); } else { nHolder.iv_portrait.setImageResource(R.mipmap.ic_launcher); } nHolder.tv_name.setText(eBean.packageUserName); nHolder.tv_express_phone.setText(eBean.packagePhone); nHolder.tv_reach_time.setText("到达时间: " + eBean.arriveTimeShow); eBean.comName = eBean.comName.replace("(", "(").replace(")", ")"); nHolder.tv_express_company.setText(eBean.comName + ":"); nHolder.tv_express_company_num.setText(eBean.expressNum); nHolder.tv_express_notice.setTag(position); nHolder.tv_express_notice.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (CommonUtils.isNetworkConnected(ExpressQueryRecordActivity.this)) { Object object = v.getTag(); if (object != null) { int pos = Integer.parseInt(object.toString()); nHolder.tv_express_notice.setClickable(false); nHolder.tv_express_notice.setEnabled(false); tempPos = pos; requestExpressNotice(getItem(pos).expressNum); } } else { toast("网络不可用"); } } }); } return convertView; }