@Override public String getAlertCode(List<Info> listInfo) { String codeStr = ""; for (int i = 0; i < listInfo.size(); i++) { Info info = (Info) listInfo.get(i); if (info.onclikNum > 0) { codeStr += info.getAway() + " vs " + info.getHome() + ":"; if (info.isWin()) { codeStr += "胜"; } if (info.isFail()) { codeStr += "负"; } if (info.isDan()) { codeStr += "(胆)"; } codeStr += "\n\n"; } } return codeStr; }
private View addLayout(final Info info) { View convertView; convertView = mInflater.inflate(R.layout.buy_lq_main_listview_item, null); final ViewHolder holder = new ViewHolder(); TextView time = (TextView) convertView.findViewById(R.id.jc_main_list_item_text_time); TextView team = (TextView) convertView.findViewById(R.id.jc_main_list_item_text_team); TextView home = (TextView) convertView.findViewById(R.id.jc_main_list_item_text_team_name1); TextView away = (TextView) convertView.findViewById(R.id.jc_main_list_item_text_team_name2); TextView score = (TextView) convertView.findViewById(R.id.jc_main_list_item_text_team_score); TextView timeEnd = (TextView) convertView.findViewById(R.id.jc_main_list_item_text_time_end); final Button btnFail = (Button) convertView.findViewById(R.id.jc_main_list_item_button1); final Button btnWin = (Button) convertView.findViewById(R.id.jc_main_list_item_button3); final Button btnDan = (Button) convertView.findViewById(R.id.jc_main_list_item_button_dan); time.setText( info.getTime() + " " + context.getString(R.string.jc_main_team_id_title) + info.getTeamId()); team.setText(info.getTeam()); home.setText(info.getAway() + "(客)"); away.setText(info.getHome() + "(主)"); timeEnd.setText(info.getTimeEnd()); if (type == B_RF) { score.setText(info.getLetPoint()); btnFail.setText("主负" + info.getLetFail()); btnWin.setText("主胜" + info.getLetWin()); } else if (type == B_DX) { btnFail.setText("大" + info.getBig()); btnWin.setText("小" + info.getSmall()); score.setText(info.getBasePoint()); } else { btnFail.setText("主负" + info.getFail()); btnWin.setText("主胜" + info.getWin()); } if (info.isFail()) { btnFail.setBackgroundResource(R.drawable.jc_btn_b); } else { btnFail.setBackgroundResource(R.drawable.jc_btn); } if (info.isWin()) { btnWin.setBackgroundResource(R.drawable.jc_btn_b); } else { btnWin.setBackgroundResource(R.drawable.jc_btn); } btnFail.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub if (info.onclikNum > 0 || isCheckTeam()) { info.setFail(!info.isFail()); if (info.isFail()) { info.onclikNum++; btnFail.setBackgroundResource(R.drawable.jc_btn_b); } else { info.onclikNum--; btnFail.setBackgroundResource(R.drawable.jc_btn); } isNoDan(info, btnDan); setTeamNum(); } } }); btnWin.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub if (info.onclikNum > 0 || isCheckTeam()) { info.setWin(!info.isWin()); if (info.isWin()) { info.onclikNum++; btnWin.setBackgroundResource(R.drawable.jc_btn_b); } else { info.onclikNum--; btnWin.setBackgroundResource(R.drawable.jc_btn); } isNoDan(info, btnDan); setTeamNum(); } } }); if (isDanguan) { btnDan.setVisibility(Button.GONE); } else { btnDan.setVisibility(Button.VISIBLE); btnDan.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub if (info.isDan()) { info.setDan(false); btnDan.setBackgroundResource(R.drawable.jc_btn); } else if (info.onclikNum > 0 && isDanCheckTeam() && isDanCheck()) { info.setDan(true); btnDan.setBackgroundResource(R.drawable.jc_btn_b); } } }); } return convertView; }