com.paic.zhifu.wallet.activity.modules.boundcard.OpenPaymentConfirmActivity.java Source code

Java tutorial

Introduction

Here is the source code for com.paic.zhifu.wallet.activity.modules.boundcard.OpenPaymentConfirmActivity.java

Source

package com.paic.zhifu.wallet.activity.modules.boundcard;

import java.io.IOException;
import java.util.HashMap;
import java.util.Properties;
import java.util.regex.Pattern;

import org.json.JSONException;
import org.json.JSONObject;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.support.v4.content.LocalBroadcastManager;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.paic.zhifu.wallet.activity.R;
import com.paic.zhifu.wallet.activity.bean.User;
import com.paic.zhifu.wallet.activity.cache.DataCache;
import com.paic.zhifu.wallet.activity.cache.SharepreferenceUtil;
import com.paic.zhifu.wallet.activity.control.GeneralStructuralActivity;
import com.paic.zhifu.wallet.activity.control.widget.HeadTitle;
import com.paic.zhifu.wallet.activity.control.widget.HeadTitle.TITLE_TYPE;
import com.paic.zhifu.wallet.activity.controller.ServerConnect;
import com.paic.zhifu.wallet.activity.controller.operations.OpenPaymentOperation;
import com.paic.zhifu.wallet.activity.controller.operations.OpenPaymentOperation.OpenPaymentOperationListener;
import com.paic.zhifu.wallet.activity.controller.operations.UserInfoOperation;
import com.paic.zhifu.wallet.activity.controller.operations.UserInfoOperation.BankCardInfoProcessor;
import com.paic.zhifu.wallet.activity.controller.operations.UserInfoOperation.BusinessType;
import com.paic.zhifu.wallet.activity.controller.specialOperation.SpecialTaskBuilder;
import com.paic.zhifu.wallet.activity.modules.bankcardsInfo.BankCardsInfo;
import com.paic.zhifu.wallet.activity.modules.boundcard.OpenPaymentActivity.OpReportBankCardInfo;
import com.paic.zhifu.wallet.activity.modules.creditpayment.ApplyStepOneSuccessActivity;
import com.paic.zhifu.wallet.activity.modules.creditpayment.net.PaymentByCreditNetOpt;
import com.paic.zhifu.wallet.activity.modules.creditpayment.pub.PaymentByCreditIntents;
import com.paic.zhifu.wallet.activity.modules.pay.TransferPayActivity;
import com.paic.zhifu.wallet.activity.modules.pay.TransferPayConfirmActivity;
import com.paic.zhifu.wallet.activity.modules.recharge.RechargeActivity;
import com.paic.zhifu.wallet.activity.modules.recharge.RechargeBankActivity;
import com.paic.zhifu.wallet.activity.modules.redpacket.SendRedPacketInfoActivity;
import com.paic.zhifu.wallet.activity.modules.withdraw.WithdrawActivity;
import com.paic.zhifu.wallet.activity.net.HttpConstants;
import com.paic.zhifu.wallet.activity.net.inf.ITaskCompleteListener;
import com.paic.zhifu.wallet.activity.tool.MyApp;
import com.paic.zhifu.wallet.activity.tool.StaticVariableTool;

/**
 * ??
 * <p>
 * :
 * {@linkplain com.paic.zhifu.wallet.activity.modules.PersonInfoActivity
 * PersonInfoActivity}
 * <p>
 * :
 * {@linkplain com.paic.zhifu.wallet.activity.modules.recharge.RechargeActivity
 * RechargeActivity}
 * <p>
 * :??
 * {@linkplain com.paic.zhifu.wallet.activity.modules.withdra.WithdrawActivity
 * WithdrawActivity}
 * <p>
 * :
 * {@linkplain com.paic.zhifu.wallet.activity.modules.pay.PaymentPhonebookActivity
 * PaymentPhonebookActivity}
 * <p>
 * :???{@link OpenPayAgreementActivity}
 */
public class OpenPaymentConfirmActivity extends GeneralStructuralActivity {

