验证码登录改造
This commit is contained in:
parent
cb55876bce
commit
25eeb8be50
66
app/src/main/java/com/oneclouds/cargo/bean/CodeBean.java
Normal file
66
app/src/main/java/com/oneclouds/cargo/bean/CodeBean.java
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
package com.oneclouds.cargo.bean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName CodeBean
|
||||||
|
* @Author john
|
||||||
|
* @Date 2025/1/16 09:18
|
||||||
|
* @Description TODO
|
||||||
|
*/
|
||||||
|
public class CodeBean {
|
||||||
|
|
||||||
|
|
||||||
|
private String msg;
|
||||||
|
private String img;
|
||||||
|
private int code;
|
||||||
|
private boolean success;
|
||||||
|
private boolean captchaOnOff;
|
||||||
|
private String uuid;
|
||||||
|
|
||||||
|
public String getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMsg(String msg) {
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImg() {
|
||||||
|
return img;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImg(String img) {
|
||||||
|
this.img = img;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(int code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSuccess() {
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSuccess(boolean success) {
|
||||||
|
this.success = success;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCaptchaOnOff() {
|
||||||
|
return captchaOnOff;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCaptchaOnOff(boolean captchaOnOff) {
|
||||||
|
this.captchaOnOff = captchaOnOff;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUuid() {
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUuid(String uuid) {
|
||||||
|
this.uuid = uuid;
|
||||||
|
}
|
||||||
|
}
|
@ -56,6 +56,7 @@ public class LoginBean {
|
|||||||
|
|
||||||
public static class DataDTO {
|
public static class DataDTO {
|
||||||
private String token;
|
private String token;
|
||||||
|
private String access_token;
|
||||||
private int id;
|
private int id;
|
||||||
private int roleId;
|
private int roleId;
|
||||||
private String uname;
|
private String uname;
|
||||||
@ -80,6 +81,14 @@ public class LoginBean {
|
|||||||
private Object isCar;
|
private Object isCar;
|
||||||
private Object qrcodeUrl;
|
private Object qrcodeUrl;
|
||||||
|
|
||||||
|
public String getAccess_token() {
|
||||||
|
return access_token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccess_token(String access_token) {
|
||||||
|
this.access_token = access_token;
|
||||||
|
}
|
||||||
|
|
||||||
public String getToken() {
|
public String getToken() {
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import com.google.gson.Gson;
|
|||||||
import com.oneclouds.cargo.constant.SPConstant;
|
import com.oneclouds.cargo.constant.SPConstant;
|
||||||
import com.oneclouds.cargo.request.bean.InsBankInputBean;
|
import com.oneclouds.cargo.request.bean.InsBankInputBean;
|
||||||
import com.oneclouds.cargo.request.bean.LoginRegInputBean;
|
import com.oneclouds.cargo.request.bean.LoginRegInputBean;
|
||||||
|
import com.oneclouds.cargo.request.bean.NewLogBean;
|
||||||
import com.oneclouds.cargo.request.manager.UrlManager;
|
import com.oneclouds.cargo.request.manager.UrlManager;
|
||||||
import com.oneclouds.cargo.util.MapUtil;
|
import com.oneclouds.cargo.util.MapUtil;
|
||||||
import com.oneclouds.cargo.util.SPUtil;
|
import com.oneclouds.cargo.util.SPUtil;
|
||||||
@ -104,12 +105,22 @@ public class PublicRequest {
|
|||||||
Request re = OkHttpUtil.post(new OkDate(UrlManager.forgetPwd(), "post", MapUtil.mapJson(map)),con);
|
Request re = OkHttpUtil.post(new OkDate(UrlManager.forgetPwd(), "post", MapUtil.mapJson(map)),con);
|
||||||
RequestTest.test(1,FORGETPWD,re,con,hd);
|
RequestTest.test(1,FORGETPWD,re,con,hd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//获取验证码
|
||||||
|
public void getCode(){
|
||||||
|
Map<String,Object> map=new HashMap<>();
|
||||||
|
Request re = OkHttpUtil.get(new OkDate(UrlManager.getCode(), "get", MapUtil.mapJson(map)),"get",con);
|
||||||
|
RequestTest.test(1,"getCode",re,con,hd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//账户登录
|
//账户登录
|
||||||
public void userLogin(LoginRegInputBean lrib){
|
public void userLogin(LoginRegInputBean lrib){
|
||||||
Request re = OkHttpUtil.post(new OkDate(UrlManager.getLOGIN(), "post", gson.toJson(lrib)),con);
|
Request re = OkHttpUtil.post(new OkDate(UrlManager.getLOGIN(), "post", gson.toJson(lrib)),con);
|
||||||
RequestTest.test(1,LOGIN,re,con,hd);
|
RequestTest.test(1,LOGIN,re,con,hd);
|
||||||
}//账户登录
|
}//账户登录
|
||||||
public void userLogin2(LoginRegInputBean lrib){
|
public void userLogin2(NewLogBean lrib){
|
||||||
Request re = OkHttpUtil.post(new OkDate(UrlManager.getLOGIN2(), "post", gson.toJson(lrib)),con);
|
Request re = OkHttpUtil.post(new OkDate(UrlManager.getLOGIN2(), "post", gson.toJson(lrib)),con);
|
||||||
RequestTest.test(1,LOGIN,re,con,hd);
|
RequestTest.test(1,LOGIN,re,con,hd);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,47 @@
|
|||||||
|
package com.oneclouds.cargo.request.bean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hlh
|
||||||
|
* @version 1.0.0
|
||||||
|
* @date 2021/8/2 9:45
|
||||||
|
* @description:登录和注册的入参实体
|
||||||
|
*/
|
||||||
|
public class NewLogBean {
|
||||||
|
|
||||||
|
private String username;
|
||||||
|
private String password;
|
||||||
|
private String code;
|
||||||
|
private String uuid;
|
||||||
|
|
||||||
|
public String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsername(String username) {
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(String code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUuid() {
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUuid(String uuid) {
|
||||||
|
this.uuid = uuid;
|
||||||
|
}
|
||||||
|
}
|
@ -202,7 +202,9 @@ public class UrlManager {
|
|||||||
private static final String FORGETPWD = "/common/forgetPwd";
|
private static final String FORGETPWD = "/common/forgetPwd";
|
||||||
//账户登录
|
//账户登录
|
||||||
private static final String LOGIN = "/common/register";
|
private static final String LOGIN = "/common/register";
|
||||||
private static final String LOGIN2 = "/common/login";
|
// private static final String LOGIN2 = "/common/login";
|
||||||
|
private static final String LOGIN2 = "auth/login";
|
||||||
|
private static final String CODE = "code";
|
||||||
//账户信息
|
//账户信息
|
||||||
private static final String USER_INFO = "/app/user/getUserInfo";
|
private static final String USER_INFO = "/app/user/getUserInfo";
|
||||||
//银行卡列表
|
//银行卡列表
|
||||||
@ -551,7 +553,11 @@ public class UrlManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getLOGIN2() {
|
public static String getLOGIN2() {
|
||||||
return BASE_URL + LOGIN2;
|
return BASE_URL.substring(0, BASE_URL.lastIndexOf("api/")) + LOGIN2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getCode() {
|
||||||
|
return BASE_URL.substring(0, BASE_URL.lastIndexOf("api/")) + CODE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getUserInfo() {
|
public static String getUserInfo() {
|
||||||
|
@ -15,6 +15,7 @@ import android.widget.Button;
|
|||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
@ -22,22 +23,33 @@ import android.widget.Toast;
|
|||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.cardview.widget.CardView;
|
import androidx.cardview.widget.CardView;
|
||||||
|
|
||||||
|
import com.dahe.mylibrary.utils.Base64Utils;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
import com.oneclouds.cargo.BuildConfig;
|
||||||
import com.oneclouds.cargo.R;
|
import com.oneclouds.cargo.R;
|
||||||
|
import com.oneclouds.cargo.bean.CodeBean;
|
||||||
import com.oneclouds.cargo.bean.ConfigBean;
|
import com.oneclouds.cargo.bean.ConfigBean;
|
||||||
import com.oneclouds.cargo.bean.LoginBean;
|
import com.oneclouds.cargo.bean.LoginBean;
|
||||||
import com.oneclouds.cargo.constant.SPConstant;
|
import com.oneclouds.cargo.constant.SPConstant;
|
||||||
import com.oneclouds.cargo.request.PublicRequest;
|
import com.oneclouds.cargo.request.PublicRequest;
|
||||||
import com.oneclouds.cargo.request.bean.LoginRegInputBean;
|
import com.oneclouds.cargo.request.bean.LoginRegInputBean;
|
||||||
|
import com.oneclouds.cargo.request.bean.NewLogBean;
|
||||||
|
import com.oneclouds.cargo.request.manager.UrlManager;
|
||||||
import com.oneclouds.cargo.ui.parts.ConfigParts;
|
import com.oneclouds.cargo.ui.parts.ConfigParts;
|
||||||
|
import com.oneclouds.cargo.util.MapUtil;
|
||||||
import com.oneclouds.cargo.util.SPUtil;
|
import com.oneclouds.cargo.util.SPUtil;
|
||||||
import com.oneclouds.cargo.util.cache.CacheGroup;
|
import com.oneclouds.cargo.util.cache.CacheGroup;
|
||||||
|
import com.oneclouds.cargo.util.http.OkDate;
|
||||||
|
import com.oneclouds.cargo.util.http.OkHttpUtil;
|
||||||
|
import com.oneclouds.cargo.util.http.RequestTest;
|
||||||
import com.oneclouds.cargo.util.http.RequsetCodeConstants;
|
import com.oneclouds.cargo.util.http.RequsetCodeConstants;
|
||||||
import com.oneclouds.cargo.util.titleutil.StatusBarUtil;
|
import com.oneclouds.cargo.util.titleutil.StatusBarUtil;
|
||||||
import com.oneclouds.cargo.util.view.BaseActivity;
|
import com.oneclouds.cargo.util.view.BaseActivity;
|
||||||
|
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
|
||||||
|
import okhttp3.Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hlh
|
* @author hlh
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
@ -56,9 +68,13 @@ public class LoginActivity extends BaseActivity {
|
|||||||
|
|
||||||
private Button btn_login;
|
private Button btn_login;
|
||||||
private TextView auto_login;
|
private TextView auto_login;
|
||||||
private EditText input_phone, input_code;
|
private EditText input_phone, input_code, etCode;
|
||||||
|
private ImageView ivCode;
|
||||||
private TextView getCode, tvForget;
|
private TextView getCode, tvForget;
|
||||||
private LoginBean loginBean;
|
private LoginBean loginBean;
|
||||||
|
|
||||||
|
private CodeBean codeBean;
|
||||||
|
|
||||||
private TimerTask tt;
|
private TimerTask tt;
|
||||||
private int timer_sum = 60;
|
private int timer_sum = 60;
|
||||||
private ImageButton agree_btn;
|
private ImageButton agree_btn;
|
||||||
@ -89,17 +105,32 @@ public class LoginActivity extends BaseActivity {
|
|||||||
loginBean = new Gson().fromJson(CacheGroup.cacheList.get(PublicRequest.LOGIN), LoginBean.class);
|
loginBean = new Gson().fromJson(CacheGroup.cacheList.get(PublicRequest.LOGIN), LoginBean.class);
|
||||||
Log.e("--登录信息--", new Gson().toJson(loginBean));
|
Log.e("--登录信息--", new Gson().toJson(loginBean));
|
||||||
if (loginBean.getCode() == 200) {
|
if (loginBean.getCode() == 200) {
|
||||||
SPUtil.insSP(con, SPConstant.DATA, SPConstant.DATA_TOKEN, loginBean.getData().getToken());
|
SPUtil.insSP(con, SPConstant.DATA, SPConstant.DATA_TOKEN, loginBean.getData().getAccess_token());
|
||||||
SPUtil.insSP(con, USER, USER_UNAME, loginBean.getData().getUname());
|
// SPUtil.insSP(con, USER, USER_UNAME, loginBean.getData().getUname());
|
||||||
SPUtil.insSP(con, USER, USER_PHONE, input_phone.getText().toString().trim());
|
SPUtil.insSP(con, USER, USER_PHONE, input_phone.getText().toString().trim());
|
||||||
SPUtil.insSP(con, USER, USER_RNAME, loginBean.getData().getRname());
|
// SPUtil.insSP(con, USER, USER_RNAME, loginBean.getData().getRname());
|
||||||
SPUtil.insSP(con, USER, USER_ID, loginBean.getData().getId() + "");
|
// SPUtil.insSP(con, USER, USER_ID, loginBean.getData().getId() + "");
|
||||||
finish();
|
finish();
|
||||||
} else {
|
} else {
|
||||||
|
//重新获取验证码
|
||||||
|
etCode.setText("");
|
||||||
|
pr.getCode();
|
||||||
Toast.makeText(con, loginBean.getMsg(), Toast.LENGTH_SHORT).show();
|
Toast.makeText(con, loginBean.getMsg(), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
CacheGroup.cacheList.remove(PublicRequest.LOGIN);
|
CacheGroup.cacheList.remove(PublicRequest.LOGIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (CacheGroup.cacheList.get("getCode") != null) {
|
||||||
|
//存储登录记录
|
||||||
|
codeBean = new Gson().fromJson(CacheGroup.cacheList.get("getCode"), CodeBean.class);
|
||||||
|
Log.e("--登录信息--", new Gson().toJson(loginBean));
|
||||||
|
if (codeBean != null && codeBean.getCode() == 200 && codeBean.isCaptchaOnOff()) {
|
||||||
|
ivCode.setImageBitmap(Base64Utils.base64ToBitmap(codeBean.getImg()));
|
||||||
|
} else {
|
||||||
|
Toast.makeText(con, loginBean.getMsg(), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
CacheGroup.cacheList.remove("getCode");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -122,11 +153,15 @@ public class LoginActivity extends BaseActivity {
|
|||||||
llCheck = findViewById(R.id.ll_check);
|
llCheck = findViewById(R.id.ll_check);
|
||||||
cbLog = findViewById(R.id.cb);
|
cbLog = findViewById(R.id.cb);
|
||||||
no_btn = findViewById(R.id.no_btn);
|
no_btn = findViewById(R.id.no_btn);
|
||||||
|
etCode = findViewById(R.id.etCode);
|
||||||
|
ivCode = findViewById(R.id.ivCode);
|
||||||
pr = new PublicRequest(con, hd);
|
pr = new PublicRequest(con, hd);
|
||||||
String phone = SPUtil.getSP(con, USER, USER_PHONE);
|
String phone = SPUtil.getSP(con, USER, USER_PHONE);
|
||||||
if (!TextUtils.isEmpty(phone)){
|
if (!TextUtils.isEmpty(phone)) {
|
||||||
input_phone.setText(phone);
|
input_phone.setText(phone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pr.getCode();
|
||||||
initView(null);
|
initView(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,12 +174,17 @@ public class LoginActivity extends BaseActivity {
|
|||||||
public void initView(Object obj) {
|
public void initView(Object obj) {
|
||||||
super.initView(obj);
|
super.initView(obj);
|
||||||
llCheck.setOnClickListener(v -> {
|
llCheck.setOnClickListener(v -> {
|
||||||
if (cbLog.isChecked()){
|
if (cbLog.isChecked()) {
|
||||||
cbLog.setChecked(false);
|
cbLog.setChecked(false);
|
||||||
}else{
|
} else {
|
||||||
cbLog.setChecked(true);
|
cbLog.setChecked(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ivCode.setOnClickListener(v -> {
|
||||||
|
pr.getCode();
|
||||||
|
});
|
||||||
|
|
||||||
// agree_btn.setOnClickListener(v -> {
|
// agree_btn.setOnClickListener(v -> {
|
||||||
// agree_btn.setVisibility(View.GONE);
|
// agree_btn.setVisibility(View.GONE);
|
||||||
// no_btn.setVisibility(View.VISIBLE);
|
// no_btn.setVisibility(View.VISIBLE);
|
||||||
@ -230,15 +270,18 @@ public class LoginActivity extends BaseActivity {
|
|||||||
});
|
});
|
||||||
btn_login.setOnClickListener(v -> {
|
btn_login.setOnClickListener(v -> {
|
||||||
String phone = String.valueOf(input_phone.getText());
|
String phone = String.valueOf(input_phone.getText());
|
||||||
String code = String.valueOf(input_code.getText());
|
String pwd = String.valueOf(input_code.getText());
|
||||||
|
String code = String.valueOf(etCode.getText());
|
||||||
Log.e("--code--", code);
|
Log.e("--code--", code);
|
||||||
if (judgeFormat(phone, code)) {
|
if (judgeFormat(phone, pwd,code)) {
|
||||||
if (cbLog.isChecked()) {
|
if (cbLog.isChecked()) {
|
||||||
LoginRegInputBean lb = new LoginRegInputBean();
|
NewLogBean newLogBean = new NewLogBean();
|
||||||
lb.setRoleId(2);
|
newLogBean.setUsername(phone);
|
||||||
lb.setUserName(phone);
|
newLogBean.setPassword(pwd);
|
||||||
lb.setPassword(code);
|
newLogBean.setCode(code);
|
||||||
pr.userLogin2(lb);
|
newLogBean.setUuid(codeBean.getUuid());
|
||||||
|
|
||||||
|
pr.userLogin2(newLogBean);
|
||||||
|
|
||||||
// lb.setRoleId(2);
|
// lb.setRoleId(2);
|
||||||
// lb.setUname(phone);
|
// lb.setUname(phone);
|
||||||
@ -276,9 +319,9 @@ public class LoginActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//验证用户输入的是否符合格式
|
//验证用户输入的是否符合格式
|
||||||
public boolean judgeFormat(String phone, String code) {
|
public boolean judgeFormat(String phone, String pwd, String code) {
|
||||||
if (phone.equals("") || code.equals("")) {
|
if (phone.equals("") || pwd.equals("")|| code.equals("")) {
|
||||||
Toast.makeText(con, "手机号和验证码不得为空", Toast.LENGTH_SHORT).show();
|
Toast.makeText(con, "手机号,密码和验证码不得为空", Toast.LENGTH_SHORT).show();
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
|
@ -113,10 +113,10 @@ public class ChoiceAddressActivity extends BaseActivity implements View.OnClickL
|
|||||||
}
|
}
|
||||||
finish();
|
finish();
|
||||||
} else {
|
} else {
|
||||||
tvAddress.setText("");
|
// tvAddress.setText("");
|
||||||
aib.setProvinceS("");
|
// aib.setProvinceS("");
|
||||||
aib.setCityS("");
|
// aib.setCityS("");
|
||||||
aib.setAreaS("");
|
// aib.setAreaS("");
|
||||||
Toast.makeText(con, bb.getMsg(), Toast.LENGTH_SHORT).show();
|
Toast.makeText(con, bb.getMsg(), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
CacheGroup.cacheList.remove(AddressRequest.ADDRESS_SAVE);
|
CacheGroup.cacheList.remove(AddressRequest.ADDRESS_SAVE);
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
/>
|
/>
|
||||||
<TextView
|
<TextView
|
||||||
|
android:visibility="invisible"
|
||||||
android:layout_marginTop="@dimen/dp_6"
|
android:layout_marginTop="@dimen/dp_6"
|
||||||
android:layout_marginLeft="@dimen/dp_20"
|
android:layout_marginLeft="@dimen/dp_20"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@ -46,7 +47,7 @@
|
|||||||
android:paddingBottom="@dimen/dp_12"
|
android:paddingBottom="@dimen/dp_12"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="请输入手机号码"
|
android:hint="请输入账号"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textColor="#ff000000"
|
android:textColor="#ff000000"
|
||||||
@ -94,6 +95,42 @@
|
|||||||
android:paddingTop="@dimen/dp_6"
|
android:paddingTop="@dimen/dp_6"
|
||||||
android:paddingBottom="@dimen/dp_6"/>
|
android:paddingBottom="@dimen/dp_6"/>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
<View
|
||||||
|
android:layout_marginLeft="@dimen/dp_20"
|
||||||
|
android:layout_marginRight="@dimen/dp_20"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/dp_1"
|
||||||
|
android:background="#F2F2F2"/>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_marginLeft="@dimen/dp_20"
|
||||||
|
android:layout_marginRight="@dimen/dp_20"
|
||||||
|
android:layout_marginTop="@dimen/dp_16"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/etCode"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@null"
|
||||||
|
android:hint="请输入验证码"
|
||||||
|
android:inputType="number"
|
||||||
|
android:paddingTop="@dimen/dp_12"
|
||||||
|
android:paddingBottom="@dimen/dp_12"
|
||||||
|
android:textColor="#ff000000"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textSize="@dimen/sp_14" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/ivCode"
|
||||||
|
android:layout_width="@dimen/dp_100"
|
||||||
|
android:layout_height="@dimen/dp_40"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
/>
|
||||||
|
</RelativeLayout>
|
||||||
<View
|
<View
|
||||||
android:layout_marginLeft="@dimen/dp_20"
|
android:layout_marginLeft="@dimen/dp_20"
|
||||||
android:layout_marginRight="@dimen/dp_20"
|
android:layout_marginRight="@dimen/dp_20"
|
||||||
|
@ -6,7 +6,7 @@ import android.util.Base64;
|
|||||||
|
|
||||||
public class Base64Utils {
|
public class Base64Utils {
|
||||||
|
|
||||||
public static Bitmap asdf(String imageBase64){
|
public static Bitmap base64ToBitmap(String imageBase64){
|
||||||
byte[] decodedString = Base64.decode(imageBase64, Base64.DEFAULT);
|
byte[] decodedString = Base64.decode(imageBase64, Base64.DEFAULT);
|
||||||
return BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);
|
return BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user