From 4598b51c90c695c9ccbe5350a84e4a46b9d8e587 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期三, 22 五月 2024 20:19:02 +0800
Subject: [PATCH] 2024年05月22日20:18:54

---
 app/src/main/java/com/hdl/photovoltaic/ui/account/RegisterAccountActivity.java |  593 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 564 insertions(+), 29 deletions(-)

diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/account/RegisterAccountActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/account/RegisterAccountActivity.java
index da72b98..8cf5e60 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/account/RegisterAccountActivity.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/account/RegisterAccountActivity.java
@@ -2,14 +2,38 @@
 
 
 import android.os.Bundle;
+import android.os.CountDownTimer;
+import android.text.Editable;
+import android.text.InputType;
+import android.text.TextUtils;
+import android.text.TextWatcher;
+import android.text.method.HideReturnsTransformationMethod;
+import android.text.method.PasswordTransformationMethod;
 import android.view.View;
 
+import androidx.appcompat.content.res.AppCompatResources;
 import androidx.constraintlayout.widget.ConstraintSet;
 
+import com.hdl.linkpm.sdk.core.exception.HDLException;
+import com.hdl.linkpm.sdk.user.HDLLinkPMUser;
+import com.hdl.linkpm.sdk.user.bean.HDLUserRegionBean;
 import com.hdl.photovoltaic.R;
 import com.hdl.photovoltaic.base.CustomBaseActivity;
+import com.hdl.photovoltaic.config.AppConfigManage;
+import com.hdl.photovoltaic.config.UserConfigManage;
 import com.hdl.photovoltaic.databinding.ActivityRegisterAccountBinding;
+import com.hdl.photovoltaic.listener.CloudCallBeak;
+import com.hdl.photovoltaic.other.HdlAccountLogic;
+import com.hdl.photovoltaic.other.HdlLogLogic;
+import com.hdl.photovoltaic.other.HdlThreadLogic;
 import com.hdl.photovoltaic.utils.KeyboardStateObserverUtils;
