Commit 797d7c78 by sikang

添加短信登录

parent 712f7425
...@@ -6,6 +6,9 @@ import java.io.Serializable; ...@@ -6,6 +6,9 @@ import java.io.Serializable;
* Created by SiKang on 2018/9/30. * Created by SiKang on 2018/9/30.
*/ */
public class DisplayBean implements Serializable { public class DisplayBean implements Serializable {
public static final String ACCOUNTKIT = "ACCOUNTKIT";
public static final String SMS = "SMS";
private String description; private String description;
private String customerMobile; private String customerMobile;
//登录方式 SMS:短信登录 //登录方式 SMS:短信登录
......
package com.common.widget;
import android.annotation.SuppressLint;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.Button;
import java.util.Timer;
import java.util.TimerTask;
/**
* Created by SiKang on 2019/3/1.
*/
@SuppressLint("AppCompatCustomView")
public class CountDownButton extends Button {
private Timer mTimer;
private OnCountDownListener onCountDownListener;
public CountDownButton(Context context) {
super(context);
}
public CountDownButton(Context context, AttributeSet attrs) {
super(context, attrs);
}
/**
* 开始计时
*/
public void startCountDown(int count, int period, OnCountDownListener listener) {
stop();
setEnabled(false);
this.onCountDownListener = listener;
mTimer = new Timer();
mTimer.schedule(new CountDownTask(count), 0, period);
}
/**
* 取消计时
*/
public void stop() {
if (mTimer != null) {
mTimer.cancel();
mTimer = null;
}
if (onCountDownListener != null) {
onCountDownListener.onFinish();
onCountDownListener = null;
}
setEnabled(true);
}
/**
* 倒计时
*/
class CountDownTask extends TimerTask {
private int count = 0;
public CountDownTask(int count) {
this.count = count;
}
@Override
public void run() {
post(new Runnable() {
@Override
public void run() {
count--;
if (onCountDownListener != null) {
onCountDownListener.onCountDown(count);
}
if (count <= 0) {
stop();
}
}
});
}
}
/**
* 计时回调
*/
public interface OnCountDownListener {
void onCountDown(int index);
void onFinish();
}
}
...@@ -28,7 +28,6 @@ public abstract class OnNoShakeClickListener extends OnEventClickListener { ...@@ -28,7 +28,6 @@ public abstract class OnNoShakeClickListener extends OnEventClickListener {
v.setClickable(true); v.setClickable(true);
} }
}, lockTime); }, lockTime);
onEventClick(v);
} }
} }
...@@ -71,7 +71,7 @@ public interface LoanApi { ...@@ -71,7 +71,7 @@ public interface LoanApi {
* 取消贷款 * 取消贷款
*/ */
@FormUrlEncoded @FormUrlEncoded
@POST("loanapp/cancel") @POST("loanapp/stop")
Observable<ResponseBody> cancelLoan(@Field("loanAppId") String loanAppId, Observable<ResponseBody> cancelLoan(@Field("loanAppId") String loanAppId,
@Header("X-AUTH-TOKEN") String token); @Header("X-AUTH-TOKEN") String token);
......
...@@ -83,10 +83,19 @@ public class UserPresenter extends BasePresenter<UserApi> { ...@@ -83,10 +83,19 @@ public class UserPresenter extends BasePresenter<UserApi> {
public void accept(GatewayInfoBean gatewayInfoBean) throws Exception { public void accept(GatewayInfoBean gatewayInfoBean) throws Exception {
Gateway.setGatewayInfoBean(gatewayInfoBean); Gateway.setGatewayInfoBean(gatewayInfoBean);
EventBus.getDefault().post(ActionEnum.GATEWAY_UPDATED); EventBus.getDefault().post(ActionEnum.GATEWAY_UPDATED);
getCustomerMsg("action_getCustomerMsg");
} }
}); });
} }
/**
* 发送短信
*/
public void sendSms(String action, String mobile) {
handleRequest(action, apiService.sendSms(mobile));
}
/** /**
* 登录 * 登录
* (登录失败超过两次需要生成图像验证码) * (登录失败超过两次需要生成图像验证码)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment