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/ChangePassword.java | 219 +++++++++++++++++++++++++++++++----------------------- 1 files changed, 124 insertions(+), 95 deletions(-) diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/account/ChangePassword.java b/app/src/main/java/com/hdl/photovoltaic/ui/account/ChangePassword.java index 84e6434..a83ca35 100644 --- a/app/src/main/java/com/hdl/photovoltaic/ui/account/ChangePassword.java +++ b/app/src/main/java/com/hdl/photovoltaic/ui/account/ChangePassword.java @@ -98,22 +98,7 @@ } }); //杈撳叆鎵嬫満鍙锋垨鑰呴偖绠� - viewBinding.changeAccountEt.addTextChangedListener(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) { - - } - }); + viewBinding.changeAccountEt.addTextChangedListener(accountTextWatcher); //鎵嬫満鍙疯幏鍙栭獙璇佺爜 viewBinding.changePhoneVerificationTv.setOnClickListener(new View.OnClickListener() { @Override @@ -123,22 +108,7 @@ } }); //杈撳叆鎵嬫満楠岃瘉鐮� - viewBinding.changePhoneVerificationEt.addTextChangedListener(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) { - - } - }); + viewBinding.changePhoneVerificationEt.addTextChangedListener(phoneVerificationTextWatcher); //閭鑾峰彇楠岃瘉鐮� viewBinding.changeMailVerificationTv.setOnClickListener(new View.OnClickListener() { @Override @@ -148,39 +118,9 @@ } }); //杈撳叆閭楠岃瘉鐮� - viewBinding.changeMailVerificationEt.addTextChangedListener(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) { - - } - }); + viewBinding.changeMailVerificationEt.addTextChangedListener(MailVerificationTextWatcher); //杈撳叆瀵嗙爜 - viewBinding.changePswEt.addTextChangedListener(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) { - - } - }); + viewBinding.changePswEt.addTextChangedListener(changePswTextWatcher); //瀵嗙爜鏄剧ず鎴栬�呴殣钘� viewBinding.changePswHideIv.setOnClickListener(new View.OnClickListener() { @Override @@ -202,22 +142,7 @@ } }); //杈撳叆纭瀵嗙爜 - viewBinding.changeConfirmPswEt.addTextChangedListener(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) { - - } - }); + viewBinding.changeConfirmPswEt.addTextChangedListener(changeConfirmPswTextWatcher); //纭瀵嗙爜鏄剧ず鎴栬�呴殣钘� viewBinding.changeConfirmPswHideIv.setOnClickListener(new View.OnClickListener() { @Override @@ -253,7 +178,7 @@ verification_code = viewBinding.changeMailVerificationEt.getText().toString(); } if (UserConfigManage.getInstance().isBAccount()) { - HdlAccountLogic.getInstance().changeBPassword(isPhoneType, account, psw, verification_code, new CloudCallBeak<Boolean>() { + HdlAccountLogic.getInstance().changePassword_B(isPhoneType, account, psw, verification_code, new CloudCallBeak<Boolean>() { @Override public void onSuccess(Boolean obj) { HdlThreadLogic.runMainThread(new Runnable() { @@ -274,11 +199,11 @@ @Override public void onFailure(HDLException e) { - + HdlThreadLogic.toast(_mActivity, e); } }); } else { - HdlAccountLogic.getInstance().changeCPassword(isPhoneType, account, psw, verification_code, new CloudCallBeak<Boolean>() { + HdlAccountLogic.getInstance().changePassword_C(isPhoneType, account, psw, verification_code, new CloudCallBeak<Boolean>() { @Override public void onSuccess(Boolean obj) { HdlThreadLogic.runMainThread(new Runnable() { @@ -299,7 +224,7 @@ @Override public void onFailure(HDLException e) { - + HdlThreadLogic.toast(_mActivity, e); } }); } @@ -342,14 +267,14 @@ @Override public void onFailure(HDLException e) { - + HdlThreadLogic.toast(_mActivity, e); } }); } @Override public void onFailure(HDLException e) { - + HdlThreadLogic.toast(_mActivity, e); // hideLoading(); } }); @@ -408,19 +333,19 @@ private void switchPhoneOrMailView() { if (isPhoneType) { //鎵嬫満鍙� - viewBinding.changePhoneIc.accountTitleTv.setText(R.string.home_login_鎵嬫満鍙�); + viewBinding.changePhoneIc.accountTitleTv.setText(R.string.home_login_phone); viewBinding.changePhoneIc.accountTitleTv.setTextSize(20); - viewBinding.changePhoneIc.accountTitleTv.setTextColor(getResources().getColor(R.color.text_90000000)); + viewBinding.changePhoneIc.accountTitleTv.setTextColor(getResources().getColor(R.color.text_E6000000)); viewBinding.changePhoneIc.lineV.setVisibility(View.VISIBLE); - viewBinding.changeMailRl.accountTitleTv.setText(R.string.home_login_閭); + viewBinding.changeMailRl.accountTitleTv.setText(R.string.home_login_email); viewBinding.changeMailRl.accountTitleTv.setTextSize(16); - viewBinding.changeMailRl.accountTitleTv.setTextColor(getResources().getColor(R.color.text_40000000)); + viewBinding.changeMailRl.accountTitleTv.setTextColor(getResources().getColor(R.color.text_66000000)); viewBinding.changeMailRl.lineV.setVisibility(View.GONE); //杈撳叆鎵嬫満鍙� viewBinding.changeAccountEt.setInputType(InputType.TYPE_CLASS_NUMBER); - viewBinding.changeAccountEt.setHint(R.string.home_login_璇疯緭鍏ユ墜鏈哄彿); + viewBinding.changeAccountEt.setHint(R.string.home_login_input_phone); //鏄剧ず鎵嬫満鍙烽獙璇佺爜锛岄殣钘忛偖绠遍獙璇佺爜, viewBinding.changePhoneVerificationCodeRl.setVisibility(View.VISIBLE); viewBinding.changeMailVerificationCodeRl.setVisibility(View.GONE); @@ -438,14 +363,14 @@ } else { //閭 - viewBinding.changePhoneIc.accountTitleTv.setText(R.string.home_login_鎵嬫満鍙�); + viewBinding.changePhoneIc.accountTitleTv.setText(R.string.home_login_phone); viewBinding.changePhoneIc.accountTitleTv.setTextSize(16); - viewBinding.changePhoneIc.accountTitleTv.setTextColor(getResources().getColor(R.color.text_40000000)); + viewBinding.changePhoneIc.accountTitleTv.setTextColor(getResources().getColor(R.color.text_66000000)); viewBinding.changePhoneIc.lineV.setVisibility(View.GONE); - viewBinding.changeMailRl.accountTitleTv.setText(R.string.home_login_閭); + viewBinding.changeMailRl.accountTitleTv.setText(R.string.home_login_email); viewBinding.changeMailRl.accountTitleTv.setTextSize(20); - viewBinding.changeMailRl.accountTitleTv.setTextColor(getResources().getColor(R.color.text_90000000)); + viewBinding.changeMailRl.accountTitleTv.setTextColor(getResources().getColor(R.color.text_E6000000)); viewBinding.changeMailRl.lineV.setVisibility(View.VISIBLE); //杈撳叆閭 viewBinding.changeAccountEt.setInputType(InputType.TYPE_CLASS_TEXT); @@ -522,5 +447,109 @@ mailCountDownTimer.cancel(); mailCountDownTimer = null; } + viewBinding.changeAccountEt.removeTextChangedListener(accountTextWatcher); + viewBinding.changePhoneVerificationEt.removeTextChangedListener(phoneVerificationTextWatcher); + viewBinding.changeMailVerificationEt.removeTextChangedListener(MailVerificationTextWatcher); + viewBinding.changePswEt.removeTextChangedListener(changePswTextWatcher); + viewBinding.changeConfirmPswEt.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