...
|
...
|
@@ -3,7 +3,7 @@ package com.hh.xuetubao.activity.login; |
|
|
import android.content.Intent;
|
|
|
import android.os.Bundle;
|
|
|
import android.os.CountDownTimer;
|
|
|
import android.util.Log;
|
|
|
import android.text.TextUtils;
|
|
|
import android.view.View;
|
|
|
import android.widget.EditText;
|
|
|
import android.widget.ImageView;
|
...
|
...
|
@@ -52,6 +52,12 @@ public class LoginActivity extends BaseMvpActivity<CommonPresenter, AccountModel |
|
|
tvYanzheng.setOnClickListener(this);
|
|
|
imgWechat.setOnClickListener(this);
|
|
|
imgJigou.setOnClickListener(this);
|
|
|
|
|
|
String accountOid = SharedPrefrenceUtils.getString(this, "AccountOid");
|
|
|
if (!TextUtils.isEmpty(accountOid)) {
|
|
|
startActivity(new Intent(this, MainActivity.class));
|
|
|
this.finish();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
...
|
...
|
@@ -80,24 +86,24 @@ public class LoginActivity extends BaseMvpActivity<CommonPresenter, AccountModel |
|
|
UserBean bean = (UserBean) o;
|
|
|
if (bean.getSuccess()) {
|
|
|
Toast.makeText(this, "验证码发送成功", Toast.LENGTH_LONG).show();
|
|
|
time = 60;
|
|
|
|
|
|
timer = new CountDownTimer(60000, 1000) {
|
|
|
@Override
|
|
|
public void onTick(long millisUntilFinished) {
|
|
|
time--;
|
|
|
try {
|
|
|
tvYanzheng.setText(String.valueOf(time) + "s");
|
|
|
tvYanzheng.setFocusable(false);
|
|
|
} catch (Exception e) {
|
|
|
Log.e("zhangtao", e.toString());
|
|
|
}
|
|
|
tvYanzheng.setText(String.valueOf(time) + "s");
|
|
|
tvYanzheng.setFocusable(false);
|
|
|
tvYanzheng.setFocusableInTouchMode(false);
|
|
|
tvYanzheng.setClickable(false);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onFinish() {
|
|
|
tvYanzheng.setText("获取验证码");
|
|
|
tvYanzheng.setFocusable(true);
|
|
|
time = 60;
|
|
|
tvYanzheng.setFocusableInTouchMode(true);
|
|
|
tvYanzheng.setClickable(true);
|
|
|
}
|
|
|
}.start();
|
|
|
} else {
|
...
|
...
|
@@ -113,7 +119,7 @@ public class LoginActivity extends BaseMvpActivity<CommonPresenter, AccountModel |
|
|
startActivity(new Intent(this, MainActivity.class));
|
|
|
this.finish();
|
|
|
} else {
|
|
|
Toast.makeText(this, "登录失败", Toast.LENGTH_LONG).show();
|
|
|
Toast.makeText(this, bean.getErrorMsg(), Toast.LENGTH_LONG).show();
|
|
|
}
|
|
|
|
|
|
}
|
...
|
...
|
@@ -140,10 +146,13 @@ public class LoginActivity extends BaseMvpActivity<CommonPresenter, AccountModel |
|
|
public void onClick(View v) {
|
|
|
switch (v.getId()) {
|
|
|
case R.id.login:
|
|
|
mPresenter.getPresenter(1, 2, edPhone.getText().toString(), edCode.getText().toString());
|
|
|
if (isCellphone(edPhone.getText().toString()) && !TextUtils.isEmpty(edPhone.getText().toString()))
|
|
|
mPresenter.getPresenter(1, 2, edPhone.getText().toString(), edCode.getText().toString());
|
|
|
else
|
|
|
Toast.makeText(this, "请输入正确的手机号码", Toast.LENGTH_LONG).show();
|
|
|
break;
|
|
|
case R.id.tv_yanzheng:
|
|
|
if (isCellphone(edPhone.getText().toString()))
|
|
|
if (isCellphone(edPhone.getText().toString()) && !TextUtils.isEmpty(edPhone.getText().toString()))
|
|
|
mPresenter.getPresenter(1, 1, edPhone.getText().toString(), String.valueOf(0));
|
|
|
else
|
|
|
Toast.makeText(this, "请输入正确的手机号码", Toast.LENGTH_LONG).show();
|
...
|
...
|
|