Merge remote-tracking branch 'OutDoor/master'

This commit is contained in:
wds 2021-08-04 16:59:58 +08:00
commit 85335843ae
16 changed files with 357 additions and 246 deletions

View File

@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion '29.0.2'
// ndkVersion '23.0.7123448'
ndkVersion '23.0.7123448'
defaultConfig {
applicationId "com.navinfo.outdoor"

View File

@ -22,9 +22,10 @@ import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
public class StaySubmitAdapter extends RecyclerView.Adapter<StaySubmitAdapter.ViewHolder> {
private List<PoiEntity> allRoad = new ArrayList<>();
private Vector<PoiEntity> allRoad = new Vector<>();
private Context context;
public StaySubmitAdapter(Context context) {
@ -55,15 +56,17 @@ public class StaySubmitAdapter extends RecyclerView.Adapter<StaySubmitAdapter.Vi
new Thread(new Runnable() {
@Override
public void run() {
Iterator iterator = allRoad.iterator();
while (iterator.hasNext()) {
PoiEntity poiEntity = (PoiEntity) iterator.next();
if (poiEntity.isChecked()) {
PoiDatabase.getInstance(context).getPoiDao().deletePoiEntity(poiEntity);
iterator.remove();
synchronized (allRoad) {
Iterator iterator = allRoad.iterator();
while (iterator.hasNext()) {
PoiEntity poiEntity = (PoiEntity) iterator.next();
if (poiEntity.isChecked()) {
PoiDatabase.getInstance(context).getPoiDao().deletePoiEntity(poiEntity);
iterator.remove();
}
}
handler.sendEmptyMessage(0x105);
}
handler.sendEmptyMessage(0x105);
}
}).start();
@ -84,10 +87,11 @@ public class StaySubmitAdapter extends RecyclerView.Adapter<StaySubmitAdapter.Vi
holder.tvDay.setText(poiEntity.getCreateTime());
//获取checkBox点击的记录
holder.cbUnSubmit.setChecked(allRoad.get(position).isChecked());
holder.cbUnSubmit.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
holder.cbUnSubmit.setOnClickListener(new View.OnClickListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
allRoad.get(position).setChecked(isChecked);
public void onClick(View v) {
holder.cbUnSubmit.setChecked(!poiEntity.isChecked());
poiEntity.setChecked(!poiEntity.isChecked());
}
});
if (poiEntity.getIsLocalData() == 1){

View File

@ -438,9 +438,9 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
private void initShowPoi() {
// 添加信息
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
if (showPoiEntity.getTaskStatus()==1||showPoiEntity.getTaskStatus()==5){
if (showPoiEntity.getTaskStatus() == 1 || showPoiEntity.getTaskStatus() == 5) {
tvExamine.setVisibility(View.GONE);
}else {
} else {
tvExamine.setVisibility(View.VISIBLE);
}
String name = showPoiEntity.getName();//名称
@ -579,7 +579,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
obtain.what = Constant.CHARGING_STATION;
obtain.obj = showStation;
EventBus.getDefault().post(obtain);
}else {
} else {
Message obtains = Message.obtain();
obtains.what = Constant.CHARGING_STATION_PILE;
obtains.obj = null;
@ -1093,30 +1093,38 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
@Override
public void onSuccess(ChargingStationBean chargingStationBean, int id) {
dismissLoadingDialog();
bodyId = chargingStationBean.getBody();
poiEntity.setBodyId(bodyId);
poiEntity.setTaskStatus(3);
new Thread(new Runnable() {
@Override
public void run() {
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
// 充电站数据已经保存在服务上批量保存充电桩数据
saveChargingPileByChargingStation(poiEntity);
getActivity().runOnUiThread(new Runnable() {
if (chargingStationBean.getCode() == 200) {
bodyId = chargingStationBean.getBody();
if (bodyId != null && bodyId != 0) {
poiEntity.setBodyId(bodyId);
poiEntity.setTaskStatus(3);
new Thread(new Runnable() {
@Override
public void run() {
if (isLocal) {
stationUploadByNetWork(poiEntity, chargingStationList);
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
// 充电站数据已经保存在服务上批量保存充电桩数据
saveChargingPileByChargingStation(poiEntity);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if (isLocal) {
stationUploadByNetWork(poiEntity, chargingStationList);
// chargingPileUploadNetWork(chargingPileBody, fileList);
} else {
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
onBackPressed();
}
Log.d("TAG", "onSuccess: " + chargingStationBean.getBody());
} else {
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
onBackPressed();
}
Log.d("TAG", "onSuccess: " + chargingStationBean.getBody());
}
});
}
});
}).start();
} else {
Toast.makeText(getContext(), "" + chargingStationBean.getMessage(), Toast.LENGTH_SHORT).show();
}
}).start();
} else {
Toast.makeText(getContext(), "" + chargingStationBean.getMessage(), Toast.LENGTH_SHORT).show();
}
}
@Override
@ -1453,9 +1461,9 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
if (poiDaoPoiEntity != null) {
if (poiDaoPoiEntity.getTaskStatus()==5){
poiDao.deletePoiEntity(poiDaoPoiEntity);
}
if (poiDaoPoiEntity.getTaskStatus() == 5) {
poiDao.deletePoiEntity(poiDaoPoiEntity);
}
}
}
}).start();

View File

@ -680,9 +680,12 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
poiListEntity.setX(latPolygon.get(0).longitude + "");
poiListEntity.setY(latPolygon.get(0).latitude + "");
}
// 通知地图界面显示当前编辑数据的marker
senMessageMarker(poiEntity.getType(), poiEntity.getY(), poiEntity.getX());
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiListEntity);
if (poiListEntity.getTaskStatus()!=1){
// 通知地图界面显示当前编辑数据的marker
senMessageMarker(poiEntity.getType(), poiEntity.getY(), poiEntity.getX());
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiListEntity);
}
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
@ -789,9 +792,12 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
poiListEntity.setX(latPolygon.get(0).longitude + "");
poiListEntity.setY(latPolygon.get(0).latitude + "");
}
// 通知地图界面显示当前编辑数据的marker
senMessageMarker(poiEntity.getType(), poiEntity.getY(), poiEntity.getX());
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiListEntity);
if (poiListEntity.getTaskStatus()!=1){
// 通知地图界面显示当前编辑数据的marker
senMessageMarker(poiEntity.getType(), poiEntity.getY(), poiEntity.getX());
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiListEntity);
}
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {

View File

@ -526,26 +526,37 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
@Override
public void onSuccess(PoiSaveBean poiSaveBean, int id) {
dismissLoadingDialog();
Integer body = poiSaveBean.getBody();
poiEntity.setBodyId(body);
poiEntity.setTaskStatus(3);
new Thread(new Runnable() {
@Override
public void run() {
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
getActivity().runOnUiThread(new Runnable() {
if (poiSaveBean.getCode()==200){
Integer body = poiSaveBean.getBody();
if (body!=null&&body!=0){
poiEntity.setBodyId(body);
poiEntity.setTaskStatus(3);
new Thread(new Runnable() {
@Override
public void run() {
if (isLocal){
otherUploadByNet(body,otherUploadList);
}else {
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
onBackPressed();
}
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if (isLocal){
otherUploadByNet(body,otherUploadList);
}else {
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
onBackPressed();
}
}
});
}
});
}).start();
}else {
Toast.makeText(getActivity(), ""+poiSaveBean.getMessage(), Toast.LENGTH_SHORT).show();
}
}).start();
}else {
Toast.makeText(getActivity(), ""+poiSaveBean.getMessage(), Toast.LENGTH_SHORT).show();
}
}
@Override

