| | |
| | | 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.ActivityRegisterAccountBinding; |
| | | import com.hdl.photovoltaic.listener.CloudCallBeak; |
| | | import com.hdl.photovoltaic.other.HdlAccountLogic; |
| | |
| | | |
| | | |
| | | private void initView() { |
| | | //根据app语言默认服务器地址 |
| | | if (UserConfigManage.getInstance().isZh()) { |
| | | mUrl = "https://china-gateway.hdlcontrol.com"; |
| | | viewBinding.regionTv.setText("HDL China"); |
| | | } else { |
| | | viewBinding.regionTv.setText("HDL Bahrain"); |
| | | mUrl = "https://bahrain-gateway.hdlcontrol.com"; |
| | | } |
| | | switchPhoneOrEmailStyleView(); |
| | | try { |
| | | Country.load(this); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | private void initEvent() { |
| | |
| | | } else { |
| | | verification_code = viewBinding.registerMailVerificationEt.getText().toString(); |
| | | } |
| | | showLoading(); |
| | | HdlAccountLogic.getInstance().registerAccount_C(isPhoneType, account, psw, verification_code, new CloudCallBeak<Boolean>() { |
| | | @Override |
| | | public void onSuccess(Boolean obj) { |
| | | HdlThreadLogic.runMainThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | hideLoading(); |
| | | ConfirmationTipDialog dialog = new ConfirmationTipDialog(_mActivity); |
| | | dialog.show(); |
| | | dialog.setTitle(getString(R.string.home_account_registered_successfully)); |
| | | dialog.setYesOnclickListener(new ConfirmationCancelDialog.onYesOnclickListener() { |
| | | @Override |
| | | public void Confirm() { |
| | |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | hideLoading(); |
| | | HdlThreadLogic.tipFlashingBox(_mActivity, false, e.getMsg(), e.getCode()); |
| | | } |
| | | }); |
| | |
| | | HdlThreadLogic.toast(_mActivity, e); |
| | | } |
| | | }); |
| | | }else{ |
| | | } else { |
| | | HdlThreadLogic.toast(_mActivity, e); |
| | | } |
| | | |
| | |
| | | * 切换手机号或者邮箱的样式 |
| | | */ |
| | | private void switchPhoneOrEmailStyleView() { |
| | | |
| | | |
| | | if (isPhoneType) { |
| | | //手机号 |
| | | viewBinding.registerPhoneTitleIc.accountTitleTv.setText(R.string.home_login_phone); |
| | | viewBinding.registerPhoneTitleIc.accountTitleTv.setTextSize(20); |
| | | viewBinding.registerPhoneTitleIc.accountTitleTv.setTextColor(getResources().getColor(R.color.text_90000000, null)); |
| | | viewBinding.registerPhoneTitleIc.accountTitleTv.setTextColor(getResources().getColor(R.color.text_E6000000, null)); |
| | | viewBinding.registerPhoneTitleIc.lineV.setVisibility(View.VISIBLE); |
| | | |
| | | viewBinding.registerMailTitleIc.accountTitleTv.setText(R.string.home_login_email); |
| | | viewBinding.registerMailTitleIc.accountTitleTv.setTextSize(16); |
| | | viewBinding.registerMailTitleIc.accountTitleTv.setTextColor(getResources().getColor(R.color.text_40000000, null)); |
| | | viewBinding.registerMailTitleIc.accountTitleTv.setTextColor(getResources().getColor(R.color.text_66000000, null)); |
| | | viewBinding.registerMailTitleIc.lineV.setVisibility(View.GONE); |
| | | |
| | | //显示区号 |
| | | viewBinding.registerRegionAccountRl.setVisibility(View.VISIBLE); |
| | | //输入手机号 |
| | | viewBinding.registerAccountEt.setInputType(InputType.TYPE_CLASS_NUMBER); |
| | | viewBinding.registerAccountEt.setHint(R.string.home_login_input_phone); |
| | |
| | | //邮箱 |
| | | viewBinding.registerPhoneTitleIc.accountTitleTv.setText(R.string.home_login_phone); |
| | | viewBinding.registerPhoneTitleIc.accountTitleTv.setTextSize(16); |
| | | viewBinding.registerPhoneTitleIc.accountTitleTv.setTextColor(getResources().getColor(R.color.text_40000000, null)); |
| | | viewBinding.registerPhoneTitleIc.accountTitleTv.setTextColor(getResources().getColor(R.color.text_66000000, null)); |
| | | viewBinding.registerPhoneTitleIc.lineV.setVisibility(View.GONE); |
| | | |
| | | viewBinding.registerMailTitleIc.accountTitleTv.setText(R.string.home_login_email); |
| | | viewBinding.registerMailTitleIc.accountTitleTv.setTextSize(20); |
| | | viewBinding.registerMailTitleIc.accountTitleTv.setTextColor(getResources().getColor(R.color.text_90000000, null)); |
| | | viewBinding.registerMailTitleIc.accountTitleTv.setTextColor(getResources().getColor(R.color.text_E6000000, null)); |
| | | viewBinding.registerMailTitleIc.lineV.setVisibility(View.VISIBLE); |
| | | |
| | | //隐藏区号 |
| | | viewBinding.registerRegionAccountRl.setVisibility(View.GONE); |
| | | //输入邮箱 |
| | | viewBinding.registerAccountEt.setInputType(InputType.TYPE_CLASS_TEXT); |
| | | viewBinding.registerAccountEt.setHint(R.string.home_login_input_mail); |
| | |
| | | viewBinding.registerConfirmPswEt.setText(mMailConfirmPsw); |
| | | |
| | | } |
| | | isCompleteEnabled(); |
| | | try { |
| | | Country.load(this); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |