mac
2023-12-22 c48f6e1e7f7fc4ca3db8ecadf441d6da942ceb8f
app/src/main/java/com/hdl/photovoltaic/ui/me/MeChangePasswordActivity.java
@@ -13,6 +13,7 @@
import android.widget.ImageView;
import com.hdl.linkpm.sdk.core.exception.HDLException;
import com.hdl.linkpm.sdk.user.HDLLinkPMUser;
import com.hdl.photovoltaic.R;
import com.hdl.photovoltaic.base.CustomBaseActivity;
import com.hdl.photovoltaic.config.UserConfigManage;
@@ -20,6 +21,7 @@
import com.hdl.photovoltaic.listener.CloudCallBeak;
import com.hdl.photovoltaic.other.HdlAccountLogic;
import com.hdl.photovoltaic.other.HdlThreadLogic;
import com.hdl.photovoltaic.widget.ConfirmationCancelDialog;
/**
 * 我的-修改密码-界面
@@ -36,7 +38,8 @@
    @Override
    public void onBindView(Bundle savedInstanceState) {
        setNotificationBarBackgroundColor(CustomColor.white);
        setStatusBarTextColor();
        //初始化
        initView();
        //初始化界面监听器
@@ -85,7 +88,24 @@
        viewBinding.homeAffirmTv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                sendChangePassword();
                // 二次确认提示框
                ConfirmationCancelDialog dialog = new ConfirmationCancelDialog(_mActivity);
                dialog.setTitle(getString(R.string.loading_title_tip));
                dialog.setContent("密码修改成功,将重新登录.");
                dialog.show();
                dialog.setYesOnclickListener(new ConfirmationCancelDialog.onYesOnclickListener() {
                    @Override
                    public void Confirm() {
                        sendChangePassword();
                    }
                });
                dialog.setNoOnclickListener(new ConfirmationCancelDialog.onNoOnclickListener() {
                    @Override
                    public void Cancel() {
                        dialog.dismiss();
                    }
                });
            }
        });
    }
@@ -97,16 +117,27 @@
        String oldPsw = viewBinding.meChangePasswordOldIc.mePswEt.getText().toString().replaceAll(" +", "");
        String newPsw = viewBinding.meChangePasswordNewIc.mePswEt.getText().toString().replaceAll(" +", "");
        String affirmPsw = viewBinding.meChangePasswordAffirmIc.mePswEt.getText().toString().replaceAll(" +", "");
        if (isEditTextPassword(oldPsw, newPsw) || isEditTextPassword(oldPsw, affirmPsw)) {
            HdlThreadLogic.tipFlashingBox(_mActivity, true, "原密码和新密码不能一样.", -1);
            return;
        }
        if (newPsw.length() < 6 || affirmPsw.length() < 6) {
            HdlThreadLogic.tipFlashingBox(_mActivity, true, getString(R.string.home_login_least6), -1);
            return;
        }
        if (!isEditTextPassword(newPsw, affirmPsw)) {
            HdlThreadLogic.tipFlashingBox(_mActivity, true, getString(R.string.home_login_input_unlike_psw), -1);
            return;
        }
        if (UserConfigManage.getInstance().isBAccount()) {
            //B端更改个人密码
            HdlAccountLogic.getInstance().updateBPassword(oldPsw, newPsw, new CloudCallBeak<String>() {
            HdlAccountLogic.getInstance().updatePassword_B(oldPsw, newPsw, new CloudCallBeak<String>() {
                @Override
                public void onSuccess(String str) {
                    HdlThreadLogic.tipFlashingBox(_mActivity, true, getString(R.string.home_login_pws_reset_succeeded), 0);
//                    HdlThreadLogic.tipFlashingBox(_mActivity, true, getString(R.string.home_login_pws_reset_succeeded), 0);
                    HDLLinkPMUser.getInstance().logout(0);
                }
                @Override
@@ -116,10 +147,13 @@
            });
        } else {
            //C端更改个人密码
            HdlAccountLogic.getInstance().updateCPassword(oldPsw, newPsw, new CloudCallBeak<String>() {
            HdlAccountLogic.getInstance().updatePassword_C(oldPsw, newPsw, new CloudCallBeak<String>() {
                @Override
                public void onSuccess(String obj) {
                    HdlThreadLogic.tipFlashingBox(_mActivity, true, getString(R.string.home_login_pws_reset_succeeded), 0);
                    HDLLinkPMUser.getInstance().logout(0);
                }
                @Override