View File

@ -799,26 +799,36 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
@Override
public void onSuccess(PoiSaveBean poiSaveBean, int id) {
dismissLoadingDialog();
Integer body = poiSaveBean.getBody();
poiEntity.setBodyId(body);
poiEntity.setTaskStatus(3);
new Thread(new Runnable() {
@Override
public void run() {
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
getActivity().runOnUiThread(new Runnable() {
if (poiSaveBean.getCode()==200){
Integer body = poiSaveBean.getBody();
if (body!=null&&body!=0){
poiEntity.setBodyId(body);
poiEntity.setTaskStatus(3);
new Thread(new Runnable() {
@Override
public void run() {
if (isLocal) {
poiUploadByNetWork(body, poiPicList);//上传
} else {
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
onBackPressed();
}
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if (isLocal) {
poiUploadByNetWork(body, poiPicList);//上传
} else {
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
onBackPressed();
}
}
});
}
});
}).start();
}else {
Toast.makeText(getActivity(), ""+poiSaveBean.getMessage(), Toast.LENGTH_SHORT).show();
}
}).start();
}else {
Toast.makeText(getActivity(), ""+poiSaveBean.getMessage(), Toast.LENGTH_SHORT).show();
}
}
@Override

View File

@ -14,6 +14,7 @@ import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
@ -91,6 +92,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
private Button btnPoiVideoUpload;
private String videoPath;
private File fileZip;
private FrameLayout fmPoiVideoPic;
public static PoiVideoFragment newInstance(Bundle bundle) {
PoiVideoFragment fragment = new PoiVideoFragment();
@ -151,12 +153,13 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
rbWalking = (RadioButton) findViewById(R.id.rb_walking);
rbManual = (RadioButton) findViewById(R.id.rb_manual);
etDesc = (EditText) findViewById(R.id.et_desc);
fmPoiVideoPic = findViewById(R.id.fm_poi_video_picture);
btnRoadSave = (Button) findViewById(R.id.btn_poi_video_save);
btnRoadSave.setOnClickListener(this::onClick);
btnPoiVideoUpload = findViewById(R.id.btn_poi_video_upload);
btnPoiVideoUpload.setOnClickListener(this::onClick);
rgType = (RadioGroup) findViewById(R.id.rg_type);
ivPoiVideoPicture.setOnClickListener(new View.OnClickListener() {
fmPoiVideoPic.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (v.getTag() == null) {
@ -164,19 +167,19 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
return;
}
File videoFile = (File) v.getTag();
Intent intent = new Intent(getContext(), PicturesActivity.class);
Intent intent = new Intent(getContext(), PictureActivity.class);
intent.putExtra(Constant.INTENT_VIDEO_PATH, videoFile.getAbsolutePath());
startActivityForResult(intent, 0x101);
}
});
ivPoiVideoPicture.setOnLongClickListener(new View.OnLongClickListener() {
fmPoiVideoPic.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
MessageDialog.show((AppCompatActivity) getContext(), "提示", "对否删除", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
File videoFile = (File) ivPoiVideoPicture.getTag();
File videoFile = (File) fmPoiVideoPic.getTag();
if (videoFile != null) {
videoFile.delete();
//获取文件名
@ -215,7 +218,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
if (videoFile.exists()) {
// 使用glide加载视频的第一帧
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivPoiVideoPicture, 500);
ivPoiVideoPicture.setTag(videoFile);
fmPoiVideoPic.setTag(videoFile);
}
}
}
@ -271,7 +274,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
// 根据用户点击的时间为视频名称赋值
DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
String videoFormatName = formatter.format(new Date());
Intent intent = new Intent(getContext(), PicturesActivity.class);
Intent intent = new Intent(getContext(), PictureActivity.class);
intent.putExtra(Constant.INTENT_VIDEO_PATH, Constant.PICTURE_FOLDER + "/" + videoFormatName + ".mp4");
startActivityForResult(intent, 0x101);
@ -280,8 +283,8 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
case R.id.btn_poi_video_upload:
showLoadingDialog();
ArrayList<File> videoFileList = new ArrayList<>();
if (ivPoiVideoPicture.getTag() != null) {
File videoFile = (File) ivPoiVideoPicture.getTag();
if (fmPoiVideoPic.getTag() != null) {
File videoFile = (File) fmPoiVideoPic.getTag();
videoFileList.add(videoFile);
File file = new File(videoFile.getPath()+".txt");
videoFileList.add(file);
@ -372,7 +375,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
poiEntity.setTaskId(showPoiEntity.getTaskId());
}
}
File videoFile = (File) ivPoiVideoPicture.getTag();
File videoFile = (File) fmPoiVideoPic.getTag();
if (videoFile == null ) {
Toast.makeText(getActivity(), "请录像", Toast.LENGTH_SHORT).show();
return;
@ -505,31 +508,36 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
@Override
public void onSuccess(PoiVideoBean poiVideoBean, int id) {
dismissLoadingDialog();
Integer poiVideoBody = poiVideoBean.getBody();
if (poiVideoBody != null && poiVideoBody != 0) {
poiEntity.setBodyId(poiVideoBody);
poiEntity.setTaskStatus(3);
new Thread(new Runnable() {
@Override
public void run() {
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if (isLocal) {
poiVideoUpload(poiVideoBody, fileZip);
} else {
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
onBackPressed();
if (poiVideoBean.getCode()==200){
Integer poiVideoBody = poiVideoBean.getBody();
if (poiVideoBody != null && poiVideoBody != 0) {
poiEntity.setBodyId(poiVideoBody);
poiEntity.setTaskStatus(3);
new Thread(new Runnable() {
@Override
public void run() {
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if (isLocal) {
poiVideoUpload(poiVideoBody, fileZip);
} else {
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
onBackPressed();
}
}
}
});
}
}).start();
} else {
});
}
}).start();
} else {
Toast.makeText(getActivity(), ""+poiVideoBean.getMessage(), Toast.LENGTH_SHORT).show();
}
}else {
Toast.makeText(getActivity(), ""+poiVideoBean.getMessage(), Toast.LENGTH_SHORT).show();
}
}
@Override
@ -552,7 +560,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
File videoFile = new File(videoPath);
if (videoFile.exists()) {
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivPoiVideoPicture, 500);
ivPoiVideoPicture.setTag(videoFile);
fmPoiVideoPic.setTag(videoFile);
}
}
}

