登录添加未成功不可重复点击判断

This commit is contained in:
lijia 2024-12-04 10:34:24 +08:00
parent 041bcaf2ec
commit e59e2d0fa4
3 changed files with 27 additions and 4 deletions

View File

@ -98,8 +98,11 @@ public class LoginActivity extends BaseActivity {
Log.e("--短信发送res--", "短信发送成功"); Log.e("--短信发送res--", "短信发送成功");
} }
if (CacheGroup.cacheList.get(LOGIN_RESULT) != null) { if (CacheGroup.cacheList.get(LOGIN_RESULT) != null) {
if (customDialog!=null&&customDialog.isShowing()) if (customDialog != null && customDialog.isShowing())
customDialog.dismiss(); customDialog.dismiss();
btn_login.setEnabled(true);
btn_login.setBackgroundResource(R.drawable.bg_btn);
//存储登录记录 //存储登录记录
loginBean = new Gson().fromJson(CacheGroup.cacheList.get(LOGIN_RESULT), LoginBean.class); loginBean = new Gson().fromJson(CacheGroup.cacheList.get(LOGIN_RESULT), LoginBean.class);
Log.e("--登录信息--", new Gson().toJson(loginBean)); Log.e("--登录信息--", new Gson().toJson(loginBean));
@ -112,18 +115,25 @@ public class LoginActivity extends BaseActivity {
// JPushInterface.setAlias(con, 0, loginBean.getData().getUname()); // JPushInterface.setAlias(con, 0, loginBean.getData().getUname());
appInfoBean.setStatus("0"); appInfoBean.setStatus("0");
appInfoBean.setUserPhone(String.valueOf(input_phone.getText())); appInfoBean.setUserPhone(String.valueOf(input_phone.getText()));
ur.postAppInfo(appInfoBean,"post"); ur.postAppInfo(appInfoBean, "post");
UiAuxiliary.homeRequest("登录成功"); UiAuxiliary.homeRequest("登录成功");
finish(); finish();
} else { } else {
appInfoBean.setStatus("1"); appInfoBean.setStatus("1");
appInfoBean.setUserPhone(String.valueOf(input_phone.getText())); appInfoBean.setUserPhone(String.valueOf(input_phone.getText()));
ur.postAppInfo(appInfoBean,"post"); ur.postAppInfo(appInfoBean, "post");
Toast.makeText(con, loginBean.getMsg(), Toast.LENGTH_SHORT).show(); Toast.makeText(con, loginBean.getMsg(), Toast.LENGTH_SHORT).show();
} }
CacheGroup.cacheList.remove(LOGIN_RESULT); CacheGroup.cacheList.remove(LOGIN_RESULT);
} }
break; break;
case RequsetCodeConstants.ERROR:
if (customDialog != null && customDialog.isShowing())
customDialog.dismiss();
btn_login.setEnabled(true);
btn_login.setBackgroundResource(R.drawable.bg_btn);
break;
default: default:
break; break;
} }
@ -238,6 +248,8 @@ public class LoginActivity extends BaseActivity {
Log.e("--code--", code); Log.e("--code--", code);
if (judgeFormat(phone, code)) { if (judgeFormat(phone, code)) {
if (key) { if (key) {
btn_login.setEnabled(false);
btn_login.setBackgroundResource(R.drawable.bg_btn_gray);
customDialog = new CustomDialog(con, "登陆中..."); customDialog = new CustomDialog(con, "登陆中...");
customDialog.show(); customDialog.show();
LoginRegInputBean lb = new LoginRegInputBean(); LoginRegInputBean lb = new LoginRegInputBean();

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="#AAAAAA" />
<corners android:topLeftRadius="@dimen/dp_29" android:topRightRadius="@dimen/dp_29"
android:bottomLeftRadius="@dimen/dp_29" android:bottomRightRadius="@dimen/dp_29" />
</shape>
</item>
</selector>

View File

@ -26,10 +26,11 @@
</LinearLayout> </LinearLayout>
<ImageView <ImageView
android:layout_marginTop="@dimen/dp_210"
android:id="@+id/img" android:id="@+id/img"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerInParent="true" android:layout_centerHorizontal="true"
android:background="@drawable/face_success"></ImageView> android:background="@drawable/face_success"></ImageView>
<TextView <TextView