| | |
| | | package com.hdl.photovoltaic.ui.account; |
| | | |
| | | |
| | | import android.Manifest; |
| | | import android.content.Context; |
| | | import android.content.pm.PackageManager; |
| | | import android.os.Bundle; |
| | | import android.os.CountDownTimer; |
| | | import android.telephony.TelephonyManager; |
| | | import android.text.Editable; |
| | | import android.text.InputType; |
| | | import android.text.TextUtils; |
| | |
| | | |
| | | import androidx.appcompat.content.res.AppCompatResources; |
| | | import androidx.constraintlayout.widget.ConstraintSet; |
| | | import androidx.core.content.ContextCompat; |
| | | |
| | | import com.hdl.linkpm.sdk.core.exception.HDLException; |
| | | import com.hdl.linkpm.sdk.user.HDLLinkPMUser; |
| | |
| | | import com.hdl.photovoltaic.other.HdlLogLogic; |
| | | import com.hdl.photovoltaic.other.HdlThreadLogic; |
| | | import com.hdl.photovoltaic.utils.KeyboardStateObserverUtils; |
| | | import com.hdl.photovoltaic.utils.LocalManageUtil; |
| | | import com.hdl.photovoltaic.widget.ConfirmationCancelDialog; |
| | | import com.hdl.photovoltaic.widget.ConfirmationTipDialog; |
| | | import com.hdl.photovoltaic.widget.ListDialog; |
| | | import com.hdl.photovoltaic.widget.ListStaticDialog; |
| | | import com.sahooz.library.countrypicker.Country; |
| | | import com.sahooz.library.countrypicker.CountryPickerFragment; |
| | | import com.sahooz.library.countrypicker.PickCountryCallback; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Locale; |
| | | |
| | | /** |
| | | * 注册账号界面 |
| | |
| | | finish(); |
| | | } |
| | | }); |
| | | //服务器选择 |
| | | viewBinding.registerRegionServerRl.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | ListDialog listDialog = new ListDialog(_mActivity); |
| | | ListStaticDialog listDialog = new ListStaticDialog(_mActivity); |
| | | listDialog.show(); |
| | | listDialog.setOnHDLChinaOnListener(new ListDialog.onHDLChinaListener() { |
| | | listDialog.setOnHDLChinaOnListener(new ListStaticDialog.onHDLChinaListener() { |
| | | @Override |
| | | public void HDLChina() { |
| | | mUrl = "https://china-gateway.hdlcontrol.com"; |
| | |
| | | |
| | | } |
| | | }); |
| | | listDialog.setOnHDLBahrainListener(new ListDialog.onHDLBahrainListener() { |
| | | listDialog.setOnHDLBahrainListener(new ListStaticDialog.onHDLBahrainListener() { |
| | | @Override |
| | | public void HDLBahrain() { |
| | | mUrl = "https://bahrain-gateway.hdlcontrol.com"; |
| | |
| | | }); |
| | | } |
| | | }); |
| | | //手机区号选择 |
| | | viewBinding.registerRegionAccountRl.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | selectArea(); |
| | | } |
| | | }); |
| | | |
| | | //切换手机号 |
| | | viewBinding.registerPhoneTitleIc.underlineCl.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 发送验证码指令 |
| | | */ |
| | |
| | | mUrl = "https://test-gz.hdlcontrol.com"; |
| | | } |
| | | HDLLinkPMUser.getInstance().setUserRegionUrl(mUrl); |
| | | HdlAccountLogic.getInstance().sendVerifyCode(isPhoneType, account, "86", 1, new CloudCallBeak<Boolean>() { |
| | | HdlAccountLogic.getInstance().sendVerifyCode(isPhoneType, account, viewBinding.regionAccountNumberTv.getText().toString(), 1, new CloudCallBeak<Boolean>() { |
| | | @Override |
| | | public void onSuccess(Boolean obj) { |
| | | if (isPhoneType) { |
| | |
| | | }); |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 初始化手机号计时器 |
| | |
| | | |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 国家手机号区号弹窗 |
| | | */ |
| | | private void selectArea() { |
| | | CountryPickerFragment dialog = new CountryPickerFragment(this, new PickCountryCallback() { |
| | | @Override |
| | | public void onPick(Country country) { |
| | | if (country.flag != 0) |
| | | viewBinding.regionAccountTv.setText(country.name); |
| | | viewBinding.regionAccountNumberTv.setText("+" + country.code); |
| | | } |
| | | }); |
| | | dialog.show(); |
| | | dialog.setDialogSize(); |
| | | } |
| | | |
| | | /** |
| | | * 切换手机号或者邮箱的样式 |
| | |
| | | |
| | | } |
| | | isCompleteEnabled(); |
| | | try { |
| | | Country.load(this); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | @Override |
| | | protected void onDestroy() { |
| | | super.onDestroy(); |
| | | Country.destroy(); |
| | | if (phoneCountDownTimer != null) { |
| | | phoneCountDownTimer.cancel(); |
| | | phoneCountDownTimer = null; |
| | |
| | | |
| | | } |
| | | }; |
| | | |
| | | |
| | | } |