View File

@ -14,6 +14,7 @@ import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
@ -86,6 +87,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
private Button roadUpload;
private String videoPath;
private File fileZip;
private FrameLayout fmRoadPic;
public static RoadFragment newInstance(Bundle bundle) {
RoadFragment fragment = new RoadFragment();
@ -147,12 +149,13 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
rbWalking = (RadioButton) findViewById(R.id.rb_walking);
rbManual = (RadioButton) findViewById(R.id.rb_manual);
etDesc = (EditText) findViewById(R.id.et_desc);
fmRoadPic = findViewById(R.id.fm_road_picture);
btnRoadSave = (Button) findViewById(R.id.btn_road_save);
btnRoadSave.setOnClickListener(this::onClick);
rgType = (RadioGroup) findViewById(R.id.rg_type);
roadUpload = findViewById(R.id.road_upload);
roadUpload.setOnClickListener(this::onClick);
ivRoadPicture.setOnClickListener(new View.OnClickListener() {
fmRoadPic.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (v.getTag() == null) {
@ -192,7 +195,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
if (videoFile.exists()) {
// 使用glide加载视频的第一帧
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivRoadPicture, 500);
ivRoadPicture.setTag(videoFile);
fmRoadPic.setTag(videoFile);
}
}
}
@ -263,9 +266,9 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
case R.id.road_upload:
showLoadingDialog();
ArrayList<File> videoFileList = new ArrayList<>();
if (ivRoadPicture.getTag() != null) {
if (fmRoadPic.getTag() != null) {
File videoFile = (File) ivRoadPicture.getTag();
File videoFile = (File) fmRoadPic.getTag();
videoFileList.add(videoFile);
File file = new File(videoFile.getPath() + ".txt");
videoFileList.add(file);
@ -346,11 +349,11 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
poiEntity.setTaskId(showPoiEntity.getTaskId());
}
}
if (ivRoadPicture.getTag() == null) {
if (fmRoadPic.getTag() == null) {
Toast.makeText(getActivity(), "请录像", Toast.LENGTH_SHORT).show();
return;
} else {
File videoFile = (File) ivRoadPicture.getTag();
File videoFile = (File) fmRoadPic.getTag();
String path = videoFile.getPath() + ".txt";
poiEntity.setPhoto(videoFile.getAbsolutePath());
List<String> strings = FileUtils.readFileToList(path, "utf-8");
@ -482,30 +485,35 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
@Override
public void onSuccess(RoadSaveBean roadSaveBean, int id) {
dismissLoadingDialog();
Integer roadBody = roadSaveBean.getBody();
if (roadBody!=null&&roadBody!=0){
poiEntity.setBodyId(roadBody);
poiEntity.setTaskStatus(3);
new Thread(new Runnable() {
@Override
public void run() {
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if (isLocal) {
poiVideoUpload(roadBody, fileZip);
} else {
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
onBackPressed();
}
}
});
}
}).start();
}else {
Toast.makeText(getContext(), ""+roadSaveBean.getMessage(), Toast.LENGTH_SHORT).show();
}
if (roadSaveBean.getCode()==200){
Integer roadBody = roadSaveBean.getBody();
if (roadBody!=null&&roadBody!=0){
poiEntity.setBodyId(roadBody);
poiEntity.setTaskStatus(3);
new Thread(new Runnable() {
@Override
public void run() {
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if (isLocal) {
poiVideoUpload(roadBody, fileZip);
} else {
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
onBackPressed();
}
}
});
}
}).start();
}else {
Toast.makeText(getContext(), ""+roadSaveBean.getMessage(), Toast.LENGTH_SHORT).show();
}
}else {
Toast.makeText(getContext(), ""+roadSaveBean.getMessage(), Toast.LENGTH_SHORT).show();
}
}
@ -530,7 +538,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
File videoFile = new File(videoPath);
if (videoFile.exists()) {
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivRoadPicture, 500);
ivRoadPicture.setTag(videoFile);
fmRoadPic.setTag(videoFile);
}
}
}