    private HeadTitle headTitle;
    private ImageView banklogo;
    private TextView bankcard;
    private EditText phonenumber, smsCode;
    private Button next_btn;

    private String cardNumAll;
    private String bankNum;
    private OpReportBankCardInfo bankCardInfo;
    private TextView userName;
    private TextView paperNumber;
    private Button notecheck;

    private String phoneNum;
    private String phoneNumLastSend;

    private TextView openpayagreement;
    private CheckBox agreeCheckBox;

    private boolean canSendSms = false;
    private boolean isSendVaildate = false;

    ITaskCompleteListener creditPayListener = new ITaskCompleteListener() {
        @Override
        public <T> void onTaskCompleted(int resultCode, T result, int connId) {

            if (resultCode == HttpConstants.RESPONSE_CODE_1000) {
                Intent successStepOne = new Intent(
                        PaymentByCreditIntents.PAYMENTBYCREDIT_STEP_ONE_APPLY_SUCCESSFULLY);
                LocalBroadcastManager.getInstance(OpenPaymentConfirmActivity.this).sendBroadcast(successStepOne);
                Intent i = new Intent(OpenPaymentConfirmActivity.this, ApplyStepOneSuccessActivity.class);
                startActivity(i);
                DataCache.getDataCache().cleanRuningActivitys();
                return;
            }

        }
    };

