登录按钮添加防抖以及加载loading

This commit is contained in:
lijia 2024-12-04 09:14:33 +08:00
parent 291578cd72
commit 041bcaf2ec
3 changed files with 14 additions and 4 deletions

View File

@ -40,6 +40,7 @@ import com.arpa.hndahesudintocctmsdriver.util.PickerUtils;
import com.arpa.hndahesudintocctmsdriver.util.PicturlUtil; import com.arpa.hndahesudintocctmsdriver.util.PicturlUtil;
import com.arpa.hndahesudintocctmsdriver.util.alert.ToastUtil; import com.arpa.hndahesudintocctmsdriver.util.alert.ToastUtil;
import com.arpa.hndahesudintocctmsdriver.util.map.MapUtil; import com.arpa.hndahesudintocctmsdriver.util.map.MapUtil;
import com.arpa.hndahesudintocctmsdriver.weight.OnLimitClickHelper;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions; import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.Target; import com.bumptech.glide.request.target.Target;
@ -748,7 +749,7 @@ public class CertificatesActivity extends BaseAppCompatActivity {
} }
}); });
submit.setOnClickListener(v -> { submit.setOnClickListener(new OnLimitClickHelper(v->{
if (!isAuth) { if (!isAuth) {
subimt(); subimt();
} else { } else {
@ -792,7 +793,7 @@ public class CertificatesActivity extends BaseAppCompatActivity {
break; break;
} }
} }
}); }));
} }
@Override @Override

View File

@ -32,6 +32,8 @@ import com.arpa.hndahesudintocctmsdriver.request.net.BaseObserver;
import com.arpa.hndahesudintocctmsdriver.request.net.DataManager; import com.arpa.hndahesudintocctmsdriver.request.net.DataManager;
import com.arpa.hndahesudintocctmsdriver.request.net.RxHttpCallBack; import com.arpa.hndahesudintocctmsdriver.request.net.RxHttpCallBack;
import com.arpa.hndahesudintocctmsdriver.ui.web.WebOnlyOneActivity; import com.arpa.hndahesudintocctmsdriver.ui.web.WebOnlyOneActivity;
import com.arpa.hndahesudintocctmsdriver.util.alert.CustomDialog;
import com.arpa.hndahesudintocctmsdriver.weight.OnLimitClickHelper;
import com.dahe.mylibrary.net.CommonResponseBean; import com.dahe.mylibrary.net.CommonResponseBean;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.arpa.hndahesudintocctmsdriver.R; import com.arpa.hndahesudintocctmsdriver.R;
@ -77,6 +79,7 @@ public class LoginActivity extends BaseActivity {
private int timer_sum = 60; private int timer_sum = 60;
private CheckBox cb; private CheckBox cb;
private UserRequset ur; private UserRequset ur;
private CustomDialog customDialog;
@Override @Override
public void msgMethod(Message m) { public void msgMethod(Message m) {
@ -95,6 +98,8 @@ 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())
customDialog.dismiss();
//存储登录记录 //存储登录记录
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));
@ -227,12 +232,14 @@ public class LoginActivity extends BaseActivity {
} }
} }
}); });
btn_login.setOnClickListener(v -> { btn_login.setOnClickListener(new OnLimitClickHelper(v -> {
String phone = String.valueOf(input_phone.getText()); String phone = String.valueOf(input_phone.getText());
String code = String.valueOf(input_code.getText()); String code = String.valueOf(input_code.getText());
Log.e("--code--", code); Log.e("--code--", code);
if (judgeFormat(phone, code)) { if (judgeFormat(phone, code)) {
if (key) { if (key) {
customDialog = new CustomDialog(con, "登陆中...");
customDialog.show();
LoginRegInputBean lb = new LoginRegInputBean(); LoginRegInputBean lb = new LoginRegInputBean();
lb.setRoleId(4); lb.setRoleId(4);
lb.setUname(phone); lb.setUname(phone);
@ -244,7 +251,7 @@ public class LoginActivity extends BaseActivity {
Toast.makeText(con, "请先同意用户协议和隐私政策", Toast.LENGTH_SHORT).show(); Toast.makeText(con, "请先同意用户协议和隐私政策", Toast.LENGTH_SHORT).show();
} }
} }
}); }));
auto_login.setOnClickListener(v -> { auto_login.setOnClickListener(v -> {
JVerificationInterface.getToken(con, 20000, (i, s, s1) -> { JVerificationInterface.getToken(con, 20000, (i, s, s1) -> {
JVerifyUIConfig uiConfig = new JVerifyUIConfig.Builder() JVerifyUIConfig uiConfig = new JVerifyUIConfig.Builder()

View File

@ -105,6 +105,8 @@ public class BaseRecyclerView extends RecyclerView {
ra.addItem(mb); ra.addItem(mb);
} }
public void adds(List<ManyBean> list){ public void adds(List<ManyBean> list){
if (ra==null)
return;
ra.add(list); ra.add(list);
} }
public AdapterAlls createsH(Context con, List<ManyBean> list){ public AdapterAlls createsH(Context con, List<ManyBean> list){