View File

@ -198,7 +198,7 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
staySubmitAdapter.setAllCheckedDelete();
refreshData();
// refreshData();
return false;
}
});

View File

@ -118,11 +118,33 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
startActivityForResult(ivAttestation3, 300);
break;
case R.id.btn_attestation:
/**
* static boolean ChineseNameTest(String name) {
* if (!name.matches("[\u4e00-\u9fa5]{2,4}")) {
* System.out.println("只能输入2到4个汉字");
* return false;
* }else return true;
* }
*/
if (etAttestationName.getText().toString() == null || etAttestationName.getText().toString().equals("")) {
Toast.makeText(getContext(), "姓名不能为空,请输入姓名", Toast.LENGTH_SHORT).show();
return;
}
if (!chineseNameTest(etAttestationName.getText().toString())){
Toast.makeText(getActivity(), "请输入中文名字", Toast.LENGTH_SHORT).show();
return;
}
if (!checkNum(etNamePhone.getText().toString().trim())) {
Toast.makeText(getContext(), "身份证号错误,请重新输入", Toast.LENGTH_SHORT).show();
return;
}
nameAuthentication();
break;
}
}
/***
*
*/
public boolean checkNum(String text) {
Pattern patternSfzhm1 = Pattern
.compile("^[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}$");
@ -135,7 +157,16 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
else return true;
}
/**
* 中文效验
*/
static boolean chineseNameTest(String name) {
if (!name.matches("[\u4e00-\u9fa5]{2,4}")) {
System.out.println("只能输入2到4个汉字");
return false;
}else return true;
}
private void nameAuthentication() {
if (etAttestationName.getText().toString() == null || etAttestationName.getText().toString().equals("")) {
Toast.makeText(getContext(), "姓名不能为空,请输入姓名", Toast.LENGTH_SHORT).show();
@ -222,73 +253,70 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
if (requestCode == 100 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
MessageDialog.show((AppCompatActivity) getContext(), "提示", "请重新拍照,要求横屏拍照", "确定").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intentPanorama, 100);
return false;
}
});
} else {
String takePhotoPath1 = PhotoPathUtil.getTakePhotoPath(data, "a", "");
ivAttestation1.setTag(takePhotoPath1);
ivAttestation1.setImageBitmap(bitmap);//显示图像
ivHera1.setVisibility(View.GONE);
tvCard1.setVisibility(View.GONE);
}
String takePhotoPath1 = PhotoPathUtil.getTakePhotoPath(data, "a", "");
ivAttestation1.setTag(takePhotoPath1);
ivAttestation1.setImageBitmap(bitmap);//显示图像
ivHera1.setVisibility(View.GONE);
tvCard1.setVisibility(View.GONE);
// int height = bitmap.getHeight();
// int width = bitmap.getWidth();
// if (height > width) {
// DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
// MessageDialog.show((AppCompatActivity) getContext(), "提示", "请重新拍照,要求横屏拍照", "确定").setOkButton(new OnDialogButtonClickListener() {
// @Override
// public boolean onClick(BaseDialog baseDialog, View v) {
// Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
// startActivityForResult(intentPanorama, 100);
// return false;
// }
// });
// }
}
if (requestCode == 200 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
MessageDialog.show((AppCompatActivity) getContext(), "提示", "请重新拍照,要求横屏拍照", "确定").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intentPanorama, 200);
return false;
}
});
} else {
String takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "a", "");
ivAttestation2.setTag(takePhotoPath2);
ivAttestation2.setImageBitmap(bitmap);//显示图像
ivHera2.setVisibility(View.GONE);
tvCard2.setVisibility(View.GONE);
}
String takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "a", "");
ivAttestation2.setTag(takePhotoPath2);
ivAttestation2.setImageBitmap(bitmap);//显示图像
ivHera2.setVisibility(View.GONE);
tvCard2.setVisibility(View.GONE);
// int height = bitmap.getHeight();
// int width = bitmap.getWidth();
// if (height > width) {
// DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
// MessageDialog.show((AppCompatActivity) getContext(), "提示", "请重新拍照,要求横屏拍照", "确定").setOkButton(new OnDialogButtonClickListener() {
// @Override
// public boolean onClick(BaseDialog baseDialog, View v) {
// Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
// startActivityForResult(intentPanorama, 200);
// return false;
// }
// });
// }
}
if (requestCode == 300 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
MessageDialog.show((AppCompatActivity) getContext(), "提示", "请重新拍照,要求横屏拍照", "确定").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intentPanorama, 300);
return false;
}
});
} else {
String takePhotoPath3 = PhotoPathUtil.getTakePhotoPath(data, "a", "");
ivAttestation3.setTag(takePhotoPath3);
ivAttestation3.setImageBitmap(bitmap);//显示图像
ivHera3.setVisibility(View.GONE);
tvCard3.setVisibility(View.GONE);
}
String takePhotoPath3 = PhotoPathUtil.getTakePhotoPath(data, "a", "");
ivAttestation3.setTag(takePhotoPath3);
ivAttestation3.setImageBitmap(bitmap);//显示图像
ivHera3.setVisibility(View.GONE);
tvCard3.setVisibility(View.GONE);
// int height = bitmap.getHeight();
// int width = bitmap.getWidth();
// if (height > width) {
// DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
// MessageDialog.show((AppCompatActivity) getContext(), "提示", "请重新拍照,要求横屏拍照", "确定").setOkButton(new OnDialogButtonClickListener() {
// @Override
// public boolean onClick(BaseDialog baseDialog, View v) {
// Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
// startActivityForResult(intentPanorama, 300);
// return false;
// }
// });
// } else {
//
// }
}
}
}

