/** 投注方法 */ public void beginTouZhu() { toLogin = false; String alertStr = isTouzhu(); if (alertStr.equals("true") && addView.getSize() == 0) { if (getZhuShu() > MAX_ZHU) { dialogExcessive(); } else if (addView.getSize() >= ALL_ZHU) { Toast.makeText( ZixuanActivity.this, ZixuanActivity.this.getString(R.string.buy_add_view_zhu_alert), Toast.LENGTH_SHORT) .show(); } else { addToCodes(); alert(); } } else if (alertStr.equals("true") && addView.getSize() > 0) { addToCodes(); showAddViewDialog(); } else if (addView.getSize() > 0) { showAddViewDialog(); } else if (alertStr.equals("false")) { dialogExcessive(); } else if (alertStr.equals("no")) { dialogZhixuan(); } else { alertInfo(alertStr); } }
public void getCodeInfo(AddView addView) { int zhuShu = getZhuShu(); CodeInfo codeInfo = addView.initCodeInfo(getAmt(zhuShu), zhuShu); setLotoNoAndType(codeInfo); String lotoNo = codeInfo.getLotoNo(); String touzhuType = codeInfo.getTouZhuType(); AreaNum[] areaNums = itemViewArray.get(0).areaNums; codeInfo.setTouZhuCode(code.zhuma(areaNums, iProgressBeishu, 0)); boolean isFirst = true; for (AreaNum areaNum : areaNums) { int[] codes = areaNum.table.getHighlightBallNOs(); String codeStr = ""; for (int i = 0; i < codes.length; i++) { if (isTen) { codeStr += PublicMethod.isTen(codes[i]); } else { codeStr += String.valueOf(codes[i]); } if (i != codes.length - 1) { if (!lotoNo.equals(Constants.LOTNO_QXC) && !lotoNo.equals(Constants.LOTNO_PL5) && !(lotoNo.equals(Constants.LOTNO_PL3) && touzhuType.equals("zhixuan"))) { codeStr += ","; } } } if (lotoNo.equals(Constants.LOTNO_PL3) && touzhuType.equals("zu3_danshi") && isFirst) { codeStr += ("," + codeStr); isFirst = false; } codeInfo.addAreaCode(codeStr, areaNum.textColor); } addView.addCodeInfo(codeInfo); }
@Override protected void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); if (addview != null) { addview.clearInfo(); addview.updateTextNum(); } }
@Override public void errorCode_0000() { // TODO Auto-generated method stub showfenxdialog(); if (addview != null) { addview.clearInfo(); addview.updateTextNum(); } }
/** 投注提示框中的信息 */ public String getTouzhuAlert() { return "注数:" + addView.getAllZhu() + "注 " + "金额:" + +iProgressQishu * addView.getAllAmt() * iProgressBeishu + "元"; }
/** 再次启动提示框 */ public void initAlerDialog() { touzhuCheck.setChecked(true); clearProgress(); stateCheck(); issueText.setText(PublicMethod.toIssue(betAndGift.getLotno()) + "期"); textTitle.setText("注码:" + "共有" + addView.getSize() + "笔投注"); addView.getCodeList().get(addView.getSize() - 1).setTextCodeColor(textZhuma, null, null); isCodeText(codeInfo); alertText.setText(getTouzhuAlert()); touZhuDialog.show(); }
/** 初始化投注信息 */ public void initBet() { betAndGift.setIsSellWays("1"); betAndGift.setAmount("" + addView.getAllAmt() * iProgressBeishu * 100); betAndGift.setSessionid(sessionId); betAndGift.setPhonenum(phonenum); betAndGift.setUserno(userno); betAndGift.setBettype("bet"); // 投注为bet,赠彩为gift betAndGift.setLotmulti("" + iProgressBeishu); // lotmulti 倍数 投注的倍数 betAndGift.setBatchnum("" + iProgressQishu); // batchnum 追号期数 默认为1(不追号) betAndGift.setBet_code(addView.getTouzhuCode(iProgressBeishu, betAndGift.getAmt() * 100)); lotno = PublicMethod.toLotno(betAndGift.getLotno()); betAndGift.setBatchcode(PublicMethod.toIssue(betAndGift.getLotno())); // 期号 }
/** 将选取信息添加到号码篮里 */ private void addToCodes() { if (getZhuShu() > MAX_ZHU) { dialogExcessive(); } else if (addView.getSize() >= ALL_ZHU) { Toast.makeText( ZixuanActivity.this, ZixuanActivity.this.getString(R.string.buy_add_view_zhu_alert), Toast.LENGTH_SHORT) .show(); } else { getCodeInfo(addView); addView.updateTextNum(); again(); } }
private void isCodeText(Button codeInfo) { if (addview.getSize() > 1) { codeInfo.setVisibility(Button.VISIBLE); } else { codeInfo.setVisibility(Button.GONE); } }
/** 投注提示框中的信息 */ public void getTouzhuAlert() { if (type.equals("zc")) { zhushu.setText(betAndGift.getZhushu() + "注 "); jine.setText( iProgressQishu * (Integer.valueOf(betAndGift.getAmount()) / 100) * iProgressBeishu + "元"); } else { zhushu.setText(addview.getAllZhu() + "注 "); jine.setText(iProgressQishu * addview.getAllAmt() * iProgressBeishu + "元"); } // return "注数:" // + addview.getAllZhu() + "注 " // + "金额:" + // + iProgressQishu * addview.getAllAmt() * iProgressBeishu // + "元"; }
public void getCodeInfo(AddView addView) { int zhuShu = getZhuShu(); CodeInfo codeInfo = addView.initCodeInfo(getAmt(zhuShu), zhuShu); AreaNum[] areaNums = itemViewArray.get(0).areaNums; codeInfo.setTouZhuCode(code.zhuma(areaNums, iProgressBeishu, 0)); for (AreaNum areaNum : areaNums) { int[] codes = areaNum.table.getHighlightBallNOs(); String codeStr = ""; for (int i = 0; i < codes.length; i++) { codeStr += PublicMethod.isTen(codes[i]); if (i != codes.length - 1) { codeStr += ","; } } codeInfo.addAreaCode(codeStr, areaNum.textColor); } addView.addCodeInfo(codeInfo); }
public void errorCode_0000() { // TODO Auto-generated method stub String codeStr = addView.getsharezhuma(); clearAddView(); for (int i = 0; i < itemViewArray.get(0).areaNums.length; i++) { itemViewArray.get(0).areaNums[i].table.clearAllHighlights(); // itemViewArray.get(1).areaNums[i].table.clearAllHighlights(); } showEditText(); PublicMethod.showDialog(ZixuanActivity.this, lotno + codeStr); }
/** 投注方法 */ private void touZhu() { toLogin = false; touZhuDialog.cancel(); initBet(); // TODO Auto-generated method stub if (isGift) { toActivity(addView.getsharezhuma()); } else if (isJoin) { toJoinActivity(); } else if (isTouzhu) { touZhuNet(); } clearProgress(); }
/** 重写放回建 */ @Override public boolean onKeyDown(int keyCode, KeyEvent event) { // TODO Auto-generated method stub switch (keyCode) { case 4: if (addView.getSize() != 0) { alertExit(getString(R.string.buy_alert_exit)); } else { finish(); } break; } return false; }
private void init() { beishulayLayout = (LinearLayout) findViewById(R.id.beishulayout); zhushu = (TextView) findViewById(R.id.alert_dialog_touzhu_textview_zhushu); jine = (TextView) findViewById(R.id.alert_dialog_touzhu_textview_jine); caizhong = (TextView) findViewById(R.id.alert_dialog_touzhu_textview_caizhong); caizhong.setText(PublicMethod.toLotno(betAndGift.getLotno())); issueText = (TextView) findViewById(R.id.alert_dialog_touzhu_textview_qihao); textZhuma = (TextView) findViewById(R.id.alert_dialog_touzhu_text_zhuma); textTitle = (TextView) findViewById(R.id.alert_dialog_touzhu_text_zhuma_title); if (type.equals("hight")) { issueText.setText("第" + betAndGift.getBatchcode() + "期"); } else if (type.equals("zc")) { issueText.setText("第" + betAndGift.getBatchcode() + "期"); } else { issueText.setText("第" + PublicMethod.toIssue(betAndGift.getLotno()) + "期"); } if (type.equals("zc")) { textTitle.setText("注码:共有1笔投注"); textZhuma.setText(betAndGift.getBet_code()); beishulayLayout.setVisibility(View.GONE); codeInfo = (Button) findViewById(R.id.alert_dialog_touzhu_btn_look_code); codeInfo.setVisibility(View.GONE); } else { beishulayLayout.setVisibility(View.VISIBLE); initImageView(); addview.getCodeList().get(addview.getSize() - 1).setTextCodeColor(textZhuma); textTitle.setText("注码:" + "共有" + addview.getSize() + "笔投注"); codeInfo = (Button) findViewById(R.id.alert_dialog_touzhu_btn_look_code); isCodeText(codeInfo); codeInfo.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub addview.createCodeInfoDialog(context); addview.showDialog(); } }); } if (betAndGift.isZhui()) { initZhuiJia(); } getTouzhuAlert(); Button cancel = (Button) findViewById(R.id.alert_dialog_touzhu_button_cancel); Button ok = (Button) findViewById(R.id.alert_dialog_touzhu_button_ok); cancel.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub ZiXuanTouZhu.this.finish(); } }); ok.setOnClickListener( new OnClickListener() { public void onClick(View v) { RWSharedPreferences pre = new RWSharedPreferences(ZiXuanTouZhu.this, "addInfo"); sessionId = pre.getStringValue("sessionid"); phonenum = pre.getStringValue("phonenum"); userno = pre.getStringValue("userno"); if (userno.equals("")) { toLogin = true; Intent intentSession = new Intent(ZiXuanTouZhu.this, UserLogin.class); startActivityForResult(intentSession, 0); } else { touZhu(); } } }); }
private void showAddViewDialog() { addView.createDialog(ZixuanActivity.this.getString(R.string.buy_add_dialog_title)); addView.showDialog(); }
/** 第一次启动投注提示框 */ public void initTouZhuDialog() { LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE); View v = inflater.inflate(R.layout.alert_dialog_touzhu_new, null); touZhuDialog = new Dialog(this, R.style.MyDialog); initImageView(v); if (betAndGift.isZhui()) { initZhuiJia(v); } issueText = (TextView) v.findViewById(R.id.alert_dialog_touzhu_textview_qihao); alertText = (TextView) v.findViewById(R.id.alert_dialog_touzhu_text_one); textZhuma = (TextView) v.findViewById(R.id.alert_dialog_touzhu_text_zhuma); textTitle = (TextView) v.findViewById(R.id.alert_dialog_touzhu_text_zhuma_title); addView.getCodeList().get(addView.getSize() - 1).setTextCodeColor(textZhuma, null, null); issueText.setText(PublicMethod.toIssue(betAndGift.getLotno()) + "期"); alertText.setText(getTouzhuAlert()); textTitle.setText("注码:" + "共有" + addView.getSize() + "笔投注"); Button cancel = (Button) v.findViewById(R.id.alert_dialog_touzhu_button_cancel); Button ok = (Button) v.findViewById(R.id.alert_dialog_touzhu_button_ok); codeInfo = (Button) v.findViewById(R.id.alert_dialog_touzhu_btn_look_code); isCodeText(codeInfo); codeInfo.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub addView.createCodeInfoDialog(); addView.showDialog(); } }); cancel.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub toLogin = false; touZhuDialog.cancel(); clearProgress(); } }); ok.setOnClickListener( new OnClickListener() { public void onClick(View v) { RWSharedPreferences pre = new RWSharedPreferences(ZixuanActivity.this, "addInfo"); sessionId = pre.getStringValue("sessionid"); phonenum = pre.getStringValue("phonenum"); userno = pre.getStringValue("userno"); if (userno.equals("")) { toLogin = true; Intent intentSession = new Intent(ZixuanActivity.this, UserLogin.class); startActivityForResult(intentSession, 0); } else { touZhu(); } } }); CheckBox checkPrize = (CheckBox) v.findViewById(R.id.alert_dialog_touzhu_check_prize); checkPrize.setChecked(true); // 设置betAndGift.prizeend与checkPrize保持一致 betAndGift.setPrizeend("1"); checkPrize.setButtonDrawable(R.drawable.check_on_off); checkPrize.setOnCheckedChangeListener( new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // TODO Auto-generated method stub if (isChecked) { betAndGift.setPrizeend("1"); } else { betAndGift.setPrizeend("0"); } } }); check = (RadioButton) v.findViewById(R.id.alert_dialog_touzhu_check); joinCheck = (RadioButton) v.findViewById(R.id.alert_dialog_join_check); touzhuCheck = (RadioButton) v.findViewById(R.id.alert_dialog_touzhu1_check); touzhuCheck.setChecked(true); textAlert = (TextView) v.findViewById(R.id.alert_dialog_touzhu_text_alert); check.setPadding(50, 0, 0, 0); check.setButtonDrawable(R.drawable.check_select); // 实现记住密码 和 复选框的状态 check.setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { isGift = isChecked; } }); joinCheck.setPadding(50, 0, 0, 0); joinCheck.setButtonDrawable(R.drawable.check_select); // 实现记住密码 和 复选框的状态 joinCheck.setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { isJoin = isChecked; } }); touzhuCheck.setPadding(50, 0, 0, 0); touzhuCheck.setButtonDrawable(R.drawable.check_select); // 实现记住密码 和 复选框的状态 touzhuCheck.setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { isTouzhu = isChecked; } }); stateCheck(); touZhuDialog.setCancelable(false); touZhuDialog.setContentView(v); touZhuDialog.show(); }
private void clearAddView() { addView.clearInfo(); addView.updateTextNum(); }