From f50e8e60e9da99e4f69d8ab76810dc7e5fb448bc Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期一, 02 十二月 2024 10:29:09 +0800 Subject: [PATCH] 2024年12月02日10:29:05 --- app/src/main/java/com/hdl/photovoltaic/ui/account/ChangePassword.java | 292 +++++++++++++++++++++++++++++++++++----------------------- 1 files changed, 177 insertions(+), 115 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 b60bbd8..af28218 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 @@ -1,6 +1,6 @@ package com.hdl.photovoltaic.ui.account; -import android.app.AppComponentFactory; + import android.os.Bundle; import android.os.CountDownTimer; import android.text.Editable; @@ -11,7 +11,7 @@ import android.text.method.PasswordTransformationMethod; import android.view.View; -import androidx.appcompat.app.AppCompatActivity; + import androidx.appcompat.content.res.AppCompatResources; import com.hdl.linkpm.sdk.core.exception.HDLException; @@ -20,6 +20,7 @@ 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.ActivityChangePasswordBinding; import com.hdl.photovoltaic.listener.CloudCallBeak; import com.hdl.photovoltaic.other.HdlAccountLogic; @@ -28,7 +29,7 @@ import com.hdl.photovoltaic.widget.ConfirmationTipDialog; /** - * 淇敼璐﹀彿鐣岄潰 + * 蹇樿瀵嗙爜鐣岄潰 */ public class ChangePassword extends CustomBaseActivity { ActivityChangePasswordBinding viewBinding; @@ -53,6 +54,7 @@ @Override public void onBindView(Bundle savedInstanceState) { + setStatusBarTranslucent(); //鍒濆鍖� initView(); //鍒濆鍖栫晫闈㈢洃鍚櫒 @@ -97,22 +99,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 @@ -122,22 +109,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 @@ -147,39 +119,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 @@ -201,22 +143,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 @@ -251,30 +178,57 @@ } else { verification_code = viewBinding.changeMailVerificationEt.getText().toString(); } - HdlAccountLogic.getInstance().changePassword(isPhoneType, account, psw, verification_code, new CloudCallBeak<Boolean>() { - @Override - public void onSuccess(Boolean obj) { - HdlThreadLogic.runMainThread(new Runnable() { - @Override - public void run() { - ConfirmationTipDialog dialog = new ConfirmationTipDialog(_mActivity); - dialog.show(); - dialog.setYesOnclickListener(new ConfirmationCancelDialog.onYesOnclickListener() { - @Override - public void Confirm() { - finish(); - } - }); - } - }, null, null); + if (UserConfigManage.getInstance().isBAccount()) { + HdlAccountLogic.getInstance().changePassword_B(isPhoneType, account, psw, verification_code, new CloudCallBeak<Boolean>() { + @Override + public void onSuccess(Boolean obj) { + HdlThreadLogic.runMainThread(new Runnable() { + @Override + public void run() { + ConfirmationTipDialog dialog = new ConfirmationTipDialog(_mActivity); + dialog.show(); + dialog.setYesOnclickListener(new ConfirmationCancelDialog.onYesOnclickListener() { + @Override + public void Confirm() { + finish(); + } + }); + } + }, null, null); - } + } - @Override - public void onFailure(HDLException e) { + @Override + public void onFailure(HDLException e) { + HdlThreadLogic.toast(_mActivity, e); + } + }); + } else { + HdlAccountLogic.getInstance().changePassword_C(isPhoneType, account, psw, verification_code, new CloudCallBeak<Boolean>() { + @Override + public void onSuccess(Boolean obj) { + HdlThreadLogic.runMainThread(new Runnable() { + @Override + public void run() { + ConfirmationTipDialog dialog = new ConfirmationTipDialog(_mActivity); + dialog.show(); + dialog.setYesOnclickListener(new ConfirmationCancelDialog.onYesOnclickListener() { + @Override + public void Confirm() { + finish(); + } + }); + } + }, null, null); - } - }); + } + + @Override + public void onFailure(HDLException e) { + HdlThreadLogic.toast(_mActivity, e); + } + }); + } } }); @@ -294,9 +248,12 @@ } return; } + //鑾峰彇璐﹀彿鍖哄煙淇℃伅 HdlAccountLogic.getInstance().regionByAccount(account, new CloudCallBeak<HDLUserRegionBean>() { + //鍙戦�佹秷鎭獙璇佺爜 @Override public void onSuccess(HDLUserRegionBean obj) { + //璁剧疆璐﹀彿鎵�鍦ㄥ尯鍩熷崗璁強鍦板潃 AppConfigManage.setUserRegionUrl(obj.getRegionUrl()); HDLLinkPMUser.getInstance().setUserRegionUrl(AppConfigManage.getUserRegionUrl()); HdlAccountLogic.getInstance().sendVerifyCode(isPhoneType, account, "86", 2, new CloudCallBeak<Boolean>() { @@ -311,14 +268,15 @@ @Override public void onFailure(HDLException e) { - + HdlThreadLogic.toast(_mActivity, e); } }); } @Override public void onFailure(HDLException e) { - hideLoading(); + HdlThreadLogic.toast(_mActivity, e); +// hideLoading(); } }); } @@ -376,19 +334,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); @@ -406,14 +364,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); @@ -490,5 +448,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