View File

@ -72,8 +72,8 @@
<Button
android:id="@+id/btn_attestation"
style="@style/user_style"
android:layout_width="70dp"
android:layout_height="30dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:text="去认证"
@ -102,8 +102,8 @@
/>
<Button
android:id="@+id/btn_gathering"
android:layout_width="70dp"
android:layout_height="30dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:text="去绑定"
@ -258,8 +258,8 @@
style="@style/user_text_style"
/>
<Button
android:layout_width="70dp"
android:layout_height="30dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:text="去绑定"

View File

@ -36,11 +36,11 @@
android:id="@+id/ll_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:background="@drawable/road_shape"
android:orientation="horizontal"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
app:layout_constraintStart_toStartOf="@+id/tv_message"
app:layout_constraintTop_toBottomOf="@+id/tv_message">
@ -56,12 +56,12 @@
<EditText
android:id="@+id/et_road_name"
android:layout_width="match_parent"
android:gravity="center_vertical"
android:layout_height="match_parent"
android:textSize="14sp"
android:background="@null"
android:gravity="center_vertical"
android:inputType="text"
android:maxLines="1"
android:background="@null" />
android:textSize="14sp" />
</LinearLayout>
<TextView
@ -79,8 +79,8 @@
android:id="@+id/ll_mode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginLeft="2dp"
android:layout_marginTop="15dp"
android:orientation="horizontal"
app:layout_constraintTop_toBottomOf="@id/tv_mode">
@ -96,32 +96,32 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/test_color_selector"
android:text="车行" />
android:text="车行"
android:textColor="@color/test_color_selector" />
<RadioButton
android:id="@+id/rb_bicycle"
android:layout_width="0dp"
android:textColor="@color/test_color_selector"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="自行车" />
android:text="自行车"
android:textColor="@color/test_color_selector" />
<RadioButton
android:id="@+id/rb_walking"
android:layout_width="0dp"
android:textColor="@color/test_color_selector"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="步行" />
android:text="步行"
android:textColor="@color/test_color_selector" />
<RadioButton
android:id="@+id/rb_manual"
android:layout_width="0dp"
android:textColor="@color/test_color_selector"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="手动" />
android:text="手动"
android:textColor="@color/test_color_selector" />
</RadioGroup>
</LinearLayout>
@ -146,8 +146,8 @@
<TextView
android:id="@+id/tv_pictures"
style="@style/user_style"
android:layout_width="40dp"
android:layout_height="25dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="center"
android:text="拍照"
@ -155,21 +155,35 @@
android:textSize="15sp" />
</LinearLayout>
<ImageView
android:id="@+id/iv_road_picture"
android:layout_width="200dp"
android:layout_height="100dp"
<FrameLayout
android:id="@+id/fm_road_picture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
app:layout_constraintLeft_toLeftOf="@id/ll_pictures"
app:layout_constraintTop_toBottomOf="@id/ll_pictures" />
app:layout_constraintTop_toBottomOf="@id/ll_pictures">
<ImageView
android:id="@+id/iv_road_picture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="140dp"
android:minHeight="70dp"
android:maxHeight="100dp"
android:maxWidth="200dp"
android:scaleType="fitXY"
/>
</FrameLayout>
<LinearLayout
android:id="@+id/ll_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintLeft_toLeftOf="@id/iv_road_picture"
app:layout_constraintTop_toBottomOf="@id/iv_road_picture">
app:layout_constraintLeft_toLeftOf="@id/fm_road_picture"
app:layout_constraintTop_toBottomOf="@id/fm_road_picture">
<TextView
android:layout_width="wrap_content"
@ -179,6 +193,7 @@
android:text="03.描述"
android:textColor="@color/black"
android:textSize="16sp" />
<LinearLayout
android:id="@+id/linear_describe"
android:layout_width="match_parent"
@ -187,24 +202,25 @@
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:background="@drawable/underline"
app:layout_constraintTop_toBottomOf="@id/tv_03"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_03">
<EditText
android:id="@+id/et_desc"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="30dp"
android:layout_margin="2dp"
android:gravity="top"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:background="@color/white"
android:focusable="true"
android:focusableInTouchMode="true"
android:background="@color/white"
android:gravity="top"
android:hint="任务描述"
android:textSize="15sp"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingBottom="30dp"
android:textColor="@color/test_color_selector"
android:textSize="15sp"
/>

