From 68db344081c103c94832b8d0a06be6c6888d66e4 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期三, 26 三月 2025 17:34:14 +0800 Subject: [PATCH] 2025年03月26日17:34:12 --- app/src/main/java/com/hdl/photovoltaic/ui/account/ChangePassword.java | 77 ++++++++++++++++++++++++++++++-------- 1 files changed, 60 insertions(+), 17 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 2bca9c2..481a171 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 @@ -27,10 +27,12 @@ import com.hdl.photovoltaic.config.AppConfigManage; import com.hdl.photovoltaic.config.UserConfigManage; import com.hdl.photovoltaic.databinding.ActivityChangePasswordBinding; +import com.hdl.photovoltaic.enums.VerifyType; import com.hdl.photovoltaic.listener.CloudCallBeak; import com.hdl.photovoltaic.other.HdlAccountLogic; import com.hdl.photovoltaic.other.HdlCommonLogic; import com.hdl.photovoltaic.other.HdlThreadLogic; +import com.hdl.photovoltaic.utils.GPSManagerUtils; import com.hdl.photovoltaic.widget.ConfirmationCancelDialog; import com.hdl.photovoltaic.widget.ConfirmationTipDialog; import com.sahooz.library.countrypicker.Country; @@ -75,9 +77,28 @@ * 鍒濆鍖栫晫闈� */ private void initView() { + if (UserConfigManage.getInstance().isZh()) { + viewBinding.regionAccountTv.setText(getText(R.string.home_chinese_mainland)); + viewBinding.regionAccountNumberTv.setText("+86"); + } else { + viewBinding.regionAccountTv.setText(getText(R.string.iraq)); + viewBinding.regionAccountNumberTv.setText("+964"); + } switchPhoneOrMailView(); try { Country.load(this); + Country country = null; + if (TextUtils.isEmpty(GPSManagerUtils.getInstance().getCountryCode(this))) { + //鍐嶆牴鎹郴缁熻瑷� + country = Country.getCountryInfo(); + } else { + //鍏堟牴鎹畾浣� + country = Country.getLocationCountryInfo(GPSManagerUtils.getInstance().getCountryCode(this)); + } + if (country != null) { + viewBinding.regionAccountTv.setText(country.translate); + viewBinding.regionAccountNumberTv.setText("+" + country.code); + } } catch (Exception e) { e.printStackTrace(); } @@ -205,7 +226,7 @@ verification_code = viewBinding.changeMailVerificationEt.getText().toString(); } if (UserConfigManage.getInstance().isBAccount()) { - HdlAccountLogic.getInstance().changePassword_B(isPhoneType, account, psw, verification_code, new CloudCallBeak<Boolean>() { + HdlAccountLogic.getInstance().changePassword_B(isPhoneType, account, psw, verification_code, viewBinding.regionAccountNumberTv.getText().toString(), new CloudCallBeak<Boolean>() { @Override public void onSuccess(Boolean obj) { HdlThreadLogic.runMainThread(new Runnable() { @@ -230,7 +251,7 @@ } }); } else { - HdlAccountLogic.getInstance().changePassword_C(isPhoneType, account, psw, verification_code, new CloudCallBeak<Boolean>() { + HdlAccountLogic.getInstance().changePassword_C(isPhoneType, account, psw, verification_code, viewBinding.regionAccountNumberTv.getText().toString(), new CloudCallBeak<Boolean>() { @Override public void onSuccess(Boolean obj) { HdlThreadLogic.runMainThread(new Runnable() { @@ -267,7 +288,7 @@ CountryPickerFragment dialog = new CountryPickerFragment(this, new PickCountryCallback() { @Override public void onPick(Country country) { - if (country.flag != 0) viewBinding.regionAccountTv.setText(country.name); + if (country.flag != 0) viewBinding.regionAccountTv.setText(country.translate); viewBinding.regionAccountNumberTv.setText("+" + country.code); } }); @@ -297,21 +318,43 @@ //璁剧疆璐﹀彿鎵�鍦ㄥ尯鍩熷崗璁強鍦板潃 AppConfigManage.setUserRegionUrl(obj.getRegionUrl()); HDLLinkPMUser.getInstance().setUserRegionUrl(AppConfigManage.getUserRegionUrl()); - HdlAccountLogic.getInstance().sendVerifyCode(isPhoneType, account, viewBinding.regionAccountNumberTv.getText().toString(), 2, 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); - } - }); + + if (UserConfigManage.getInstance().isBAccount()) { + //B绔彂閫佽幏鍙栭獙璇佺爜 + HdlAccountLogic.getInstance().sendVerifyCode_B(isPhoneType, account, viewBinding.regionAccountNumberTv.getText().toString(), VerifyType.VerifyType_FIND_PASSWORD, 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 { + //C绔彂閫佽幏鍙栭獙璇佺爜 + HdlAccountLogic.getInstance().sendVerifyCode_C(isPhoneType, account, viewBinding.regionAccountNumberTv.getText().toString(), VerifyType.VerifyType_2, 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); + } + }); + } } @Override -- Gitblit v1.8.0