    private OpenPaymentOperationListener listener = new OpenPaymentOperationListener() {

        @Override
        public void getSMSCodeSuccess() {
            phoneNumLastSend = phoneNum;
        }

        @Override
        public void getSMSCodeFail(String ts) {
            ToastShow(ts);
        }

        @Override
        public BankCardInfoProcessor getRechargeBankCards() {
            //??????????
            return new UserInfoOperation.BankCardInfoProcessor(BusinessType.recharge) {

                @Override
                public void successFunction() {

                }

                @Override
                public void failFunction() {
                    //               OpenPaymentConfirmActivity.this.runOnUiThread(new Runnable() {
                    //                  @Override
                    //                  public void run() {
                    //                     customDialog = new AlertDialog.Builder(OpenPaymentConfirmActivity.this).create();
                    //                     customDialog.setMessage(getString(R.string.str_normal_error_message));
                    //                     customDialog.setButton("", new DialogInterface.OnClickListener() {
                    //                        public void onClick(DialogInterface dialog, int which) {
                    //                        }
                    //                     });
                    //                     customDialog.show();   
                    //                  }});   
                };

            };
        }

        @Override
        public <T> void getBankCardsCompleted(int responseCode, T result, int connId) {
            if (HttpConstants.RESPONSE_CODE_1000 == responseCode) {
                OpenPaymentConfirmActivity.this.runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        customDialog = new AlertDialog.Builder(OpenPaymentConfirmActivity.this).create();
                        customDialog.setMessage(getString(R.string.str_boundcard_succeed));
                        customDialog.setCancelable(false);
                        customDialog.setButton("", new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int which) {
                                jump(DataCache.getDataCache().getCoundCardOverJumpTo());
                            }
                        });
                        customDialog.show();
                    }
                });
            } else {
                JSONObject jsonbuff;
                try {
                    jsonbuff = new JSONObject(result.toString());
                    final String ts = (String) jsonbuff.get("resultMsg");
                    OpenPaymentConfirmActivity.this.runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            customDialog = new AlertDialog.Builder(OpenPaymentConfirmActivity.this).create();
                            customDialog.setMessage(ts);
                            customDialog.setButton("", new DialogInterface.OnClickListener() {
                                public void onClick(DialogInterface dialog, int which) {
                                }
                            });
                            customDialog.show();
                        }
                    });
                } catch (JSONException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }

        @Override
        public void bandcardSuccess() {
            OpenPaymentConfirmActivity.this.runOnUiThread(new Runnable() {
                @SuppressWarnings("deprecation")
                @Override
                public void run() {
                    customDialog = new AlertDialog.Builder(OpenPaymentConfirmActivity.this).create();
                    customDialog.setMessage(getString(R.string.str_boundcard_succeed));
                    customDialog.setButton("", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {

                            if (DataCache.getDataCache()
                                    .getCoundCardOverJumpTo() == StaticVariableTool.ACTIVITY_CREDITPAY_OPENPAYMENT_SUCCESS) {

                                if (DataCache.getDataCache().getUser().getBankCardInfos().size() == 1) {
                                    PaymentByCreditNetOpt.applyPaymentByCreditStepOne(
                                            OpenPaymentConfirmActivity.this,
                                            DataCache.getDataCache().getUser().getBankCardInfos().get(0)
                                                    .getBankCardId(),
                                            DataCache.getDataCache().getPaymentbycredit_amount(),
                                            creditPayListener);
                                }

                            } else {
                                jump(DataCache.getDataCache().getCoundCardOverJumpTo());
                            }

                        }
                    });
                    customDialog.show();
                }
            });
        }

        @Override
        public <T> void bandCardCompleted(int responseCode, T result, int connId) {

            switch (responseCode) {
            case HttpConstants.RESPONSE_CODE_1000:
                break;
            case HttpConstants.RESPONSE_CODE_1035:
                ToastShow(getResources().getString(R.string.str_reponse_error_1035_msg));
                break;
            case HttpConstants.RESPONSE_CODE_1027:
                ToastShow(getResources().getString(R.string.str_reponse_error_1027_msg));
                break;
            default:
                JSONObject jsonbuff;
                try {
                    jsonbuff = new JSONObject(result.toString());
                    String ts = (String) jsonbuff.get("resultMsg");
                    ToastShow("?  " + ts);
                } catch (JSONException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                break;
            }

        }

        public Activity getActivity() {
            return OpenPaymentConfirmActivity.this;
        }

    };
    private TextView bankTel;
    private Properties properties = new Properties();

    @Override
    public void initIntent() {

        DataCache.getDataCache().addRuningActivity(OpenPaymentConfirmActivity.this);
        bankCardInfo = (OpReportBankCardInfo) getIntent().getSerializableExtra("OpReportBankCardInfo");
        bankNum = getIntent().getStringExtra("cardNum");
        cardNumAll = getIntent().getStringExtra("cardNumAll");
    }

    @Override
    public void initControl() {
        this.setContentView(R.layout.activity_openpay2);
        // ??
        headTitle = new HeadTitle(this, TITLE_TYPE.NORMAL);
        headTitle.setTitle(getString(R.string.TextView_activity_openpay_title_str_new));

        banklogo = (ImageView) this.findViewById(R.id.ImageView_activity_openpay2_banklogo);
        bankcard = (TextView) this.findViewById(R.id.TextView_activity_openpay2_bankcardnumber);
        phonenumber = (EditText) this.findViewById(R.id.EditText_activity_openpay2_phonenumber);
        smsCode = (EditText) this.findViewById(R.id.EditText_activity_openpay2_smsCode);
        next_btn = (Button) this.findViewById(R.id.Button_activity_openpay2_next);
        bankTel = (TextView) this.findViewById(R.id.textview_activity_openpay2_bank_servicetel);
        userName = (TextView) this.findViewById(R.id.EditText_activity_openpay2_username);
        paperNumber = (TextView) this.findViewById(R.id.EditText_activity_openpay2_papernumber);
        notecheck = (Button) this.findViewById(R.id.ImageButton_activity_openpay2_notecheck);
        agreeCheckBox = (CheckBox) findViewById(R.id.ImageButton_activity_openpay2_agreeCheckbox);
        agreeCheckBox.setChecked(true);
        openpayagreement = (TextView) findViewById(R.id.TextView_activity_openpay2_agreement);
        next_btn.setEnabled(false);
        try {
            properties.load(getAssets().open("config_servicetel.properties"));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void initVariable() {

        bankcard.setText("?" + bankNum + " " + bankCardInfo.bankCardType);
        User user = DataCache.getDataCache().getUser();
        String idCardNum = user.getIdCardNo();
        String realName = user.getRealName();
        int realNameLength = realName.length();
        String anonymousMark = "";
        if (realNameLength > 0) {
            for (int num = 1; num < realNameLength; num++) {
                anonymousMark = anonymousMark + "*";
            }
            userName.setText(anonymousMark + realName.substring(realNameLength - 1));
        } else {
            userName.setText("*");
        }
        if (idCardNum.length() > 3) {
            paperNumber.setText(
                    idCardNum.substring(0, 3) + "*************" + idCardNum.substring(idCardNum.length() - 2));
        }
        if (StaticVariableTool.getBankImage(bankCardInfo.bankMark) != -1) {
            banklogo.setImageResource(StaticVariableTool.getBankImage(bankCardInfo.bankMark));
        }
        String bankMark = bankCardInfo.bankMark.toUpperCase();
        if (properties != null) {
            if (properties.containsKey(bankMark) && properties.containsKey(bankMark + "_SERVICETEL")) {
                //properties????
                String bankName = (String) properties.get(bankMark);
                String serviceTel = (String) properties.get(bankMark + "_SERVICETEL");
                bankTel.setText(bankName + getString(R.string.bankcard_recharge_servicetel_b) + serviceTel);
            } else {
                bankTel.setText(getString(R.string.TextView_no_bank_servicetel));
            }

        }

    }

    @Override
    public void initObserver() {

        if (DataCache.getDataCache().getCountDown() > 0) {
            startCountDown(DataCache.getDataCache().getCountDown());
        }

        openpayagreement.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                jump(StaticVariableTool.ACTIVITY_OPENPAYAGREEMENT);

            }
        });

        headTitle.setBackPressedListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                finish();
            }
        });

        notecheck.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {

                if (isSendVaildate)
                    return;

                if (!canSendSms)
                    return;

                phoneNum = phonenumber.getText().toString();

                // ?????  ??????????
                HashMap<String, String> checkCodeMap = new HashMap<String, String>();
                checkCodeMap.put("clientId", StaticVariableTool.getIMEI(MyApp.getContext()));
                checkCodeMap.put("operationType",
                        ServerConnect.getOperationType(HttpConstants.CONNECTIONID_SMSCODE));
                checkCodeMap.put("useType", "2");
                checkCodeMap.put("loginId", "");
                checkCodeMap.put("phoneNum", phoneNum);

                OpenPaymentOperation.sendSMSCode(OpenPaymentConfirmActivity.this, listener, checkCodeMap);

                startCountDown();

            }
        });

        next_btn.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {

                if (!checkPhoneNum()) {
                    ToastShow("??");
                    return;
                }
                if (phoneNumLastSend == null) {
                    ToastShow("????");
                    return;
                }
                if (!phoneNumLastSend.equals(phonenumber.getText().toString())) {
                    ToastShow("?????????");
                    return;
                }
                if (!checkSMSCode()) {
                    ToastShow("??6?");
                    return;
                }
                if (!checkLicense()) {
                    ToastShow(getString(R.string.TextView_activity_openpay2_agreement_str_agree));
                    return;
                }

                // ????
                HashMap<String, String> openPayMap = new HashMap<String, String>();
                openPayMap.put("clientId", StaticVariableTool.getIMEI(MyApp.getContext()));
                openPayMap.put("operationType",
                        ServerConnect.getOperationType(HttpConstants.CONNECTIONID_BANDCARD));
                openPayMap.put("bankCardNo", cardNumAll);
                openPayMap.put("smsCode", smsCode.getText().toString());

                OpenPaymentOperation.openPayment(OpenPaymentConfirmActivity.this, listener, openPayMap);

            }
        });

        phonenumber.addTextChangedListener(new TextWatcher() {
            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {

            }

            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void afterTextChanged(Editable s) {
                checkAndChangeNextBtnState();
                // ?
                if (!isSendVaildate) {
                    if (!phonenumber.getText().toString().equals(phoneNumLastSend)) {
                        notecheck.setText(getResources().getString(R.string.Button_openpay_smsSend));
                    } else {
                        notecheck.setText(getString(R.string.Button_openpay_smsSend_again));
                    }
                }
            }
        });

        smsCode.addTextChangedListener(new TextWatcher() {
            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {

            }

            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void afterTextChanged(Editable s) {

                checkAndChangeNextBtnState();

            }
        });

        agreeCheckBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                checkAndChangeNextBtnState();
            }
        });

    }

    //   /**
    //    * ?
    //    */
    //   private void getUserInfo(){
    //      HashMap<String, String> userinfoMap = new HashMap<String, String>();
    //      userinfoMap.put("clientId", StaticVariableTool.getIMEI(MyApp.getContext()));
    //      userinfoMap.put("operationType", ServerConnect
    //            .getOperationType(HttpConstants.CONNECTIONID_QUERYUSERINFO));
    //      userinfoMap.put("targetPhoneNum", CommunityDBManager.getInstance().getRecentlyUser().getPhoneNum());
    //      
    //      ServerConnect.getInstance().requestToServer(OpenPaymentConfirmActivity.this, listener, HttpConstants.CONNECTIONID_QUERYUSERINFO, userinfoMap);
    //   }

    @Override
    public void jump(int to) {

        DataCache.getDataCache().setCoundCardOverJumpTo(-1);

        switch (to) {
        case StaticVariableTool.ACTIVITY_RECHARGE:

            Intent rechargeIntent = new Intent(MyApp.getContext(), RechargeActivity.class);
            DataCache.getDataCache().setIsNewCard(true);
            DataCache.getDataCache().setBankCardSelectNow(0);
            this.startActivity(rechargeIntent);
            DataCache.getDataCache().cleanRuningActivitys();
            break;
        case StaticVariableTool.ACTIVITY_WITHDRAW:

            Intent withdrawIntent = new Intent(MyApp.getContext(), WithdrawActivity.class);
            DataCache.getDataCache().setIsNewCard(true);
            DataCache.getDataCache().setBankCardSelectNow(0);
            this.startActivity(withdrawIntent);
            DataCache.getDataCache().cleanRuningActivitys();
            break;
        //      case StaticVariableTool.ACTIVITY_PAYMENTPHONEBOOK:
        //
        //         Intent paymentphonebookIntent = new Intent(MyApp.getContext(),
        //               PaymentActivity.class);
        //         paymentphonebookIntent.putExtra("newPay", true);
        //         this.startActivity(paymentphonebookIntent);
        //         DataCache.getDataCache().cleanRuningActivitys();
        //         break;
        //      case StaticVariableTool.ACTIVITY_PAYMENT:
        //         Intent payIntent = new Intent(MyApp.getContext(),
        //               PaymentActivity.class);
        //
        //         this.startActivity(payIntent);
        //         DataCache.getDataCache().cleanRuningActivitys();
        //         break;
        case StaticVariableTool.ACTIVITY_OPENPAYAGREEMENT:
            Intent intent2 = new Intent(MyApp.getContext(), OpenPayAgreementActivity.class);
            startActivity(intent2);
            break;
        case StaticVariableTool.ACTIVITY_BANKCARDSINFO:
            Intent bankCardsIntent = new Intent(MyApp.getContext(), BankCardsInfo.class);
            startActivity(bankCardsIntent);
            DataCache.getDataCache().cleanRuningActivitys();
            break;
        case StaticVariableTool.ACTIVITY_TRANSFER_PAYMENT:
            Intent transferPayConfirmIntent = new Intent(MyApp.getContext(), TransferPayConfirmActivity.class);
            startActivity(transferPayConfirmIntent);
            DataCache.getDataCache().cleanRuningActivitys();
            break;
        case StaticVariableTool.ACTIVITY_TRANSFER_PAYMENTINFO:
            Intent transferConfirmIntent = new Intent(MyApp.getContext(), TransferPayActivity.class);
            startActivity(transferConfirmIntent);
            DataCache.getDataCache().cleanRuningActivitys();
            break;
        case StaticVariableTool.ACTIVITY_SEND_REDPACKET:
            Intent sendRedPacket = new Intent(MyApp.getContext(), SendRedPacketInfoActivity.class);
            startActivity(sendRedPacket);
            DataCache.getDataCache().cleanRuningActivitys();
            break;
        case StaticVariableTool.ACTIVITY_P2PCHAT:
            //         Intent ChatIntent = new Intent(MyApp.getContext(),
            //               ChatActivity.class);
            //         startActivity(ChatIntent);
            DataCache.getDataCache().cleanRuningActivitys();
            break;
        case StaticVariableTool.ACTIVITY_RECHARGEBANK:
            Intent RechargeBankIntent = new Intent(MyApp.getContext(), RechargeBankActivity.class);
            startActivity(RechargeBankIntent);
            DataCache.getDataCache().cleanRuningActivitys();
            break;
        case StaticVariableTool.ACTIVITY_HOME:
            DataCache.getDataCache().cleanRuningActivitys();
        default:
            DataCache.getDataCache().cleanRuningActivitys();
            SharepreferenceUtil.saveBoolean(SpecialTaskBuilder.NEWBIETASK_THREE_ISOVER, true);
            break;
        }
    }

    @Override
    public void backBtnFunction() {
        this.finish();
    }

    /**
     * ?????
     * <p>
     * ?xx
     */
    private void startCountDown() {
        startCountDown(60);
    }

    /**
     * ?????
     * <p>
     * ?xx
     */
    private void startCountDown(final int count) {
        new Thread() {
            public void run() {
                OpenPaymentConfirmActivity.this.runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        phonenumber.setEnabled(false);
                        notecheck.setBackgroundResource(R.drawable.buttonb1);
                        isSendVaildate = true;
                    }
                });

                CountDown countDown = new CountDown();
                for (int i = count; i >= 0; i--) {
                    countDown.countDowni = i;
                    DataCache.getDataCache().setCountDown(i);
                    OpenPaymentConfirmActivity.this.runOnUiThread(countDown);

                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }

                OpenPaymentConfirmActivity.this.runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        phonenumber.setEnabled(true);
                        notecheck.setBackgroundResource(R.drawable.buttona1);
                        isSendVaildate = false;
                        if (!phonenumber.getText().toString().equals(phoneNumLastSend)) {
                            notecheck.setText(getResources().getString(R.string.Button_openpay_smsSend));
                        } else {
                            notecheck.setText(getString(R.string.Button_openpay_smsSend_again));
                        }
                    }
                });
            }
        }.start();
    }

    /**
     * ?
     */
    private void checkAndChangeNextBtnState() {
        // ?????????
        if (!checkPhoneNum() || !checkLicense() || !checkSMSCode()) {
            next_btn.setBackgroundResource(R.drawable.normal_btn2);
            next_btn.setTextColor(Color.BLACK);
            next_btn.setEnabled(false);
        } else {
            next_btn.setBackgroundResource(R.drawable.normal_btn);
            next_btn.setTextColor(Color.WHITE);
            next_btn.setEnabled(true);
        }
    }

    public static boolean isNumeric(String str) {
        Pattern pattern = Pattern.compile("[0-9]*");
        return pattern.matcher(str).matches();
    }

    private boolean checkPhoneNum() {
        if (!StaticVariableTool.checkSMSvaildateAndPhone(phonenumber.getText().toString())) {
            if (!isSendVaildate) {
                canSendSms = false;
                notecheck.setBackgroundResource(R.drawable.buttonb1);
            }
            return false;
        } else {
            if (!isSendVaildate) {
                canSendSms = true;
                notecheck.setBackgroundResource(R.drawable.buttona1);
            }
            return true;
        }
    }

    private boolean checkSMSCode() {
        String smsCodeStr = smsCode.getText().toString();
        if (smsCodeStr.length() != 6) {
            return false;
        }
        if (!isNumeric(smsCodeStr)) {
            return false;
        }
        return true;
    }

    private boolean checkLicense() {
        if (agreeCheckBox.isChecked()) {
            return true;
        }
        return false;
    }

    class CountDown implements Runnable {

        int countDowni;

        @Override
        public void run() {
            System.out.println("" + countDowni);
            notecheck.setText("" + countDowni + "");
        }

    }

}