View File

@ -134,8 +134,8 @@
<TextView
android:id="@+id/tv_pictures"
style="@style/user_style"
android:layout_width="40dp"
android:layout_height="25dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="center"
android:text="拍照"
@ -144,21 +144,31 @@
</LinearLayout>
<ImageView
android:id="@+id/iv_poi_video_picture"
android:layout_width="100dp"
android:layout_height="100dp"
<FrameLayout
android:id="@+id/fm_poi_video_picture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
app:layout_constraintLeft_toLeftOf="@id/ll_pictures"
app:layout_constraintTop_toBottomOf="@id/ll_pictures" />
app:layout_constraintTop_toBottomOf="@id/ll_pictures">
<ImageView
android:id="@+id/iv_poi_video_picture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="140dp"
android:minHeight="70dp"
android:maxHeight="100dp"
android:maxWidth="200dp"
android:scaleType="fitXY"/>
</FrameLayout>
<LinearLayout
android:id="@+id/ll_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintLeft_toLeftOf="@id/iv_poi_video_picture"
app:layout_constraintTop_toBottomOf="@id/iv_poi_video_picture">
app:layout_constraintLeft_toLeftOf="@id/fm_poi_video_picture"
app:layout_constraintTop_toBottomOf="@id/fm_poi_video_picture">
<RelativeLayout
android:id="@+id/linear_exist"
android:layout_width="match_parent"

View File

@ -85,7 +85,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableRight="@drawable/ic_baseline_navigate"
android:text="提现录"
android:text="提现录"
app:layout_constraintBottom_toBottomOf="@+id/tv_unit"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/tv_unit" />

View File

@ -2,4 +2,5 @@
<!--状态栏-->
<dimen name="top_pind_sp">20dp</dimen>
<dimen name="fab_margin">16dp</dimen>
<dimen name="default_widget_padding">6dp</dimen>
</resources>

View File

@ -82,6 +82,7 @@
<!-- ‘我的-用户资料’方框设置-->
<style name="user_style">
<item name="android:background">@drawable/selector_red_bg</item>
<item name="android:padding">@dimen/default_widget_padding</item>
</style>
<!-- ‘我的-用户资料’字体设置-->
<style name="user_text_style">