@Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub index = position; ViewHolder holder = null; JoinCheck info = (JoinCheck) mList.get(position).get(INFO); String icon = info.getTitle(); String result = info.getResult(); String id = info.getCaseid(); String time = info.getTime(); String atm = info.getAtm(); String state = info.getDisplayState(); if (convertView == null) { convertView = mInflater.inflate(R.layout.join_check_listview_item, null); holder = new ViewHolder(); holder.icon = (TextView) convertView.findViewById(R.id.join_check_item_text_icon); holder.id = (TextView) convertView.findViewById(R.id.join_check_item_text_id); holder.result = (TextView) convertView.findViewById(R.id.join_check_item_text_result); holder.atm = (TextView) convertView.findViewById(R.id.join_check_item_text_amt); holder.time = (TextView) convertView.findViewById(R.id.join_check_item_text_time); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.icon.setText(icon); setResultColor(state, result, holder.result); holder.id.setText(id); holder.time.setText(time); holder.atm.setText(atm); return convertView; }
/** 合买详情框 */ public void detailDalog(int position) { JoinCheck info = (JoinCheck) listPages.get(newPage).get(position); LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE); View v = inflater.inflate(R.layout.join_check_detail, null); final AlertDialog detailDialog = new AlertDialog.Builder(this).create(); TextView lotno = (TextView) v.findViewById(R.id.join_check_detail_text_lotno); TextView time = (TextView) v.findViewById(R.id.join_check_detail_text_time); TextView id = (TextView) v.findViewById(R.id.join_check_detail_text_id); TextView allAtm = (TextView) v.findViewById(R.id.join_check_detail_text_all_atm); TextView renAtm = (TextView) v.findViewById(R.id.join_check_detail_text_ren_atm); TextView baoAtm = (TextView) v.findViewById(R.id.join_check_detail_text_bao_atm); TextView progress = (TextView) v.findViewById(R.id.join_check_detail_text_progress); TextView result = (TextView) v.findViewById(R.id.join_check_detail_text_result); TextView zhuma = (TextView) v.findViewById(R.id.join_check_detail_text_zhuma); TextView prize = (TextView) v.findViewById(R.id.join_check_detail_text_prize_atm); TextView startPrize = (TextView) v.findViewById(R.id.join_check_detail_text_start_prize_atm); lotno.append(info.getTitle()); time.append(info.getTime()); id.append(info.getCaseid()); allAtm.append(info.getAllAtm()); renAtm.append(info.getAtm()); baoAtm.append(info.getBaoAtm()); progress.append(info.getProgress()); result.setTextColor(setColor(info.getDisplayState())); result.append(info.getResult()); zhuma.append(info.getZhuma()); prize.append(info.getPrizeAmt()); startPrize.append(info.getCommisionPrizeAmt()); Button cancel = (Button) v.findViewById(R.id.join_check_detail_cancel); cancel.setOnClickListener( new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub detailDialog.cancel(); } }); detailDialog.show(); detailDialog.getWindow().setContentView(v); }
/** 初始化数据 */ public void setValue() { try { Vector<JoinCheck> checkInfos = new Vector<JoinCheck>(); JSONArray array = json.getJSONArray("result"); allPage = Integer.parseInt(json.getString("totalPage")); for (int i = 0; i < array.length(); i++) { JSONObject obj = array.getJSONObject(i); JoinCheck checkInfo = new JoinCheck(); checkInfo.setTitle(obj.getString("lotNo")); checkInfo.setCaseid(obj.getString("caseLotId")); checkInfo.setResult(obj.getString("displayStateMemo")); checkInfo.setAtm(obj.getString("amt")); checkInfo.setTime(obj.getString("buyTime")); checkInfo.setDisplayState(obj.getString("displayState")); checkInfo.setAllAtm(obj.getString("totalAmt")); checkInfo.setBaoAtm(obj.getString("safeAmt")); checkInfo.setProgress(obj.getString("progress")); checkInfo.setPrizeAmt(obj.getString("prizeAmt")); checkInfo.setCommisionPrizeAmt(obj.getString("commisionPrizeAmt")); try { checkInfo.setZhuma(obj.getString("content")); } catch (Exception e) { } checkInfos.add(checkInfo); } listPages.add(checkInfos); } catch (Exception e) { } }