|
@@ -1,15 +1,19 @@
|
|
|
package com.cooleshow.usercenter.ui.activity;
|
|
|
|
|
|
+import android.content.Intent;
|
|
|
import android.os.Bundle;
|
|
|
import android.text.TextUtils;
|
|
|
import android.view.View;
|
|
|
|
|
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
|
|
import com.alibaba.android.arouter.launcher.ARouter;
|
|
|
+import com.cooleshow.base.common.AppManager;
|
|
|
import com.cooleshow.base.ui.activity.BaseMVPActivity;
|
|
|
import com.cooleshow.base.utils.ToastUtils;
|
|
|
import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
|
|
|
import com.cooleshow.provider.router.RouterPath;
|
|
|
+import com.cooleshow.usercenter.R;
|
|
|
+import com.cooleshow.usercenter.UserConstants;
|
|
|
import com.cooleshow.usercenter.bean.UserInfo;
|
|
|
import com.cooleshow.usercenter.databinding.ActivityVerifyCodeLoginBinding;
|
|
|
import com.cooleshow.usercenter.helper.PhoneCheckHelper;
|
|
@@ -23,7 +27,8 @@ import androidx.annotation.Nullable;
|
|
|
* Author by pq, Date on 2022/4/19.
|
|
|
*/
|
|
|
@Route(path = RouterPath.UserCenter.PATH_VERIFY_LOGIN)
|
|
|
-public class VerifyCodeLoginActivity extends BaseMVPActivity<ActivityVerifyCodeLoginBinding, VerifyLoginPresenter> {
|
|
|
+public class VerifyCodeLoginActivity extends BaseMVPActivity<ActivityVerifyCodeLoginBinding, VerifyLoginPresenter> implements View.OnClickListener {
|
|
|
+ public static final int LOGIN_STATUS_REQUEST_CODE = 10000002;
|
|
|
|
|
|
@Override
|
|
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
@@ -39,17 +44,8 @@ public class VerifyCodeLoginActivity extends BaseMVPActivity<ActivityVerifyCodeL
|
|
|
|
|
|
@Override
|
|
|
protected void initView() {
|
|
|
- viewBinding.tvSendVerifyCode.setOnClickListener(new View.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View v) {
|
|
|
- String phone = viewBinding.etPhoneNum.getText().toString();
|
|
|
- if (PhoneCheckHelper.checkPhoneValidity(phone)) {
|
|
|
- ARouter.getInstance().build(RouterPath.UserCenter.PATH_VERIFY_INPUT)
|
|
|
- .withString(VerifyCodeInputActivity.TARGET_PHONE, phone)
|
|
|
- .navigation();
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
+ viewBinding.tvSendVerifyCode.setOnClickListener(this);
|
|
|
+ viewBinding.tvLoginByCode.setOnClickListener(this);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -58,4 +54,38 @@ public class VerifyCodeLoginActivity extends BaseMVPActivity<ActivityVerifyCodeL
|
|
|
return new VerifyLoginPresenter();
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ if (v.getId() == R.id.tv_login_by_code) {
|
|
|
+ //密码登录
|
|
|
+ String phone = viewBinding.etPhoneNum.getText().toString();
|
|
|
+ ARouter.getInstance().build(RouterPath.UserCenter.PATH_LOGIN)
|
|
|
+ .withString(UserConstants.PHONE_NUM_KEY, phone).navigation(this, LOGIN_STATUS_REQUEST_CODE);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (v.getId() == R.id.tv_send_verify_code) {
|
|
|
+ //获取验证码
|
|
|
+ String phone = viewBinding.etPhoneNum.getText().toString();
|
|
|
+ if (PhoneCheckHelper.checkPhoneValidity(phone)) {
|
|
|
+ ARouter.getInstance().build(RouterPath.UserCenter.PATH_VERIFY_INPUT)
|
|
|
+ .withString(VerifyCodeInputActivity.TARGET_PHONE, phone)
|
|
|
+ .navigation(this, LOGIN_STATUS_REQUEST_CODE);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
|
|
+ super.onActivityResult(requestCode, resultCode, data);
|
|
|
+ if (resultCode == RESULT_OK) {
|
|
|
+ if (data != null && requestCode == LOGIN_STATUS_REQUEST_CODE) {
|
|
|
+ String status = data.getStringExtra(UserConstants.LOGIN_STATUS);
|
|
|
+ if (TextUtils.equals(status, UserConstants.LOGIN_STATUS_SUCCESS)) {
|
|
|
+ //跳转首页
|
|
|
+ ARouter.getInstance().build(RouterPath.APPCenter.PATH_HOME).navigation();
|
|
|
+ finish();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|