| | |
| | | import com.hdl.photovoltaic.base.CustomBaseActivity; |
| | | import com.hdl.photovoltaic.config.UserConfigManage; |
| | | import com.hdl.photovoltaic.databinding.ActivityBindPhoneBinding; |
| | | 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.HdlLogLogic; |
| | | import com.hdl.photovoltaic.other.HdlThreadLogic; |
| | | import com.hdl.photovoltaic.utils.GPSManagerUtils; |
| | | import com.sahooz.library.countrypicker.Country; |
| | | import com.sahooz.library.countrypicker.CountryPickerFragment; |
| | | import com.sahooz.library.countrypicker.PickCountryCallback; |
| | |
| | | if (isEnabled()) { |
| | | String phoneStr = viewBinding.bindPhoneEt.getText().toString(); |
| | | String verificationStr = viewBinding.changePhoneVerificationEt.getText().toString(); |
| | | HdlAccountLogic.getInstance().bindingAccount_C(phoneStr, "", verificationStr, new CloudCallBeak<Boolean>() { |
| | | HdlAccountLogic.getInstance().bindingAccount_C(phoneStr, "", verificationStr, viewBinding.bindAreaNumberTv.getText().toString(), new CloudCallBeak<Boolean>() { |
| | | @Override |
| | | public void onSuccess(Boolean obj) { |
| | | UserConfigManage.getInstance().setBingPhone(phoneStr); |
| | |
| | | } |
| | | |
| | | private void initView() { |
| | | if (UserConfigManage.getInstance().isZh()) { |
| | | viewBinding.bindAreaTv.setText(getText(R.string.home_chinese_mainland)); |
| | | viewBinding.bindAreaNumberTv.setText("+86"); |
| | | } else { |
| | | viewBinding.bindAreaTv.setText(getText(R.string.iraq)); |
| | | viewBinding.bindAreaNumberTv.setText("+964"); |
| | | } |
| | | viewBinding.toolbarTopRl.topTitleTv.setText(R.string.set_change_bind_phone_number); |
| | | viewBinding.toolbarTopRl.topBackLl.setVisibility(View.VISIBLE); |
| | | checkClearIconShowOrNot(viewBinding.bindPhoneEt.getText().toString()); |
| | | 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.bindAreaTv.setText(country.translate); |
| | | viewBinding.bindAreaNumberTv.setText("+" + country.code); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | HdlCommonLogic.getInstance().setSpan(viewBinding.bindPhoneVerificationTv, viewBinding.bindPhoneVerificationTv.getText().toString(), true, null); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Override |
| | | public void onPick(Country country) { |
| | | if (country.flag != 0) |
| | | viewBinding.bindAreaTv.setText(country.name); |
| | | viewBinding.bindAreaTv.setText(country.translate); |
| | | String code = "+" + country.code; |
| | | viewBinding.bindAreaNumberTv.setText(code); |
| | | } |
| | |
| | | HdlThreadLogic.tipFlashingBox(this, false, getString(R.string.home_login_phone_null), -1); |
| | | return; |
| | | } |
| | | HdlAccountLogic.getInstance().sendVerifyCode(true, account, viewBinding.bindAreaNumberTv.getText().toString(), 3, new CloudCallBeak<Boolean>() { |
| | | HdlAccountLogic.getInstance().sendVerifyCode_C(true, account, viewBinding.bindAreaNumberTv.getText().toString(), VerifyType.VerifyType_3, new CloudCallBeak<Boolean>() { |
| | | @Override |
| | | public void onSuccess(Boolean obj) { |
| | | countDownTimer.start(); |
| | |
| | | String verificationCode = viewBinding.changePhoneVerificationEt.getText().toString().replace(" ", ""); |
| | | boolean isEnabled = account.length() > 0 && verificationCode.length() > 0; |
| | | if (isEnabled) { |
| | | viewBinding.bindPhoneTv.setTextColor(getColor(R.color.text_E6FFFFFF)); |
| | | viewBinding.bindPhoneTv.setTextColor(getColor(R.color.text_FFACACAC)); |
| | | } else { |
| | | viewBinding.bindPhoneTv.setTextColor(getColor(R.color.text_66FFFFFF)); |
| | | viewBinding.bindPhoneTv.setTextColor(getColor(R.color.text_FF5B5B5B)); |
| | | } |
| | | viewBinding.bindPhoneTv.setEnabled(isEnabled); |
| | | return isEnabled; |