+import com.hdl.photovoltaic.widget.ConfirmationCancelDialog;
+import com.hdl.photovoltaic.widget.ConfirmationTipDialog;
+import com.hdl.photovoltaic.widget.ListStaticDialog;
+import com.sahooz.library.countrypicker.Country;
+import com.sahooz.library.countrypicker.CountryPickerFragment;
+import com.sahooz.library.countrypicker.PickCountryCallback;
+
 
 /**
  * 娉ㄥ唽璐﹀彿鐣岄潰
@@ -17,6 +41,21 @@
 public class RegisterAccountActivity extends CustomBaseActivity {
 
     private ActivityRegisterAccountBinding viewBinding;
+
+    private boolean isPhoneType = true;
+
+    private String mPhoneAccount;
+    private String mPhonePsw;
+    private String mPhoneConfirmPsw;
+    private String mPhoneVerificationCode;
+
+    private String mMailAccount;
+    private String mMailPsw;
+    private String mMailConfirmPsw;
+    private String mMailVerificationCode;
+
+    private String mUrl = "https://test-gz.hdlcontrol.com";
+
 
     @Override
     public Object getContentView() {
@@ -56,17 +95,20 @@
 
 
     private void initView() {
-
-        viewBinding.registerPhoneTitleIc.accountTitleTv.setText(R.string.home_login_鎵嬫満鍙�);
-        viewBinding.registerPhoneTitleIc.accountTitleTv.setTextSize(20);
-        viewBinding.registerPhoneTitleIc.accountTitleTv.setTextColor(getResources().getColor(R.color.text_90000000));
-        viewBinding.registerPhoneTitleIc.lineV.setVisibility(View.VISIBLE);
-
-        viewBinding.registerMailTitleIc.accountTitleTv.setText(R.string.home_login_閭);
-        viewBinding.registerMailTitleIc.accountTitleTv.setTextSize(16);
-        viewBinding.registerMailTitleIc.accountTitleTv.setTextColor(getResources().getColor(R.color.text_40000000));
-        viewBinding.registerMailTitleIc.lineV.setVisibility(View.GONE);
-
+        //鏍规嵁app璇█榛樿鏈嶅姟鍣ㄥ湴鍧�
+        if (UserConfigManage.getInstance().isZh()) {
+            mUrl = "https://china-gateway.hdlcontrol.com";
+            viewBinding.regionTv.setText("HDL China");
+        } else {
+            viewBinding.regionTv.setText("HDL Bahrain");
+            mUrl = "https://bahrain-gateway.hdlcontrol.com";
+        }
+        switchPhoneOrEmailStyleView();
+        try {
+            Country.load(this);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
     }
 
     private void initEvent() {
@@ -77,36 +119,529 @@
                 finish();
             }
         });
+        //鏈嶅姟鍣ㄩ�夋嫨
+        viewBinding.registerRegionServerRl.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                ListStaticDialog listDialog = new ListStaticDialog(_mActivity);
+                listDialog.show();
+                listDialog.setOnHDLChinaOnListener(new ListStaticDialog.onHDLChinaListener() {
+                    @Override
+                    public void HDLChina() {
+                        mUrl = "https://china-gateway.hdlcontrol.com";
+                        viewBinding.regionTv.setText(listDialog.geHDLChinaText());
+                        listDialog.dismiss();
+
+                    }
+                });
+                listDialog.setOnHDLBahrainListener(new ListStaticDialog.onHDLBahrainListener() {
+                    @Override
+                    public void HDLBahrain() {
+                        mUrl = "https://bahrain-gateway.hdlcontrol.com";
+                        viewBinding.regionTv.setText(listDialog.getHDLBahrainText());
+                        listDialog.dismiss();
+                    }
+                });
+            }
+        });
+        //鎵嬫満鍖哄彿閫夋嫨
+        viewBinding.registerRegionAccountRl.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                selectArea();
+            }
+        });
+
+        //鍒囨崲鎵嬫満鍙�
         viewBinding.registerPhoneTitleIc.underlineCl.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
 
-                viewBinding.registerPhoneTitleIc.accountTitleTv.setText(R.string.home_login_鎵嬫満鍙�);
-                viewBinding.registerPhoneTitleIc.accountTitleTv.setTextSize(20);
-                viewBinding.registerPhoneTitleIc.accountTitleTv.setTextColor(getResources().getColor(R.color.text_90000000));
-                viewBinding.registerPhoneTitleIc.lineV.setVisibility(View.VISIBLE);
-
-                viewBinding.registerMailTitleIc.accountTitleTv.setText(R.string.home_login_閭);
-                viewBinding.registerMailTitleIc.accountTitleTv.setTextSize(16);
-                viewBinding.registerMailTitleIc.accountTitleTv.setTextColor(getResources().getColor(R.color.text_40000000));
-                viewBinding.registerMailTitleIc.lineV.setVisibility(View.GONE);
+                isPhoneType = true;
+                switchPhoneOrEmailStyleView();
             }
         });
-
+        //鍒囨崲閭
         viewBinding.registerMailTitleIc.underlineCl.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
-                viewBinding.registerPhoneTitleIc.accountTitleTv.setText(R.string.home_login_鎵嬫満鍙�);
-                viewBinding.registerPhoneTitleIc.accountTitleTv.setTextSize(16);
-                viewBinding.registerPhoneTitleIc.accountTitleTv.setTextColor(getResources().getColor(R.color.text_40000000));
-                viewBinding.registerPhoneTitleIc.lineV.setVisibility(View.GONE);
+                isPhoneType = false;
+                switchPhoneOrEmailStyleView();
+            }
+        });
 
-                viewBinding.registerMailTitleIc.accountTitleTv.setText(R.string.home_login_閭);
-                viewBinding.registerMailTitleIc.accountTitleTv.setTextSize(20);
-                viewBinding.registerMailTitleIc.accountTitleTv.setTextColor(getResources().getColor(R.color.text_90000000));
-                viewBinding.registerMailTitleIc.lineV.setVisibility(View.VISIBLE);
+        //杈撳叆瀵嗙爜
+        viewBinding.registerPswEt.addTextChangedListener(changePswTextWatcher);
+        //瀵嗙爜鏄剧ず鎴栬�呴殣钘�
+        viewBinding.registerPswHideIv.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                if (v.isSelected()) {
+                    v.setSelected(false);
+                    viewBinding.registerPswHideIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.hide));
+                    viewBinding.registerPswEt.setTransformationMethod(PasswordTransformationMethod.getInstance());
+
+                } else {
+                    v.setSelected(true);
+                    viewBinding.registerPswHideIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.show));
+                    viewBinding.registerPswEt.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
+                }
+                //璁剧疆鍏夋爣浣嶇疆
+                if (!TextUtils.isEmpty(viewBinding.registerPswEt.getText())) {
+                    viewBinding.registerPswEt.setSelection(viewBinding.registerPswEt.length());
+                }
+            }
+        });
+        //杈撳叆纭瀵嗙爜
+        viewBinding.registerConfirmPswEt.addTextChangedListener(changeConfirmPswTextWatcher);
+        //纭瀵嗙爜鏄剧ず鎴栬�呴殣钘�
+        viewBinding.registerConfirmPswHideIv.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                if (v.isSelected()) {
+                    v.setSelected(false);
+                    viewBinding.registerConfirmPswHideIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.hide));
+                    viewBinding.registerConfirmPswEt.setTransformationMethod(PasswordTransformationMethod.getInstance());
+                } else {
+                    v.setSelected(true);
+                    viewBinding.registerConfirmPswHideIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.show));
+                    viewBinding.registerConfirmPswEt.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
+                }
+                //璁剧疆鍏夋爣浣嶇疆
+                if (!TextUtils.isEmpty(viewBinding.registerConfirmPswEt.getText())) {
+                    viewBinding.registerConfirmPswEt.setSelection(viewBinding.registerConfirmPswEt.length());
+                }
+            }
+        });
+        //杈撳叆鎵嬫満鍙锋垨鑰呴偖绠�
+        viewBinding.registerAccountEt.addTextChangedListener(accountTextWatcher);
+        //鎵嬫満鍙疯幏鍙栭獙璇佺爜
+        viewBinding.registerPhoneVerificationTv.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                sendVerification();
+
+            }
+        });
+        //杈撳叆鎵嬫満楠岃瘉鐮�
+        viewBinding.registerPhoneVerificationEt.addTextChangedListener(phoneVerificationTextWatcher);
+        //閭鑾峰彇楠岃瘉鐮�
+        viewBinding.registerMailVerificationTv.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                sendVerification();
+
+            }
+        });
+        //杈撳叆閭楠岃瘉鐮�
+        viewBinding.registerMailVerificationEt.addTextChangedListener(mailVerificationTextWatcher);
+        //娉ㄥ唽璐﹀彿
+        viewBinding.registerCompleteTv.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                if (!isLocalCheckAccountAndPassword()) {
+                    return;
+                }
+                //
+                viewBinding.textErrorTv.setText("");
+
+                String account = viewBinding.registerAccountEt.getText().toString();
+                String psw = viewBinding.registerConfirmPswEt.getText().toString();
+                String verification_code;
+                if (isPhoneType) {
+                    verification_code = viewBinding.registerPhoneVerificationEt.getText().toString();
+                } else {
+                    verification_code = viewBinding.registerMailVerificationEt.getText().toString();
+                }
+                showLoading();
+                HdlAccountLogic.getInstance().registerAccount_C(isPhoneType, account, psw, verification_code, new CloudCallBeak<Boolean>() {
+                    @Override
+                    public void onSuccess(Boolean obj) {
+                        HdlThreadLogic.runMainThread(new Runnable() {
+                            @Override
+                            public void run() {
+                                hideLoading();
+                                ConfirmationTipDialog dialog = new ConfirmationTipDialog(_mActivity);
+                                dialog.show();
+                                dialog.setTitle(getString(R.string.home_account_registered_successfully));
+                                dialog.setYesOnclickListener(new ConfirmationCancelDialog.onYesOnclickListener() {
+                                    @Override
+                                    public void Confirm() {
+                                        finish();
+                                    }
+                                });
+                            }
+                        }, null, null);
+
+                    }
+
+                    @Override
+                    public void onFailure(HDLException e) {
+                        hideLoading();
+                        HdlThreadLogic.tipFlashingBox(_mActivity, false, e.getMsg(), e.getCode());
+                    }
+                });
             }
         });
 
     }
+
+
+    /**
+     * 鍙戦�侀獙璇佺爜鎸囦护
+     */
+    private void sendVerification() {
+
+        String account = viewBinding.registerAccountEt.getText().toString();
+        if (TextUtils.isEmpty(account)) {
+            if (isPhoneType) {
+                viewBinding.textErrorTv.setText(R.string.home_login_phone_null);
+            } else {
+                viewBinding.textErrorTv.setText(R.string.home_login_mail_null);
+            }
+            return;
+        }
+
+
+        //鑾峰彇璐﹀彿鍖哄煙淇℃伅
+        HdlAccountLogic.getInstance().regionByAccount(account, new CloudCallBeak<HDLUserRegionBean>() {
+            @Override
+            public void onSuccess(HDLUserRegionBean obj) {
+                HdlThreadLogic.toast(RegisterAccountActivity.this, getString(R.string.home_login_already_exists));
+                HdlLogLogic.print("鑾峰彇璐﹀彿鍖哄煙淇℃伅--->" + obj, false);
+            }
+
+            @Override
+            public void onFailure(HDLException e) {
+                //鐢ㄦ埛涓嶅瓨鍦ㄦ墠娉ㄥ唽
+                if (e != null && e.getCode() == 10010) {
+                    //璁剧疆璐﹀彿鎵�鍦ㄥ尯鍩熷崗璁強鍦板潃
+//                    AppConfigManage.setUserRegionUrl("http://59.41.255.150:7777");//obj.getRegionUrl()
+                    if (!AppConfigManage.isIsOnlineServer()) {
+                        //娴嬭瘯鐜榛樿杩欎釜鍩熷悕
+                        mUrl = "https://test-gz.hdlcontrol.com";
+                    }
+                    HDLLinkPMUser.getInstance().setUserRegionUrl(mUrl);
+                    HdlAccountLogic.getInstance().sendVerifyCode(isPhoneType, account, viewBinding.regionAccountNumberTv.getText().toString(), 1, new CloudCallBeak<Boolean>() {
+                        @Override
+                        public void onSuccess(Boolean obj) {
+                            if (isPhoneType) {
+                                phoneCountDownTimer.start();
+                            } else {
+                                mailCountDownTimer.start();
+                            }
+                        }
+
+                        @Override
+                        public void onFailure(HDLException e) {
+                            HdlThreadLogic.toast(_mActivity, e);
+                        }
+                    });
+                } else {
+                    HdlThreadLogic.toast(_mActivity, e);
+                }
+
+
+            }
+        });
+
+    }
+
+
+    /**
+     * 鍒濆鍖栨墜鏈哄彿璁℃椂鍣�
+     */
+    CountDownTimer phoneCountDownTimer = new CountDownTimer(60 * 1000, 1000) {
+        @Override
+        public void onTick(long millisUntilFinished) {
+            long time = (millisUntilFinished / 1000);
+            String str = time + "s" + getString(R.string.home_login_psw_verification_repeater);
+            viewBinding.registerPhoneVerificationTv.setText(str);
+            viewBinding.registerPhoneVerificationTv.setTextColor(getResources().getColor(R.color.text_25000000, null));
+            viewBinding.registerPhoneVerificationTv.setEnabled(false);
+
+        }
+
+        @Override
+        public void onFinish() {
+            viewBinding.registerPhoneVerificationTv.setText(getString(R.string.home_login_verification_regain));
+            viewBinding.registerPhoneVerificationTv.setTextColor(getResources().getColor(R.color.text_245EC3, null));
+            viewBinding.registerPhoneVerificationTv.setEnabled(true);
+
+
+        }
+    };
+    /**
+     * 鍒濆鍖栭偖绠辫鏃跺櫒
+     */
+    CountDownTimer mailCountDownTimer = new CountDownTimer(60 * 1000, 1000) {
+        @Override
+        public void onTick(long millisUntilFinished) {
+            long time = (millisUntilFinished / 1000);
+            String str = time + "s" + getString(R.string.home_login_psw_verification_repeater);
+
+            viewBinding.registerMailVerificationTv.setText(str);
+            viewBinding.registerMailVerificationTv.setTextColor(getResources().getColor(R.color.text_25000000, null));
+            viewBinding.registerMailVerificationTv.setEnabled(false);
+
+        }
+
+        @Override
+        public void onFinish() {
+            viewBinding.registerMailVerificationTv.setText(getString(R.string.home_login_verification_regain));
+            viewBinding.registerMailVerificationTv.setTextColor(getResources().getColor(R.color.text_245EC3, null));
+            viewBinding.registerMailVerificationTv.setEnabled(true);
+
+        }
+    };
+
+    /**
+     * 鍥藉鎵嬫満鍙峰尯鍙峰脊绐�
+     */
+    private void selectArea() {
+        CountryPickerFragment dialog = new CountryPickerFragment(this, new PickCountryCallback() {
+            @Override
+            public void onPick(Country country) {
+                if (country.flag != 0)
+                    viewBinding.regionAccountTv.setText(country.name);
+                viewBinding.regionAccountNumberTv.setText("+" + country.code);
+            }
+        });
+        dialog.show();
+        dialog.setDialogSize();
+    }
+
+    /**
+     * 鍒囨崲鎵嬫満鍙锋垨鑰呴偖绠辩殑鏍峰紡
+     */
+    private void switchPhoneOrEmailStyleView() {
+
+
+        if (isPhoneType) {
+            //鎵嬫満鍙�
+            viewBinding.registerPhoneTitleIc.accountTitleTv.setText(R.string.home_login_phone);
+            viewBinding.registerPhoneTitleIc.accountTitleTv.setTextSize(20);
+            viewBinding.registerPhoneTitleIc.accountTitleTv.setTextColor(getResources().getColor(R.color.text_E6000000, null));
+            viewBinding.registerPhoneTitleIc.lineV.setVisibility(View.VISIBLE);
+
+            viewBinding.registerMailTitleIc.accountTitleTv.setText(R.string.home_login_email);
+            viewBinding.registerMailTitleIc.accountTitleTv.setTextSize(16);
+            viewBinding.registerMailTitleIc.accountTitleTv.setTextColor(getResources().getColor(R.color.text_66000000, null));
+            viewBinding.registerMailTitleIc.lineV.setVisibility(View.GONE);
+            //鏄剧ず鍖哄彿
+            viewBinding.registerRegionAccountRl.setVisibility(View.VISIBLE);
+            //杈撳叆鎵嬫満鍙�
+            viewBinding.registerAccountEt.setInputType(InputType.TYPE_CLASS_NUMBER);
+            viewBinding.registerAccountEt.setHint(R.string.home_login_input_phone);
+            //鏄剧ず鎵嬫満鍙烽獙璇佺爜锛岄殣钘忛偖绠遍獙璇佺爜,
+            viewBinding.registerPhoneVerificationCodeRl.setVisibility(View.VISIBLE);
+            viewBinding.registerMailVerificationCodeRl.setVisibility(View.GONE);
+            //璁板綍閭璐﹀彿鍜屽瘑鐮�
+            mMailAccount = viewBinding.registerAccountEt.getText().toString();
+            mMailVerificationCode = viewBinding.registerMailVerificationEt.getText().toString();
+            mMailPsw = viewBinding.registerPswEt.getText().toString();
+            mMailConfirmPsw = viewBinding.registerConfirmPswEt.getText().toString();
+            //鏄剧ず鏃ф暟鎹�
+            viewBinding.registerAccountEt.setText(mPhoneAccount);
+            viewBinding.registerPhoneVerificationEt.setText(mPhoneVerificationCode);
+            viewBinding.registerPswEt.setText(mPhonePsw);
+            viewBinding.registerConfirmPswEt.setText(mPhoneConfirmPsw);
+
+
+        } else {
+            //閭
+            viewBinding.registerPhoneTitleIc.accountTitleTv.setText(R.string.home_login_phone);
+            viewBinding.registerPhoneTitleIc.accountTitleTv.setTextSize(16);
+            viewBinding.registerPhoneTitleIc.accountTitleTv.setTextColor(getResources().getColor(R.color.text_66000000, null));
+            viewBinding.registerPhoneTitleIc.lineV.setVisibility(View.GONE);
+
+            viewBinding.registerMailTitleIc.accountTitleTv.setText(R.string.home_login_email);
+            viewBinding.registerMailTitleIc.accountTitleTv.setTextSize(20);
+            viewBinding.registerMailTitleIc.accountTitleTv.setTextColor(getResources().getColor(R.color.text_E6000000, null));
+            viewBinding.registerMailTitleIc.lineV.setVisibility(View.VISIBLE);
+
+            //闅愯棌鍖哄彿
+            viewBinding.registerRegionAccountRl.setVisibility(View.GONE);
+            //杈撳叆閭
+            viewBinding.registerAccountEt.setInputType(InputType.TYPE_CLASS_TEXT);
+            viewBinding.registerAccountEt.setHint(R.string.home_login_input_mail);
+
+            //鏄剧ず绠遍偖楠岃瘉鐮侊紝闅愯棌鎵嬫満鍙烽獙璇佺爜,
+            viewBinding.registerPhoneVerificationCodeRl.setVisibility(View.GONE);
+            viewBinding.registerMailVerificationCodeRl.setVisibility(View.VISIBLE);
+
+            //璁板綍鎵嬫満鍙峰拰瀵嗙爜
+            mPhoneAccount = viewBinding.registerAccountEt.getText().toString();
+            mPhoneVerificationCode = viewBinding.registerPhoneVerificationEt.getText().toString();
+            mPhonePsw = viewBinding.registerPswEt.getText().toString();
+            mPhoneConfirmPsw = viewBinding.registerConfirmPswEt.getText().toString();
+            //鏄剧ず鏃ф暟鎹�
+            viewBinding.registerAccountEt.setText(mMailAccount);
+            viewBinding.registerMailVerificationEt.setText(mMailVerificationCode);
+            viewBinding.registerPswEt.setText(mMailPsw);
+            viewBinding.registerConfirmPswEt.setText(mMailConfirmPsw);
+
+        }
+
+
+    }
+
+    /**
+     * 鏍¢獙鎸夐挳鏄惁鍚敤
+     */
+    private void isCompleteEnabled() {
+        String account = viewBinding.registerAccountEt.getText().toString();
+        String psw1 = viewBinding.registerPswEt.getText().toString();
+        String psw2 = viewBinding.registerConfirmPswEt.getText().toString();
+        String verification_code;
+        if (isPhoneType) {
+            verification_code = viewBinding.registerPhoneVerificationEt.getText().toString();
+        } else {
+            verification_code = viewBinding.registerMailVerificationEt.getText().toString();
+        }
+        boolean isEnabled = account.length() > 0 && psw1.length() > 0 && psw2.length() > 0 && verification_code.length() > 0;
+        viewBinding.registerCompleteTv.setEnabled(isEnabled);
+    }
+
+    /**
+     * 鏈湴鏍¢獙杈撳叆璐﹀彿鎴栬�呭瘑鐮佹槸鍚︽纭�
+     */
+    private boolean isLocalCheckAccountAndPassword() {
+        String psw1 = viewBinding.registerPswEt.getText().toString();
+        String psw2 = viewBinding.registerConfirmPswEt.getText().toString();
+        if (!psw1.equals(psw2)) {
+            viewBinding.textErrorTv.setText(R.string.home_login_psw_unlikeliness);
+            return false;
+        }
+        if (psw1.length() < 6 || psw1.length() > 16) {
+            viewBinding.textErrorTv.setText(R.string.home_login_error_6_16_str);
+            return false;
+        }
+//        if (psw2.length() < 6 || psw2.length() > 16) {
+//            viewBinding.textErrorTv.setText(R.string.home_login_error_6_16_str);
+//            return false;
+//        }
+        return true;
+
+    }
+
+
+    @Override
+    protected void onDestroy() {
+        super.onDestroy();
+        Country.destroy();
+        if (phoneCountDownTimer != null) {
+            phoneCountDownTimer.cancel();
+            phoneCountDownTimer = null;
+        }
+        if (mailCountDownTimer != null) {
+            mailCountDownTimer.cancel();
+            mailCountDownTimer = null;
+        }
+        viewBinding.registerAccountEt.removeTextChangedListener(accountTextWatcher);
+        viewBinding.registerPhoneVerificationEt.removeTextChangedListener(phoneVerificationTextWatcher);
+        viewBinding.registerMailVerificationEt.removeTextChangedListener(mailVerificationTextWatcher);
+        viewBinding.registerPswEt.removeTextChangedListener(changePswTextWatcher);
+        viewBinding.registerConfirmPswEt.removeTextChangedListener(changeConfirmPswTextWatcher);
+    }
+
+    /**
+     * 杈撳叆鎵嬫満鍙锋垨鑰呴偖绠�
+     */
+    private final TextWatcher accountTextWatcher = new TextWatcher() {
+        @Override
+        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+
+        }
+
+        @Override
+        public void onTextChanged(CharSequence s, int start, int before, int count) {
+            isCompleteEnabled();
+        }
+
+        @Override
+        public void afterTextChanged(Editable s) {
+
+        }
+    };
+    /**
+     * 杈撳叆鎵嬫満楠岃瘉鐮�
+     */
+    private final TextWatcher phoneVerificationTextWatcher = new TextWatcher() {
+        @Override
+        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+
+        }
+
+        @Override
+        public void onTextChanged(CharSequence s, int start, int before, int count) {
+            isCompleteEnabled();
+        }
+
+        @Override
+        public void afterTextChanged(Editable s) {
+
+        }
+    };
+
+    /**
+     * 閭鑾峰彇楠岃瘉鐮�
+     */
+    private final TextWatcher mailVerificationTextWatcher = new TextWatcher() {
+        @Override
+        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+
+        }
+
+        @Override
+        public void onTextChanged(CharSequence s, int start, int before, int count) {
+            isCompleteEnabled();
+        }
+
+        @Override
+        public void afterTextChanged(Editable s) {
+
+        }
+    };
+
+    /**
+     * 杈撳叆瀵嗙爜
+     */
+    private final TextWatcher changePswTextWatcher = new TextWatcher() {
+        @Override
+        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+
+        }
+
+        @Override
+        public void onTextChanged(CharSequence s, int start, int before, int count) {
+            isCompleteEnabled();
+        }
+
+        @Override
+        public void afterTextChanged(Editable s) {
+
+        }
+    };
+    /**
+     * 杈撳叆纭瀵嗙爜
+     */
+    private final TextWatcher changeConfirmPswTextWatcher = new TextWatcher() {
+        @Override
+        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+
+        }
+
+        @Override
+        public void onTextChanged(CharSequence s, int start, int before, int count) {
+            isCompleteEnabled();
+        }
+
+        @Override
+        public void afterTextChanged(Editable s) {
+
+        }
+    };
+
+
 }
\ No newline at end of file

--
Gitblit v1.8.0