更新
This commit is contained in:
@@ -41,6 +41,7 @@ public class LoginActivity extends BaseActivity<LoginLayoutBinding, LoginPresent
|
||||
private LoginCodeCountdown mCountdown;
|
||||
private boolean verification;
|
||||
private boolean requestingCode;
|
||||
private boolean submittingLogin;
|
||||
|
||||
@Override
|
||||
public LoginPresenter createPresenter() {
|
||||
@@ -72,6 +73,7 @@ public class LoginActivity extends BaseActivity<LoginLayoutBinding, LoginPresent
|
||||
@OnClick({R.id.tv_login_confirm, R.id.tv_get_code, R.id.tv_country_code,
|
||||
R.id.ll_email_login, R.id.tv_login_language})
|
||||
public void onClick(View v) {
|
||||
if (requestingCode || submittingLogin) return;
|
||||
switch (v.getId()) {
|
||||
case R.id.tv_country_code:
|
||||
showCountryCodeDialog();
|
||||
@@ -116,6 +118,7 @@ public class LoginActivity extends BaseActivity<LoginLayoutBinding, LoginPresent
|
||||
}
|
||||
|
||||
private void submitLogin() {
|
||||
if (submittingLogin || requestingCode) return;
|
||||
String phone = getValidatedPhone();
|
||||
if (phone == null) return;
|
||||
String code = viewBinding.edCodeInput.getText().toString().trim();
|
||||
@@ -127,12 +130,14 @@ public class LoginActivity extends BaseActivity<LoginLayoutBinding, LoginPresent
|
||||
showError(getString(R.string.login_code_invalid));
|
||||
return;
|
||||
}
|
||||
submittingLogin = true;
|
||||
viewBinding.tvLoginConfirm.setEnabled(false);
|
||||
showLoadingDialog();
|
||||
mPresenter.loginBySmsCode(phone, code);
|
||||
}
|
||||
|
||||
private void getPhoneCode() {
|
||||
if (requestingCode || mCountdown.getDeadline() != 0) return;
|
||||
if (requestingCode || submittingLogin || mCountdown.getDeadline() != 0) return;
|
||||
String phone = getValidatedPhone();
|
||||
if (phone == null) return;
|
||||
requestingCode = true;
|
||||
@@ -213,6 +218,8 @@ public class LoginActivity extends BaseActivity<LoginLayoutBinding, LoginPresent
|
||||
@Override
|
||||
public void showError(String message) {
|
||||
requestingCode = false;
|
||||
submittingLogin = false;
|
||||
viewBinding.tvLoginConfirm.setEnabled(true);
|
||||
hideDialogLoading();
|
||||
ToastUtil.showShort(mContext, message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user