/** 获取注码 */ public String getCode(String key, List<Info> listInfo) { String code = jcType.getValues(key) + "@"; for (int i = 0; i < listInfo.size(); i++) { Info info = (Info) listInfo.get(i); if (info.onclikNum > 0) { code += info.getDay() + "|" + info.getWeek() + "|" + info.getTeamId() + "|"; if (info.isWin()) { code += "2"; // 小 } if (info.isFail()) { code += "1"; // 大 } code += "^"; } } return code; }
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_jc_main_listview_item, null); 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_vs); TextView timeEnd = (TextView) convertView.findViewById(R.id.jc_main_list_item_text_time_end); final Button btn1 = (Button) convertView.findViewById(R.id.jc_main_list_item_button1); final Button btn2 = (Button) convertView.findViewById(R.id.jc_main_list_item_button2); final Button btn3 = (Button) convertView.findViewById(R.id.jc_main_list_item_button3); final Button btnDan = (Button) convertView.findViewById(R.id.jc_main_list_item_button_dan); final Button btnXi = (Button) convertView.findViewById(R.id.buy_jc_main_list_item_btn_xi); time.setText( info.getTime() + " " + context.getString(R.string.jc_main_team_id_title) + info.getTeamId()); team.setText(info.getTeam()); score.setText(info.getLetPoint()); score.setTextColor(Color.BLUE); home.setText(info.getHome() + "(主)"); away.setText(info.getAway() + "(客)"); timeEnd.setText(info.getTimeEnd()); btn1.setText("胜" + info.getWin()); btn2.setText("平" + info.getLevel()); btn3.setText("负" + info.getFail()); if (info.isFail()) { btn3.setBackgroundResource(R.drawable.jc_btn_b); } else { btn3.setBackgroundResource(R.drawable.jc_btn); } if (info.isWin()) { btn1.setBackgroundResource(R.drawable.jc_btn_b); } else { btn1.setBackgroundResource(R.drawable.jc_btn); } if (info.isLevel()) { btn2.setBackgroundResource(R.drawable.jc_btn_b); } else { btn2.setBackgroundResource(R.drawable.jc_btn); } btn1.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++; btn1.setBackgroundResource(R.drawable.jc_btn_b); } else { info.onclikNum--; btn1.setBackgroundResource(R.drawable.jc_btn); } isNoDan(info, btnDan); setTeamNum(); } } }); btn2.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub if (info.onclikNum > 0 || isCheckTeam()) { info.setLevel(!info.isLevel()); if (info.isLevel()) { info.onclikNum++; btn2.setBackgroundResource(R.drawable.jc_btn_b); } else { info.onclikNum--; btn2.setBackgroundResource(R.drawable.jc_btn); } isNoDan(info, btnDan); setTeamNum(); } } }); btn3.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++; btn3.setBackgroundResource(R.drawable.jc_btn_b); } else { info.onclikNum--; btn3.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); } } }); } btnXi.setVisibility(Button.VISIBLE); btnXi.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub trunExplain(getEvent(Constants.JCFOOT, info), info.getHome(), info.getAway()); } }); return convertView; }