| | |
| | | |
| | | import android.os.Bundle; |
| | | import android.os.CountDownTimer; |
| | | import android.text.Editable; |
| | | import android.text.TextUtils; |
| | | import android.text.TextWatcher; |
| | | import android.view.View; |
| | | |
| | | import com.hdl.linkpm.sdk.core.exception.HDLException; |
| | |
| | | |
| | | @Override |
| | | public void onBindView(Bundle savedInstanceState) { |
| | | setNotificationBarBackgroundColor(CustomColor.white); |
| | | setStatusBarTextColor(); |
| | | setStatusBarTranslucent(); |
| | | //初始化 |
| | | initView(); |
| | | //初始化界面监听器 |
| | |
| | | |
| | | private void initEvent() { |
| | | |
| | | viewBinding.toolbarTopFragmentHouseListRl.topBackBtn.setOnClickListener(new View.OnClickListener() { |
| | | viewBinding.toolbarTopRl.topBackLl.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | setResult(20); |
| | |
| | | viewBinding.bindPhoneEt.setText(""); |
| | | } |
| | | }); |
| | | |
| | | //输入账号 |
| | | viewBinding.bindPhoneEt.addTextChangedListener(accountTextWatcher); |
| | | //输入验证码 |
| | | viewBinding.changePhoneVerificationEt.addTextChangedListener(verificationCodeTextWatcher); |
| | | viewBinding.bindPhoneTv.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | if (isLocalCheck()) { |
| | | if (isEnabled()) { |
| | | String phoneStr = viewBinding.bindPhoneEt.getText().toString(); |
| | | String verificationStr = viewBinding.changePhoneVerificationEt.getText().toString(); |
| | | HdlAccountLogic.getInstance().bindingAccount_C(phoneStr, "", verificationStr, new CloudCallBeak<Boolean>() { |
| | |
| | | } |
| | | |
| | | private void initView() { |
| | | viewBinding.toolbarTopFragmentHouseListRl.topTitleTv.setText(R.string.set_change_bind_phone_number); |
| | | viewBinding.toolbarTopFragmentHouseListRl.topTitleTv.setTextColor(getResources().getColor(R.color.text_030D1C, null)); |
| | | viewBinding.toolbarTopFragmentHouseListRl.topBackBtn.setVisibility(View.VISIBLE); |
| | | viewBinding.toolbarTopFragmentHouseListRl.topBarView.setBackgroundColor(getResources().getColor(R.color.text_FFFFFFFF, null)); |
| | | 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); |
| | | } catch (Exception e) { |
| | |
| | | public void onPick(Country country) { |
| | | if (country.flag != 0) |
| | | viewBinding.bindAreaTv.setText(country.name); |
| | | viewBinding.bindAreaNumberTv.setText("+" + country.code); |
| | | String code = "+" + country.code; |
| | | viewBinding.bindAreaNumberTv.setText(code); |
| | | } |
| | | }); |
| | | dialog.show(); |
| | |
| | | long time = (millisUntilFinished / 1000); |
| | | String str = time + "s" + getString(R.string.home_login_psw_verification_repeater); |
| | | viewBinding.bindPhoneVerificationTv.setText(str); |
| | | viewBinding.bindPhoneVerificationTv.setTextColor(getResources().getColor(R.color.text_25000000, null)); |
| | | viewBinding.bindPhoneVerificationTv.setEnabled(false); |
| | | |
| | | } |
| | |
| | | @Override |
| | | public void onFinish() { |
| | | viewBinding.bindPhoneVerificationTv.setText(getString(R.string.home_login_verification_regain)); |
| | | viewBinding.bindPhoneVerificationTv.setTextColor(getResources().getColor(R.color.text_245EC3, null)); |
| | | viewBinding.bindPhoneVerificationTv.setEnabled(true); |
| | | |
| | | |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 检测清除图标是否显示 |
| | | */ |
| | | private void checkClearIconShowOrNot(String s) { |
| | | if (s.replace(" ", "").length() > 0) { |
| | | if (viewBinding.bindPhoneClearIv.getVisibility() == View.GONE) { |
| | | viewBinding.bindPhoneClearIv.setVisibility(View.VISIBLE); |
| | | } |
| | | } else { |
| | | if (viewBinding.bindPhoneClearIv.getVisibility() == View.VISIBLE) { |
| | | viewBinding.bindPhoneClearIv.setVisibility(View.GONE); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 校验确认按钮是否启用 |
| | | */ |
| | | private boolean isEnabled() { |
| | | String account = viewBinding.bindPhoneEt.getText().toString().replace(" ", ""); |
| | | 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)); |
| | | } else { |
| | | viewBinding.bindPhoneTv.setTextColor(getColor(R.color.text_66FFFFFF)); |
| | | } |
| | | viewBinding.bindPhoneTv.setEnabled(isEnabled); |
| | | return isEnabled; |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 本地校验 |
| | |
| | | HdlThreadLogic.tipFlashingBox(this, false, getString(R.string.home_login_null_verification_code), -1); |
| | | return false; |
| | | } |
| | | |
| | | return true; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 输入账号 |
| | | */ |
| | | private final TextWatcher accountTextWatcher = new TextWatcher() { |
| | | @Override |
| | | public void beforeTextChanged(CharSequence s, int start, int count, int after) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onTextChanged(CharSequence s, int start, int before, int count) { |
| | | } |
| | | |
| | | @Override |
| | | public void afterTextChanged(Editable s) { |
| | | checkClearIconShowOrNot(s.toString()); |
| | | isEnabled(); |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 输入验证码 |
| | | */ |
| | | private final TextWatcher verificationCodeTextWatcher = new TextWatcher() { |
| | | @Override |
| | | public void beforeTextChanged(CharSequence s, int start, int count, int after) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onTextChanged(CharSequence s, int start, int before, int count) { |
| | | } |
| | | |
| | | @Override |
| | | public void afterTextChanged(Editable s) { |
| | | isEnabled(); |
| | | } |
| | | }; |
| | | |
| | | @Override |
| | | protected void onDestroy() { |
| | |
| | | countDownTimer.cancel(); |
| | | countDownTimer = null; |
| | | } |
| | | viewBinding.bindPhoneEt.removeTextChangedListener(accountTextWatcher); |
| | | viewBinding.changePhoneVerificationEt.removeTextChangedListener(verificationCodeTextWatcher); |
| | | |
| | | } |
| | | |