Commit 6b43e04f by tangguangrui

提交第二个版本代码

parent 669f46a2
......@@ -9,8 +9,8 @@ android {
applicationId "cn.runworld.mctower.visitor"
minSdkVersion 21
targetSdkVersion 29
versionCode 2
versionName "1.0.1"
versionCode 3
versionName "1.0.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk {
// 设置支持的SO库架构
......
......@@ -14,26 +14,36 @@
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity
android:name=".MainActivity"
android:theme="@style/Theme.MyAppCompatTheme">
<activity android:name=".HomePageActivity"
android:theme="@style/Theme.MyAppCompatTheme"
android:windowSoftInputMode="adjustPan" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".PassThroughDetailActivity"
android:theme="@style/Theme.MyAppCompatTheme"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".PassThroughQueryActivity"
android:theme="@style/Theme.MyAppCompatTheme"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".MainActivity"
android:theme="@style/Theme.MyAppCompatTheme"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".DetailActivity"
android:theme="@style/Theme.MyAppCompatTheme"
android:windowSoftInputMode="adjustPan"/>
<service android:name="com.brilliants.idcardlib.IDCardService"/>
android:windowSoftInputMode="adjustPan" />
<service android:name="com.brilliants.idcardlib.IDCardService" />
</application>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
......@@ -42,6 +52,7 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_LOGS" />
</manifest>
\ No newline at end of file
......@@ -10,6 +10,8 @@ import cn.dankal.base.utils.Utils;
*/
public class Constant {
//接口文档地址 https://api-mircrosoft-building.dankal.cn/v1/swagger-ui.html#/
public static String BaseImagesDir = Utils.getRootFilePath() + "/image/";
// public static String Host = "https://api-mircrosoft-building.dankal.cn/v1/"; //测试
......@@ -20,6 +22,9 @@ public class Constant {
public static final String API_SAVE_USER_INFO = Host + "mini/visit/user/binding";
public static final String API_SAVE_USER_INFO_OTHER = Host + "mini/visit/user/binding/other";
public static final String API_SAVE_NOTE = Host + "mini/visit/user/remark";
public static final String API_PASS_USER_LIST = Host + "mini/pass/users";
public static final String API_PASS_USER_DETAIL = Host + "mini/pass/user/detail/";
public static final String API_PASS_USER_BIND = Host + "mini/pass/user/binding";
}
package cn.mctower.visitor;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.lidroid.xutils.view.annotation.event.OnClick;
import androidx.annotation.MainThread;
import cn.dankal.base.activity.NetBaseAppCompatActivity;
public class HomePageActivity extends NetBaseAppCompatActivity {
@ViewInject(R.id.titleTv)
TextView titleTv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home_page);
setAndroidNativeLightStatusBar(this,true);
setStatusBarColor(this,android.R.color.white);
ViewUtils.inject(this);
titleTv.setText("首页");
}
@OnClick({R.id.backBtn,R.id.passCode, R.id.visitor})
public void click(View view){
switch (view.getId()){
case R.id.backBtn:
onBackPressed();
break;
case R.id.passCode:
jumpActivity(PassThroughQueryActivity.class,false);
break;
case R.id.visitor:
jumpActivity(MainActivity.class,false);
break;
}
}
}
......@@ -102,6 +102,8 @@ public class MCTowerApplication extends Application {
((MainActivity)currentActivity).readIdCardFailure();
}else if(currentActivity instanceof DetailActivity){
((DetailActivity)currentActivity).readIdCardFailure();
}else if(currentActivity instanceof PassThroughDetailActivity){
((PassThroughDetailActivity)currentActivity).readIdCardFailure();
}
}
}
......@@ -113,6 +115,8 @@ public class MCTowerApplication extends Application {
((MainActivity)currentActivity).setIdCardInfo(invsIdCard);
}else if(currentActivity instanceof DetailActivity){
((DetailActivity)currentActivity).setIdCardInfo(invsIdCard);
}else if(currentActivity instanceof PassThroughDetailActivity){
((PassThroughDetailActivity)currentActivity).setIdCardInfo(invsIdCard);
}
}
}
......
......@@ -75,6 +75,9 @@ public class MainActivity extends NetBaseAppCompatActivity {
setStatusBarColor(this,android.R.color.white);
ViewUtils.inject(this);
visitorFrame.setVisibility(View.GONE);
searchPageFrame.setVisibility(View.VISIBLE);
titleTv.setText("信息");
input.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
......@@ -150,7 +153,7 @@ public class MainActivity extends NetBaseAppCompatActivity {
}
}
@Override
/*@Override
public void onBackPressed() {
if(searchPageFrame.getVisibility() == View.VISIBLE){
visitorFrame.setVisibility(View.VISIBLE);
......@@ -159,7 +162,7 @@ public class MainActivity extends NetBaseAppCompatActivity {
adapter.notifyDataSetChanged();
}else
super.onBackPressed();
}
}*/
private void doSearch(){
String key = input.getText().toString().trim();
......
package cn.mctower.visitor;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.brilliants.idcardlib.IDCardUtils;
import com.google.gson.Gson;
import com.invs.invsIdCard;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.lidroid.xutils.view.annotation.event.OnClick;
import com.luck.picture.lib.PictureSelector;
import com.luck.picture.lib.config.PictureConfig;
import com.luck.picture.lib.config.PictureMimeType;
import com.luck.picture.lib.entity.LocalMedia;
import com.qiniu.android.storage.Configuration;
import com.qiniu.android.storage.UploadManager;
import com.qiniu.android.storage.UploadOptions;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Random;
import androidx.annotation.Nullable;
import cn.dankal.base.activity.NetBaseAppCompatActivity;
import cn.dankal.base.http.DialogHttpCallBack;
import cn.dankal.base.http.HttpPostHelper;
import cn.dankal.base.http.NOToastHttpCallBack;
import cn.dankal.base.utils.ImageUtil;
import cn.dankal.base.utils.LogUtils;
import cn.dankal.base.utils.NetPicUtil;
import cn.dankal.base.utils.ToastUtils;
import cn.mctower.visitor.model.PassRecordBean;
import cn.mctower.visitor.model.PassThroughDetailBean;
import cn.mctower.visitor.model.PassThroughSaveBean;
import cn.mctower.visitor.model.QiNiuTokenBean;
public class PassThroughDetailActivity extends NetBaseAppCompatActivity {
@ViewInject(R.id.titleTv)
TextView titleTv;
@ViewInject(R.id.name)
TextView name;
@ViewInject(R.id.tel)
TextView tel;
@ViewInject(R.id.company)
TextView company;
@ViewInject(R.id.idAndRemarkFrame)
RelativeLayout idAndRemarkFrame;
@ViewInject(R.id.idNum)
TextView idNum;
@ViewInject(R.id.remark)
TextView remark;
@ViewInject(R.id.idNumFrame)
LinearLayout idNumFrame;
@ViewInject(R.id.inputId)
EditText inputId;
@ViewInject(R.id.remarkFrame)
LinearLayout remarkFrame;
@ViewInject(R.id.inputRemark)
EditText inputRemark;
@ViewInject(R.id.roundlayoutPic)
RoundLayout roundlayoutPic;
@ViewInject(R.id.pic)
ImageView pic;
@ViewInject(R.id.roundlayoutAddPic)
RoundLayout roundlayoutAddPic;
@ViewInject(R.id.addPic)
TextView addPic;
@ViewInject(R.id.bindBtn)
TextView bindBtn;
@ViewInject(R.id.editBtn)
TextView editBtn;
@ViewInject(R.id.readSuccessDialogFrame)
RelativeLayout readSuccessDialogFrame;
@ViewInject(R.id.idPicInDialog)
ImageView idPicInDialog;
@ViewInject(R.id.nameInDialog)
TextView nameInDialog;
@ViewInject(R.id.genderInDialog)
TextView genderInDialog;
@ViewInject(R.id.idCodeInDialog)
TextView idCodeInDialog;
@ViewInject(R.id.bindBtnInDialog)
TextView bindBtnInDialog;
private String id;
private PassThroughDetailBean bean;
private List<LocalMedia> mSelectList = new ArrayList<>();
private LocalMedia picMedia;
private QiNiuTokenBean qiNiuTokenBean;
private NetPicUtil netPicUtil = new NetPicUtil();
private invsIdCard invsIdCard;
private UploadFileInfoBean needUploadBean;
private String identityImgUrl;//证件的图片地址
private String gender;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pass_through_detail);
setAndroidNativeLightStatusBar(this,true);
setStatusBarColor(this,android.R.color.white);
ViewUtils.inject(this);
id = getIntent().getStringExtra("id");
if(TextUtils.isEmpty(id)){
ToastUtils.show("参数丢失");
onBackPressed();
return;
}
titleTv.setText("详情");
roundlayoutPic.setRoundLayoutRadius(20f);
roundlayoutPic.setRoundLayoutBorder(Color.parseColor("#999999"),1);
roundlayoutAddPic.setRoundLayoutRadius(20f);
roundlayoutAddPic.setRoundLayoutBorder(Color.parseColor("#999999"),1);
loadData();
}
@OnClick({R.id.backBtn,R.id.bindBtn,R.id.editBtn,R.id.addPic})
public void click(View view){
switch (view.getId()){
case R.id.backBtn:
onBackPressed();
break;
case R.id.bindBtn:
readDataFromDevice();
break;
case R.id.editBtn:
idAndRemarkFrame.setVisibility(View.GONE);
roundlayoutAddPic.setVisibility(View.VISIBLE);
idNumFrame.setVisibility(View.VISIBLE);
remarkFrame.setVisibility(View.VISIBLE);
bindBtn.setVisibility(View.VISIBLE);
editBtn.setVisibility(View.GONE);
break;
case R.id.addPic:
takePhoto();
break;
}
}
private void loadData(){
HttpPostHelper.httpGet(this, Constant.API_PASS_USER_DETAIL+id, new DialogHttpCallBack(this) {
@Override
public void successCallBack(String result) {
super.successCallBack(result);
bean = new Gson().fromJson(result,PassThroughDetailBean.class);
setViews();
}
}, null);
}
private void setViews(){
if(bean != null){
name.setText(bean.getName());
tel.setText(bean.getPhone());
company.setText(bean.getCompanyName());
if(bean.getIsBindingId() == 1){
idAndRemarkFrame.setVisibility(View.VISIBLE);
idNum.setText(bean.getIdentityCard());
remark.setText(bean.getRemark());
idNumFrame.setVisibility(View.GONE);
inputId.setText(bean.getIdentityCard());
remark.setText(bean.getRemark());
remarkFrame.setVisibility(View.GONE);
roundlayoutAddPic.setVisibility(View.GONE);
bindBtn.setVisibility(View.GONE);
editBtn.setVisibility(View.VISIBLE);
}else{
idAndRemarkFrame.setVisibility(View.GONE);
roundlayoutPic.setVisibility(View.GONE);
roundlayoutAddPic.setVisibility(View.VISIBLE);
idNumFrame.setVisibility(View.VISIBLE);
remarkFrame.setVisibility(View.VISIBLE);
bindBtn.setVisibility(View.VISIBLE);
editBtn.setVisibility(View.GONE);
}
initQiNiuToken();
}
}
private void initQiNiuToken(){
HttpPostHelper.httpGet(this, Constant.API_GET_QINIU_TOKEN, new NOToastHttpCallBack() {
@Override
public void successCallBack(String result) {
super.successCallBack(result);
LogUtils.e("aaaa","json == ====" +result);
qiNiuTokenBean = new Gson().fromJson(result, QiNiuTokenBean.class);
//设置身份证图片
if(qiNiuTokenBean != null && !TextUtils.isEmpty(qiNiuTokenBean.url)){
if(bean.getIsBindingId() == 1) {
if(!TextUtils.isEmpty(bean.getIdentityImg())){
roundlayoutPic.setVisibility(View.VISIBLE);
netPicUtil.setDefaultPics(R.mipmap.ic_the, R.mipmap.ic_the, R.mipmap.ic_the);
netPicUtil.display(pic, qiNiuTokenBean.url + bean.getIdentityImg());
}else{
roundlayoutPic.setVisibility(View.GONE);
}
}
}
}
}, null);
}
private void takePhoto(){
PictureSelector.create(this)
.openCamera(PictureMimeType.ofImage())
.theme(R.style.picture_default_style)
.maxSelectNum(1)// 最大图片选择数量
.minSelectNum(1)// 最小选择数量
.imageSpanCount(4)// 每行显示个数
.selectionMode(PictureConfig.SINGLE)// 多选 or 单选
.previewImage(true)// 是否可预览图片
.isCamera(true)// 是否显示拍照按钮
.isZoomAnim(true)// 图片列表点击 缩放效果 默认true
.enableCrop(false)// 是否裁剪
.compress(true)// 是否压缩
.synOrAsy(true)//同步true或异步false 压缩 默认同步
.glideOverride(160, 160)// glide 加载宽高,越小图片列表越流畅,但会影响列表图片浏览的清晰度
.freeStyleCropEnabled(true)// 裁剪框是否可拖拽
.selectionMedia(mSelectList)// 是否传入已选图片
.minimumCompressSize(100)// 小于100kb的图片不压缩
.forResult(PictureConfig.CHOOSE_REQUEST);//结果回调onActivityResult code
}
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (data == null) {
return;
}
switch (requestCode) {
case PictureConfig.CHOOSE_REQUEST:
// 图片选择结果回调
mSelectList = PictureSelector.obtainMultipleResult(data);
if(mSelectList != null && mSelectList.size() > 0) {
picMedia = mSelectList.get(0);
pic.setImageBitmap(BitmapFactory.decodeFile(getLocalMediaPath(picMedia)));
roundlayoutPic.setVisibility(View.VISIBLE);
}
break;
}
}
//获取LocalMedia的路径
private String getLocalMediaPath(LocalMedia media){
String path = "";
if (media.isCut() && !media.isCompressed()) {
// 裁剪过
path = media.getCutPath();
} else if (media.isCompressed() || (media.isCut() && media.isCompressed())) {
// 压缩过,或者裁剪同时压缩过,以最终压缩过图片为准
path = media.getCompressPath();
} else {
// 原图
path = media.getPath();
}
return path;
}
/**
* 从设备读取数据
*/
private boolean startReadDeviceData = false;
private CountDownTimer countDownTimer;
private void readDataFromDevice(){
startReadDeviceData = true;
if(countDownTimer != null)
countDownTimer.cancel();
countDownTimer = new CountDownTimer(3000,1000) {
@Override
public void onTick(long l) {
}
@Override
public void onFinish() {
dismmisLoadingDialog();
showReadIdAlert();
/*invsIdCard bean = new invsIdCard();
bean.setName("hahahah");
bean.setSex1("男");
bean.setIdNo("12341412312312312");
showReadIdSuccessAlert(bean);*/
}
}.start();
showLoadingDialog();
}
//显示去读取身份证弹框
private void showReadIdAlert(){
AlertDialog.Builder builder = new AlertDialog.Builder(this);
final Dialog dialog = builder.create();
LayoutInflater inflaterDl = LayoutInflater.from(this);
RelativeLayout layout = (RelativeLayout) inflaterDl.inflate(R.layout.layout_dialog_read_id_info, null);
dialog.show();
dialog.getWindow().setContentView(layout);
TextView btn = layout.findViewById(R.id.btn);
btn.setOnClickListener(v -> {
dialog.dismiss();
});
}
public void readIdCardFailure(){
if(startReadDeviceData) {
runOnUiThread(() -> {
showReadIdAlert();
dismmisLoadingDialog();
});
if (countDownTimer != null)
countDownTimer.cancel();
}
}
public void setIdCardInfo(invsIdCard invsIdCard){
if(startReadDeviceData) {
runOnUiThread(() -> {
showReadIdSuccessAlert(invsIdCard);
dismmisLoadingDialog();
});
if (countDownTimer != null)
countDownTimer.cancel();
}
}
private void showReadIdSuccessAlert(invsIdCard invsIdCard){
if (invsIdCard != null) {
//解析身份证图片
identityImgBitmap = IDCardUtils.Wlt2Bitmap(invsIdCard.wlt);
idPicInDialog.setImageBitmap(identityImgBitmap);
pic.setImageBitmap(identityImgBitmap);
roundlayoutPic.setVisibility(View.VISIBLE);
gender = invsIdCard.getSex1();
inputId.setText(invsIdCard.getIdNo());
nameInDialog.setText(invsIdCard.getName());
genderInDialog.setText(invsIdCard.getSex1());
idCodeInDialog.setText(invsIdCard.getIdNo());
readSuccessDialogFrame.setVisibility(View.VISIBLE);
bindBtnInDialog.setOnClickListener(v -> {
readSuccessDialogFrame.setVisibility(View.GONE);
bindId(invsIdCard);
});
}else{
show("读取身份信息失败");
}
}
private void bindId(invsIdCard info){
if(info != null) {
invsIdCard = info;
pic.setImageBitmap(identityImgBitmap);
name.setText(info.getName());
idNum.setText(info.getIdNo());
uploadImages();
}
}
private Bitmap identityImgBitmap;
private ArrayList<UploadFileInfoBean> files;//需要上传的图片信息数组
private void uploadImages(){
if (qiNiuTokenBean == null) {
show("获取七牛token失败");
return;
}
if(picMedia != null || identityImgBitmap != null){
files = new ArrayList<>();
//先处理bitmap,身份证bitmap
if (identityImgBitmap != null) {
try {
String path = ImageUtil.saveImageToFile(identityImgBitmap);
if (!TextUtils.isEmpty(path)) {
File file = new File(path);
LogUtils.e("aaa", "file = " + file.getAbsolutePath());
if (file.exists() && file.isFile()) {
LogUtils.e("aaa", "add idImg");
files.add(new UploadFileInfoBean(file, "idImg", 0));
}
}
} catch (Exception e) {
e.printStackTrace();
// show(e.getMessage());
}
}
if (picMedia != null) {
File file = new File(getLocalMediaPath(picMedia));
if (file.exists() && file.isFile())
files.add(new UploadFileInfoBean(file, "otherImg", 0));
}
if(files.size() > 0) {
initPicUpload();
uploadFiles();
}else{
uploadData();
}
}else{
uploadData();
}
}
private UploadManager uploadManager;
private ProgressDialog progressDialog;
private void initPicUpload(){
Configuration config = new Configuration.Builder()
.responseTimeout(60)
.build();
uploadManager = new UploadManager(config);
progressDialog = new ProgressDialog(this,ProgressDialog.THEME_HOLO_LIGHT);
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressDialog.setTitle("上传图片");
progressDialog.setMax(100);
progressDialog.setProgress(0);
progressDialog.show();
}
private void uploadFiles(){
if(uploadManager != null){
needUploadBean = null;
//检测是否还有待上传的文件
for(UploadFileInfoBean bean : files){
if(bean.status == 0) {
needUploadBean = bean;
break;
}
}
if(needUploadBean != null){ //上传图片
String keyStr = "mctower_pic_" + System.currentTimeMillis() + "_" + new Random().nextInt(99999);
String msg = "";
switch (needUploadBean.type){
case "idImg":
msg = "正在上传身份证头像";
break;
case "otherImg":
msg = "正在上传证件照片";
break;
}
progressDialog.setMessage(msg);
uploadManager.put(needUploadBean.file, keyStr, qiNiuTokenBean.token,
(key, info, res) -> {
//res包含hash、key等信息,具体字段取决于上传策略的设置
if (info.isOK()) {
LogUtils.e("qiniu", "Upload Success");
needUploadBean.url = key;
needUploadBean.status = 1;
progressDialog.dismiss();
} else {
LogUtils.e("qiniu", "Upload Fail info=" + info + " res = " + res);
//如果失败,这里可以把info信息上报自己的服务器,便于后面分析上传错误原因
runOnUiThread(new Runnable() {
public void run() {
show("上传图片失败");
}
});
needUploadBean.status = -1;
progressDialog.dismiss();
}
uploadFiles();
// LogUtils.e("qiniu", key + ",\r\n " + info + ",\r\n " + res);
}, new UploadOptions(null, null, false,
(key, percent) -> {
progressDialog.setMax(100);
progressDialog.setProgress((int) (percent * 100));
LogUtils.e("qiniu", "key = " + key + ",percent = " + percent);
}, null));
}else{ //图片都已上传过,提交数据到服务器
for(UploadFileInfoBean bean : files){
if(bean.status == 1) {
switch (bean.type){
case "idImg":
case "otherImg":
identityImgUrl = bean.url;
break;
}
}
}
uploadData();
}
}
}
private void uploadData(){
if(TextUtils.isEmpty(inputId.getText().toString())){
ToastUtils.show("请输入证件号码");
return;
}
if(TextUtils.isEmpty(identityImgUrl)){
ToastUtils.show("请设置证件照片");
return;
}
PassThroughSaveBean saveBean = new PassThroughSaveBean();
saveBean.userUuid = bean.getUserUuid();
saveBean.userName = bean.getName();
saveBean.identityCard = inputId.getText().toString();
saveBean.identityImg = identityImgUrl;
saveBean.remark = inputRemark.getText().toString();
HttpPostHelper.httpPutJson(this, Constant.API_PASS_USER_BIND, new DialogHttpCallBack(this) {
@Override
public void successCallBack(String result) {
super.successCallBack(result);
ToastUtils.show("操作成功");
loadData();
}
}, new Gson().toJson(saveBean));
}
class UploadFileInfoBean{
public File file;
public String type;
public int status; // 0: 待上传 1:上传成功 -1:上传失败
public String url;
public UploadFileInfoBean(File file, String type, int stutas) {
this.file = file;
this.type = type;
this.status = stutas;
}
}
}
package cn.mctower.visitor;
import android.Manifest;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.google.gson.Gson;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.lidroid.xutils.view.annotation.event.OnClick;
import java.util.ArrayList;
import java.util.HashMap;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import cn.dankal.base.activity.NetBaseAppCompatActivity;
import cn.dankal.base.http.DialogHttpCallBack;
import cn.dankal.base.http.HttpPostHelper;
import cn.dankal.base.interfaces.IPermissionCheck;
import cn.dankal.base.utils.ToastUtils;
import cn.mctower.visitor.model.PassThroughRecordBean;
import cn.mctower.visitor.model.PassThroughRecordPageBean;
import cn.mctower.visitor.model.VisitRecordBean;
import cn.mctower.visitor.model.VisitRecordPageBean;
public class PassThroughQueryActivity extends NetBaseAppCompatActivity {
@ViewInject(R.id.titleTv)
TextView titleTv;
@ViewInject(R.id.visitorFrame)
LinearLayout visitorFrame;
@ViewInject(R.id.visitorBtn)
TextView visitorBtn;
@ViewInject(R.id.searchPageFrame)
LinearLayout searchPageFrame;
@ViewInject(R.id.input)
EditText input;
@ViewInject(R.id.inputMobile)
EditText inputMobile;
@ViewInject(R.id.searchBtn)
TextView searchBtn;
@ViewInject(R.id.listView)
RecyclerView listView;
private ArrayList<PassThroughRecordBean> data = new ArrayList<>();
private MyAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pass_through_query);
setAndroidNativeLightStatusBar(this,true);
setStatusBarColor(this,android.R.color.white);
ViewUtils.inject(this);
titleTv.setText("通行查询");
input.setOnEditorActionListener((v, actionId, event) -> {
if (actionId == EditorInfo.IME_ACTION_SEARCH || (event != null && event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) {
click(searchBtn);
return true;
}
return false;
});
inputMobile.setOnEditorActionListener((v, actionId, event) -> {
if (actionId == EditorInfo.IME_ACTION_SEARCH || (event != null && event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) {
click(searchBtn);
return true;
}
return false;
});
LinearLayoutManager lm = new LinearLayoutManager(this);
lm.setOrientation(LinearLayoutManager.VERTICAL);
listView.setLayoutManager(lm);
adapter = new MyAdapter();
listView.setAdapter(adapter);
String[] permission = new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE};
requestPermissions(permission, 12122, "需要存储权限", new IPermissionCheck() {
@Override
public void hasGotPermissions(int code) {
}
});
}
@OnClick({R.id.backBtn,R.id.visitorBtn,R.id.searchBtn})
public void click(View view){
switch (view.getId()){
case R.id.backBtn:
onBackPressed();
break;
case R.id.visitorBtn:
if(!TextUtils.isEmpty(inputMobile.getText().toString().trim())){
doSearch(inputMobile.getText().toString().trim());
}
visitorFrame.setVisibility(View.GONE);
searchPageFrame.setVisibility(View.VISIBLE);
break;
case R.id.searchBtn:
if(!TextUtils.isEmpty(input.getText().toString().trim())){
doSearch(input.getText().toString().trim());
}
break;
}
}
private void doSearch(String key){
HashMap<String,String> param = new HashMap<>();
if(!TextUtils.isEmpty(key)) {
param.put("search", key);
param.put("pageIndex", "1");
param.put("pageSize", "10000");
HttpPostHelper.httpGet(this, Constant.API_PASS_USER_LIST, new DialogHttpCallBack(this) {
@Override
public void requestStart() {
super.requestStart();
data.clear();
}
@Override
public void successCallBack(String result) {
super.successCallBack(result);
PassThroughRecordPageBean bean = new Gson().fromJson(result, PassThroughRecordPageBean.class);
if (bean != null && bean.data != null) {
data.addAll(bean.data);
adapter.notifyDataSetChanged();
}
}
@Override
public void requestFinish() {
super.requestFinish();
titleTv.setText("查询结果");
}
}, param);
}else
ToastUtils.show("请输入手机号后再进行搜索");
}
class MyAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>{
private LayoutInflater layoutInflater = LayoutInflater.from(PassThroughQueryActivity.this);
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View itemView = layoutInflater.inflate(R.layout.itme_pass_record, parent, false);
return new CustomViewHolder(itemView);
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
PassThroughRecordBean bean = data.get(position);
CustomViewHolder viewHolder = (CustomViewHolder) holder;
viewHolder.name.setText(bean.getName());
viewHolder.mobile.setText(bean.getPhone());
viewHolder.company.setText(bean.getCompanyName());
viewHolder.item.setOnClickListener(view -> {
if(!TextUtils.isEmpty(bean.getUuid())) {
Intent intent = new Intent(PassThroughQueryActivity.this, PassThroughDetailActivity.class);
intent.putExtra("id", bean.getUuid());
startActivity(intent);
}else
ToastUtils.show("本条邀请还未分享给访客");
});
}
@Override
public int getItemCount() {
return data.size();
}
}
class CustomViewHolder extends RecyclerView.ViewHolder{
private RelativeLayout item;
private TextView name;
private TextView mobile;
private TextView company;
public CustomViewHolder(@NonNull View itemView) {
super(itemView);
item = itemView.findViewById(R.id.item);
name = itemView.findViewById(R.id.name);
mobile = itemView.findViewById(R.id.mobile);
company = itemView.findViewById(R.id.company);
}
}
}
package cn.mctower.visitor;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.widget.RelativeLayout;
public class RoundLayout extends RelativeLayout {
private float roundLayoutRadius = 14f;
private int borderColor = Color.WHITE;
private int borderWidth = 0;
private Path roundPath;
private RectF rectF;
private RectF rectFBorder;
private Paint paint;
public RoundLayout(Context context) {
this(context, null);
}
public RoundLayout(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
private void init() {
setWillNotDraw(false);//如果你继承的是ViewGroup,注意此行,否则draw方法是不会回调的;
roundPath = new Path();
rectF = new RectF();
paint = new Paint();
paint.setColor(Color.WHITE);
paint.setAntiAlias(true);
}
private void setRoundPath() {
//添加一个圆角矩形到path中, 如果要实现任意形状的View, 只需要手动添加path就行
roundPath.addRoundRect(rectF, roundLayoutRadius, roundLayoutRadius, Path.Direction.CW);
}
public void setRoundLayoutRadius(float roundLayoutRadius) {
this.roundLayoutRadius = roundLayoutRadius;
setRoundPath();
postInvalidate();
}
public void setRoundLayoutBorder(int borderColor,int borderWidth) {
this.borderColor = borderColor;
this.borderWidth = borderWidth;
this.paint.setColor(borderColor);
this.paint.setStrokeWidth(borderWidth *2);
postInvalidate();
}
public void setBorderInfo(BorderInfo borderInfo){
if(borderInfo != null){
if(borderInfo.radius > 0f)
setRoundLayoutRadius(borderInfo.radius);
if(borderInfo.borderWidth > 0) {
setRoundLayoutBorder(borderInfo.borderColor, borderInfo.borderWidth);
}
}
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
rectF.set(0f, 0f, getMeasuredWidth(), getMeasuredHeight());
setRoundPath();
}
@Override
public void draw(Canvas canvas) {
if (roundLayoutRadius > 0f) {
try {
canvas.clipPath(roundPath);
}catch (Exception e){
e.printStackTrace();
}
}
super.draw(canvas);
if(borderWidth > 0){
if(rectFBorder == null) {
paint.setStyle(Paint.Style.STROKE);;
rectFBorder = new RectF();
rectFBorder.set(0, 0, getMeasuredWidth(), getMeasuredHeight());
}
canvas.drawRoundRect(rectFBorder,roundLayoutRadius,roundLayoutRadius,paint);
}
}
public class BorderInfo {
public float radius;
public int borderColor;
public int borderWidth;
}
}
\ No newline at end of file
package cn.mctower.visitor.model;
/**
* Author:Alex tang
* Date:2020-11-07
* Time:09:21
* Description:
*/
public class PassRecordBean {
public String id;
public String name;
public String company;
public String mobile;
public String idNum;
public String idCardUrl;
public String remark;
public String isBind;
}
package cn.mctower.visitor.model;
/**
* Author:Alex tang
* Date:2020-11-09
* Time:09:13
* Description:
*/
public class PassThroughDetailBean {
/**
* uuid : c6a3a892630240f4aac7d4c8fc27302b
* userUuid : a73c59ee04f34d3abf7cfc5c18ce1618
* name : 韩艳秋
* phone : 13923713519
* isBindingId : 0
* companyName : 科通集团
* identityImg :
* identityCard :
* remark :
*/
private String uuid;
private String userUuid;
private String name;
private String phone;
private int isBindingId;
private String companyName;
private String identityImg;
private String identityCard;
private String remark;
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public String getUserUuid() {
return userUuid;
}
public void setUserUuid(String userUuid) {
this.userUuid = userUuid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public int getIsBindingId() {
return isBindingId;
}
public void setIsBindingId(int isBindingId) {
this.isBindingId = isBindingId;
}
public String getCompanyName() {
return companyName;
}
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
public String getIdentityImg() {
return identityImg;
}
public void setIdentityImg(String identityImg) {
this.identityImg = identityImg;
}
public String getIdentityCard() {
return identityCard;
}
public void setIdentityCard(String identityCard) {
this.identityCard = identityCard;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}
package cn.mctower.visitor.model;
/**
* Author:Alex tang
* Date:2020-11-09
* Time:09:02
* Description:
*/
public class PassThroughRecordBean {
/**
* uuid : b9f342f65781435ab7e0e9fde1b7f66c
* userUuid : 6069badb7b8241fab3abf8f628b2c689
* name : 罗铖
* phone : 13510503290
* isBindingId : 0
* companyName : 科通集团
*/
private String uuid;
private String userUuid;
private String name;
private String phone;
private int isBindingId;
private String companyName;
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public String getUserUuid() {
return userUuid;
}
public void setUserUuid(String userUuid) {
this.userUuid = userUuid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public int getIsBindingId() {
return isBindingId;
}
public void setIsBindingId(int isBindingId) {
this.isBindingId = isBindingId;
}
public String getCompanyName() {
return companyName;
}
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
}
package cn.mctower.visitor.model;
import java.util.ArrayList;
/**
* Author:Alex tang
* Date:2020-07-21
* Time:13:30
* Description:
*/
public class PassThroughRecordPageBean {
public ArrayList<PassThroughRecordBean> data;
}
package cn.mctower.visitor.model;
/**
* Author:Alex tang
* Date:2020-11-09
* Time:09:37
* Description:
*/
public class PassThroughSaveBean {
/**
* identityCard : 4113*****
* identityImg : img
* remark : string
* sex : 男女
* userName : wjz
* userUuid : uuid
*/
public String identityCard;
public String identityImg;
public String remark;
public String sex;
public String userName;
public String userUuid;
}
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:startColor="#ffffff"
android:endColor="#ffffff"
android:angle="0"
/>
<stroke android:color="#999999"
android:width="1px"/>
<corners
android:radius="6dp"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".HomePageActivity"
android:background="@color/pageBg"
android:orientation="vertical">
<include layout="@layout/sub_layout_titlebar"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center"
android:layout_marginTop="130dp">
<LinearLayout
android:id="@+id/passCode"
android:layout_width="100dp"
android:layout_height="100dp"
android:orientation="vertical"
android:gravity="center"
android:background="#ffffff">
<ImageView
android:layout_width="33dp"
android:layout_height="33dp"
android:scaleType="fitXY"
android:src="@mipmap/ic_passcode"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#333333"
android:layout_marginTop="12dp"
android:textSize="12sp"
android:text="通行码"/>
</LinearLayout>
<LinearLayout
android:id="@+id/visitor"
android:layout_width="100dp"
android:layout_height="100dp"
android:orientation="vertical"
android:gravity="center"
android:background="#ffffff"
android:layout_marginLeft="25dp">
<ImageView
android:layout_width="33dp"
android:layout_height="33dp"
android:scaleType="fitXY"
android:src="@mipmap/ic_visitors"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#333333"
android:layout_marginTop="12dp"
android:textSize="12sp"
android:text="访客"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".PassThroughDetailActivity"
android:background="@color/pageBg"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include layout="@layout/sub_layout_titlebar"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/roundrectangle_white_bg"
android:layout_marginLeft="22dp"
android:layout_marginRight="22dp"
android:layout_marginBottom="11dp"
android:layout_marginTop="15dp"
android:translationZ="10dp"
android:elevation="1dp"
android:orientation="vertical"
android:paddingTop="15dp"
android:paddingStart="20dp"
android:paddingEnd="20dp"
android:paddingBottom="15dp">
<TextView
android:id="@+id/nameTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="姓名"
android:textColor="#ABB2B7"
android:textSize="14sp"/>
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="xxx"
android:textColor="#2D506B"
android:textSize="14sp"/>
<TextView
android:id="@+id/telTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="手机号"
android:layout_below="@id/name"
android:layout_marginTop="12dp"
android:textColor="#ABB2B7"
android:textSize="14sp"/>
<TextView
android:id="@+id/tel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="12dp"
android:layout_below="@id/name"
android:text="xxx"
android:textColor="#2D506B"
android:textSize="14sp"/>
<TextView
android:id="@+id/companyTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="所在企业"
android:layout_below="@id/tel"
android:layout_marginTop="12dp"
android:textColor="#ABB2B7"
android:textSize="14sp"/>
<TextView
android:id="@+id/company"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="12dp"
android:layout_below="@id/tel"
android:text="xxx"
android:layout_toRightOf="@id/companyTitle"
android:gravity="right"
android:textColor="#2D506B"
android:textSize="14sp"/>
<RelativeLayout
android:id="@+id/idAndRemarkFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/company"
android:visibility="gone">
<TextView
android:id="@+id/idTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="身份证号"
android:layout_marginTop="12dp"
android:textColor="#ABB2B7"
android:textSize="14sp"/>
<TextView
android:id="@+id/idNum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="12dp"
android:text="xxx"
android:textColor="#2D506B"
android:textSize="14sp"/>
<TextView
android:id="@+id/remarkTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="备注"
android:layout_marginTop="12dp"
android:layout_below="@id/idTitle"
android:textColor="#ABB2B7"
android:textSize="14sp"/>
<TextView
android:id="@+id/remark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="12dp"
android:layout_below="@id/idTitle"
android:text="xxx"
android:textColor="#2D506B"
android:textSize="14sp"/>
</RelativeLayout>
<TextView
android:id="@+id/line"
android:layout_width="match_parent"
android:layout_height="1px"
android:background="#E0E0E0"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:layout_below="@id/idAndRemarkFrame"/>
<LinearLayout
android:id="@+id/idNumFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="7dp"
android:paddingBottom="7dp"
android:background="@drawable/roundrectangle_white_bg_gray_order"
android:gravity="center_vertical"
android:layout_below="@id/line">
<EditText
android:id="@+id/inputId"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="15dp"
android:layout_marginLeft="10dp"
android:textSize="13sp"
android:maxLength="18"
android:textColor="#333333"
android:singleLine="true"
android:inputType="number"
android:lines="1"
android:paddingStart="10dp"
android:background="@null"
android:hint="请输入证件号码"
android:textColorHint="#CCCCCC"/>
</LinearLayout>
<LinearLayout
android:id="@+id/remarkFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="7dp"
android:paddingBottom="7dp"
android:background="@drawable/roundrectangle_white_bg_gray_order"
android:gravity="center_vertical"
android:layout_below="@id/idNumFrame"
android:layout_marginTop="15dp">
<EditText
android:id="@+id/inputRemark"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="15dp"
android:layout_marginLeft="10dp"
android:textSize="13sp"
android:textColor="#333333"
android:singleLine="true"
android:inputType="textMultiLine"
android:paddingStart="10dp"
android:background="@null"
android:hint="请输入备注"
android:textColorHint="#CCCCCC"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_below="@id/remarkFrame"
android:layout_marginTop="15dp">
<cn.mctower.visitor.RoundLayout
android:id="@+id/roundlayoutPic"
android:layout_width="90dp"
android:layout_height="90dp"
android:background="@color/white"
android:layout_marginRight="15dp">
<ImageView
android:id="@+id/pic"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"/>
</cn.mctower.visitor.RoundLayout>
<cn.mctower.visitor.RoundLayout
android:id="@+id/roundlayoutAddPic"
android:layout_width="90dp"
android:layout_height="90dp"
android:background="@color/white">
<TextView
android:id="@+id/addPic"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="12sp"
android:textColor="#ABB2B7"
android:gravity="center"
android:text="添加证件\n照片"/>
</cn.mctower.visitor.RoundLayout>
</LinearLayout>
</RelativeLayout>
<TextView
android:id="@+id/bindBtn"
android:layout_width="wrap_content"
android:layout_height="49dp"
android:layout_marginTop="32dp"
android:textColor="@android:color/white"
android:textSize="19sp"
android:textStyle="bold"
android:paddingLeft="39dp"
android:paddingRight="39dp"
android:translationZ="4dp"
android:elevation="1dp"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:background="@drawable/left_right_ring_lightblue_to_blue_bg"
android:text="绑定身份证"/>
<TextView
android:id="@+id/editBtn"
android:layout_width="wrap_content"
android:layout_height="49dp"
android:layout_marginTop="32dp"
android:textColor="#2D506B"
android:textSize="19sp"
android:textStyle="bold"
android:paddingLeft="39dp"
android:paddingRight="39dp"
android:translationZ="4dp"
android:elevation="1dp"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:background="@drawable/left_right_ring_white_bg"
android:visibility="gone"
android:layout_marginBottom="20dp"
android:text="编辑信息"/>
</LinearLayout>
<RelativeLayout
android:id="@+id/readSuccessDialogFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#44000000"
android:visibility="gone">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:layout_centerInParent="true"
android:background="@drawable/roundrectangle_white_bg">
<RelativeLayout
android:id="@+id/infoFrame1"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/idPicInDialog"
android:layout_width="71dp"
android:layout_height="86dp"
android:src="@mipmap/ic_the"
android:layout_marginTop="19dp"
android:layout_marginLeft="19dp"
android:layout_marginRight="12dp"
android:layout_marginBottom="22dp"
android:scaleType="centerCrop"/>
<RelativeLayout
android:id="@+id/titleFrame1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignTop="@id/idPicInDialog"
android:layout_alignBottom="@id/idPicInDialog"
android:layout_toRightOf="@id/idPicInDialog">
<TextView
android:textSize="16sp"
android:textColor="#ABB2B7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:text="姓名"/>
<TextView
android:textSize="16sp"
android:textColor="#ABB2B7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="性别"/>
<TextView
android:textSize="16sp"
android:textColor="#ABB2B7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_alignParentBottom="true"
android:text="身份证"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignTop="@id/idPicInDialog"
android:layout_alignBottom="@id/idPicInDialog"
android:layout_alignParentRight="true"
android:layout_marginRight="20dp">
<TextView
android:id="@+id/nameInDialog"
android:textSize="16sp"
android:textColor="#2D506B"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:layout_alignParentRight="true" />
<TextView
android:id="@+id/genderInDialog"
android:textSize="16sp"
android:textColor="#2D506B"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentRight="true" />
<TextView
android:id="@+id/idCodeInDialog"
android:textSize="16sp"
android:textColor="#2D506B"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true" />
</RelativeLayout>
</RelativeLayout>
<TextView
android:id="@+id/cancelBtnInDialog"
android:layout_width="130dp"
android:layout_height="39dp"
android:textColor="#2D506B"
android:textSize="19sp"
android:gravity="center"
android:layout_below="@id/infoFrame1"
android:layout_marginTop="10dp"
android:layout_marginLeft="15dp"
android:layout_marginBottom="27dp"
android:translationZ="5dp"
android:background="@drawable/left_right_ring_white_bg"
android:text="取消"/>
<TextView
android:id="@+id/bindBtnInDialog"
android:layout_width="130dp"
android:layout_height="39dp"
android:textColor="#ffffff"
android:textSize="19sp"
android:gravity="center"
android:layout_below="@id/infoFrame1"
android:layout_marginTop="10dp"
android:layout_marginRight="15dp"
android:layout_marginBottom="27dp"
android:translationZ="5dp"
android:background="@drawable/left_right_ring_lightblue_to_blue_bg"
android:layout_alignParentRight="true"
android:text="绑定"/>
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".PassThroughQueryActivity"
android:background="@color/pageBg"
android:orientation="vertical">
<include layout="@layout/sub_layout_titlebar"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- 搜索布局 -->
<LinearLayout
android:id="@+id/visitorFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:visibility="visible">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@drawable/roundrectangle_white_bg_gray_order"
android:layout_marginLeft="22dp"
android:layout_marginRight="22dp"
android:layout_marginTop="60dp"
android:gravity="center_vertical">
<ImageView
android:layout_width="16dp"
android:layout_height="22dp"
android:src="@mipmap/ic_phone"
android:layout_marginLeft="15dp"/>
<EditText
android:id="@+id/inputMobile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="15dp"
android:layout_marginLeft="10dp"
android:textSize="17sp"
android:textColor="#333333"
android:singleLine="true"
android:inputType="number"
android:lines="1"
android:paddingStart="10dp"
android:background="@null"
android:hint="请输入手机号"
android:textColorHint="#CCCCCC"/>
</LinearLayout>
<TextView
android:id="@+id/visitorBtn"
android:layout_width="120dp"
android:layout_height="49dp"
android:layout_marginTop="32dp"
android:textColor="@android:color/white"
android:textSize="19sp"
android:textStyle="bold"
android:gravity="center"
android:background="@drawable/left_right_ring_lightblue_to_blue_bg"
android:text="搜索"/>
</LinearLayout>
<!-- 搜索布局 -->
<LinearLayout
android:id="@+id/searchPageFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:visibility="gone">
<RelativeLayout
android:id="@+id/searchFrame"
android:layout_width="match_parent"
android:layout_height="60dp"
android:paddingLeft="17dp"
android:paddingRight="21dp"
android:paddingStart="17dp"
android:paddingEnd="21dp"
android:background="@android:color/white">
<TextView
android:id="@+id/searchBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:paddingStart="15dp"
android:paddingEnd="15dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:textStyle="bold"
android:gravity="center"
android:background="@drawable/left_right_ring_lightblue_to_blue_bg"
android:text="搜索"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/roundrectangle_white_bg_gray_order"
android:layout_marginRight="15dp"
android:gravity="center_vertical"
android:layout_centerVertical="true"
android:layout_toLeftOf="@id/searchBtn">
<ImageView
android:layout_width="11dp"
android:layout_height="16dp"
android:src="@mipmap/ic_phone"
android:layout_marginLeft="15dp"/>
<EditText
android:id="@+id/input"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="15dp"
android:layout_marginLeft="10dp"
android:textSize="12sp"
android:textColor="#333333"
android:background="@null"
android:singleLine="true"
android:lines="1"
android:inputType="number"
android:paddingStart="10dp"
android:gravity="center_vertical"
android:hint="请输入手机号"
android:textColorHint="#CCCCCC"/>
</LinearLayout>
</RelativeLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/left_right_roundrectangle_white_bg"
android:layout_marginLeft="22dp"
android:layout_marginRight="22dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="14dp"
android:translationZ="20dp">
<TextView
android:id="@+id/nameTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="13dp"
android:textColor="#ABB2B7"
android:textSize="16sp"
android:layout_marginBottom="8dp"
android:layout_marginTop="12dp"
android:text="姓名"
/>
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="15dp"
android:layout_marginTop="12dp"
android:textSize="16sp"
android:textColor="#2D506B"
android:layout_marginBottom="8dp"
android:text="xxxxxx"/>
<TextView
android:id="@+id/mobileTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="13dp"
android:textColor="#ABB2B7"
android:textSize="16sp"
android:layout_marginBottom="8dp"
android:text="手机号码"
android:layout_below="@id/nameTitle"
/>
<TextView
android:id="@+id/mobile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginBottom="8dp"
android:layout_marginRight="15dp"
android:textSize="16sp"
android:textColor="#2D506B"
android:layout_below="@id/name"
android:text="xxxxxx"/>
<TextView
android:id="@+id/comTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="13dp"
android:textColor="#ABB2B7"
android:textSize="16sp"
android:layout_marginBottom="12dp"
android:layout_below="@id/mobileTitle"
android:text="所在企业"
/>
<TextView
android:id="@+id/company"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="15dp"
android:layout_marginBottom="12dp"
android:textSize="16sp"
android:layout_below="@id/mobile"
android:layout_toRightOf="@id/comTitle"
android:layout_marginLeft="10dp"
android:lines="1"
android:ellipsize="end"
android:singleLine="true"
android:textColor="#2D506B"
android:gravity="right"
android:text="xxxxxx"/>
</RelativeLayout>
\ No newline at end of file
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