| | |
| | | |
| | | import androidx.appcompat.content.res.AppCompatResources; |
| | | |
| | | import android.graphics.drawable.Drawable; |
| | | import android.os.Bundle; |
| | | import android.text.Editable; |
| | | import android.text.TextUtils; |
| | |
| | | import com.hdl.photovoltaic.listener.CloudCallBeak; |
| | | import com.hdl.photovoltaic.other.HdlAccountLogic; |
| | | import com.hdl.photovoltaic.other.HdlThreadLogic; |
| | | import com.hdl.photovoltaic.widget.FlashingBoxDialog; |
| | | |
| | | /** |
| | | * 我的-修改密码-界面 |
| | |
| | | String newPsw = viewBinding.meChangePasswordNewIc.mePswEt.getText().toString().replaceAll(" +", ""); |
| | | String affirmPsw = viewBinding.meChangePasswordAffirmIc.mePswEt.getText().toString().replaceAll(" +", ""); |
| | | if (!isEditTextPassword(newPsw, affirmPsw)) { |
| | | tipFlashingBox(AppCompatResources.getDrawable(_mActivity, R.drawable.tip_fail), getString(R.string.home_login_input_unlike_psw), -1); |
| | | HdlThreadLogic.tipFlashingBox(_mActivity, true, getString(R.string.home_login_input_unlike_psw), -1); |
| | | return; |
| | | } |
| | | if (UserConfigManage.getInstance().isBAccount()) { |
| | |
| | | HdlAccountLogic.getInstance().updateBPassword(oldPsw, newPsw, new CloudCallBeak<String>() { |
| | | @Override |
| | | public void onSuccess(String str) { |
| | | tipFlashingBox(AppCompatResources.getDrawable(_mActivity, R.drawable.tip_succeed), getString(R.string.home_login_pws_reset_succeeded), 0); |
| | | HdlThreadLogic.tipFlashingBox(_mActivity, true, getString(R.string.home_login_pws_reset_succeeded), 0); |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | tipFlashingBox(AppCompatResources.getDrawable(_mActivity, R.drawable.tip_fail), e.getMsg(), e.getCode()); |
| | | HdlThreadLogic.tipFlashingBox(_mActivity, false, e.getMsg(), e.getCode()); |
| | | } |
| | | }); |
| | | } else { |
| | |
| | | HdlAccountLogic.getInstance().updateCPassword(oldPsw, newPsw, new CloudCallBeak<String>() { |
| | | @Override |
| | | public void onSuccess(String obj) { |
| | | tipFlashingBox(AppCompatResources.getDrawable(_mActivity, R.drawable.tip_succeed), getString(R.string.home_login_pws_reset_succeeded), 0); |
| | | HdlThreadLogic.tipFlashingBox(_mActivity, true, getString(R.string.home_login_pws_reset_succeeded), 0); |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | tipFlashingBox(AppCompatResources.getDrawable(_mActivity, R.drawable.tip_fail), e.getMsg(), e.getCode()); |
| | | HdlThreadLogic.tipFlashingBox(_mActivity, false, e.getMsg(), e.getCode()); |
| | | } |
| | | }); |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * 提示框 |
| | | * |
| | | * @param drawable 图标 |
| | | * @param msg 信息 |
| | | * @param code 状态 |
| | | */ |
| | | private void tipFlashingBox(Drawable drawable, String msg, int code) { |
| | | HdlThreadLogic.runMainThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | FlashingBoxDialog flashingBoxDialog = new FlashingBoxDialog(_mActivity); |
| | | flashingBoxDialog.setImage(drawable); |
| | | flashingBoxDialog.setContent(msg + "\r\n(" + code + ")"); |
| | | flashingBoxDialog.show(); |
| | | } |
| | | }, null, null); |
| | | } |
| | | |
| | | /** |
| | | * 初始化 |
| | | */ |
| | | private void initView() { |
| | | viewBinding.toolbarTopFragmentHouseListRl.topBarView.setBackgroundColor(getResources().getColor(R.color.text_FFFFFFFF)); |
| | | viewBinding.toolbarTopFragmentHouseListRl.topBarView.setBackgroundColor(getResources().getColor(R.color.text_FFFFFFFF,null)); |
| | | viewBinding.toolbarTopFragmentHouseListRl.topTitleTv.setText(R.string.home_login_change_password); |
| | | viewBinding.toolbarTopFragmentHouseListRl.topTitleTv.setTextColor(getResources().getColor(R.color.text_030D1C)); |
| | | viewBinding.toolbarTopFragmentHouseListRl.topTitleTv.setTextColor(getResources().getColor(R.color.text_030D1C,null)); |
| | | viewBinding.toolbarTopFragmentHouseListRl.topBackBtn.setVisibility(View.VISIBLE); |
| | | viewBinding.meChangePasswordOldIc.mePswTitleTv.setText(R.string.home_login_old_pws); |
| | | viewBinding.meChangePasswordOldIc.mePswEt.setHint(R.string.home_login_input_old_pws); |