修改上传接口和充电桩接口
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.navinfo.outdoor.bean;
|
||||
|
||||
public class ChargingPileSaveBean {
|
||||
|
||||
private Integer code;
|
||||
private String message;
|
||||
private Integer body;
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public Integer getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
public void setBody(Integer body) {
|
||||
this.body = body;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.navinfo.outdoor.bean;
|
||||
|
||||
public class PoiUploadBean {
|
||||
|
||||
private Integer code;
|
||||
private String message;
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -33,16 +33,23 @@ import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
|
||||
import com.kongzue.dialog.util.BaseDialog;
|
||||
import com.kongzue.dialog.util.DialogSettings;
|
||||
import com.kongzue.dialog.v3.MessageDialog;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.base.BaseDrawerFragment;
|
||||
import com.navinfo.outdoor.bean.PoiSaveBean;
|
||||
import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||
import com.navinfo.outdoor.room.ChargingPileDao;
|
||||
import com.navinfo.outdoor.room.ChargingPileEntity;
|
||||
import com.navinfo.outdoor.room.InsertAndUpdateUtils;
|
||||
import com.navinfo.outdoor.room.PoiDatabase;
|
||||
import com.navinfo.outdoor.room.PoiEntity;
|
||||
import com.navinfo.outdoor.util.Geohash;
|
||||
import com.navinfo.outdoor.util.GeometryTools;
|
||||
import com.navinfo.outdoor.util.PhotoPathUtil;
|
||||
import com.navinfo.outdoor.util.PictureUtil;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
@@ -78,6 +85,16 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
private String station;
|
||||
private LatLng latLng;
|
||||
private LatLng poiLatLng;
|
||||
private String takePhotoPath1;
|
||||
private String takePhotoPath2;
|
||||
private String takePhotoPath3;
|
||||
private String takePhotoPath4;
|
||||
private String takePhotoPath5;
|
||||
private String takePhotoPath6;
|
||||
private String takePhotoPath7;
|
||||
private String takePhotoPath8;
|
||||
private String takePhotoPath9;
|
||||
private String takePhotoPath10;
|
||||
|
||||
public static ChargingPileFragment newInstance(Bundle bundle) {
|
||||
ChargingPileFragment fragment = new ChargingPileFragment();
|
||||
@@ -674,7 +691,8 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
obtain.what = Constant.CHARGING_PILE_STATION;
|
||||
obtain.obj = chargingPileEntity;
|
||||
EventBus.getDefault().post(obtain);
|
||||
onBackPressed();
|
||||
chargingPileByWork(chargingPileEntity);
|
||||
//onBackPressed();
|
||||
} else {
|
||||
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
@@ -737,6 +755,52 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
}
|
||||
}
|
||||
|
||||
private void chargingPileByWork(ChargingPileEntity chargingPileEntity) {
|
||||
showLoadingDialog();
|
||||
// HttpParams httpParams = new HttpParams();
|
||||
// httpParams.put("taskId", chargingPileEntity.getTaskId());
|
||||
// httpParams.put("name", chargingPileEntity.getName());
|
||||
// httpParams.put("address", chargingPileEntity.getAddress());
|
||||
// httpParams.put("existence", chargingPileEntity.getExistence());
|
||||
// httpParams.put("geo", chargingPileEntity.getGeoWkt());
|
||||
// httpParams.put("memo", chargingPileEntity.getMemo());
|
||||
// OkGoBuilder.getInstance()
|
||||
// .Builder(getActivity())
|
||||
// .url(HttpInterface.SUBMIT_POI_TASK)
|
||||
// .method(OkGoBuilder.GET)
|
||||
// .cls(PoiSaveBean.class)
|
||||
// .params(httpParams)
|
||||
// .callback(new Callback<PoiSaveBean>() {
|
||||
// @Override
|
||||
// public void onSuccess(PoiSaveBean poiSaveBean, int id) {
|
||||
// dismissLoadingDialog();
|
||||
// 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() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
|
||||
// Log.d("TAG", "onSuccess: " + poiSaveBean.getBody());
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }).start();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(Throwable e, int id) {
|
||||
// dismissLoadingDialog();
|
||||
// Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
// Log.d("TAG", "onError: " + e.getMessage());
|
||||
// }
|
||||
// }).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
@@ -847,8 +911,9 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
}
|
||||
});
|
||||
} else {
|
||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "a",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivPanorama.setTag(takePhotoPath);
|
||||
int angle1 = PictureUtil.readPictureDegree(takePhotoPath1);
|
||||
takePhotoPath1 = PhotoPathUtil.getTakePhotoPath(data, "a",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivPanorama.setTag(takePhotoPath1);
|
||||
ivPanorama.setImageBitmap(bitmap);//显示图像
|
||||
}
|
||||
} else if (requestCode == 102 && resultCode == RESULT_OK) {
|
||||
@@ -867,8 +932,9 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
}
|
||||
});
|
||||
} else {
|
||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "b",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivCoding.setTag(takePhotoPath);
|
||||
int angle2 = PictureUtil.readPictureDegree(takePhotoPath2);
|
||||
takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivCoding.setTag(takePhotoPath2);
|
||||
ivCoding.setImageBitmap(bitmap);//显示图像
|
||||
}
|
||||
} else if (requestCode == 103 && resultCode == RESULT_OK) {
|
||||
@@ -887,9 +953,10 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
}
|
||||
});
|
||||
} else {
|
||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "c",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
int angle3 = PictureUtil.readPictureDegree(takePhotoPath3);
|
||||
takePhotoPath3 = PhotoPathUtil.getTakePhotoPath(data, "c",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivEquipment.setImageBitmap(bitmap);//显示图像
|
||||
ivEquipment.setTag(takePhotoPath);
|
||||
ivEquipment.setTag(takePhotoPath3);
|
||||
}
|
||||
} else if (requestCode == 104 && resultCode == RESULT_OK) {
|
||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||
@@ -907,8 +974,9 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
}
|
||||
});
|
||||
} else {
|
||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "c",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivFacility.setTag(takePhotoPath);
|
||||
int angle4 = PictureUtil.readPictureDegree(takePhotoPath4);
|
||||
takePhotoPath4 = PhotoPathUtil.getTakePhotoPath(data, "c",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivFacility.setTag(takePhotoPath4);
|
||||
ivFacility.setImageBitmap(bitmap);//显示图像
|
||||
}
|
||||
} else if (requestCode == 105 && resultCode == RESULT_OK) {
|
||||
@@ -927,8 +995,9 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
}
|
||||
});
|
||||
} else {
|
||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "c",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivScutcheon.setTag(takePhotoPath);
|
||||
int angle5 = PictureUtil.readPictureDegree(takePhotoPath5);
|
||||
takePhotoPath5 = PhotoPathUtil.getTakePhotoPath(data, "c",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivScutcheon.setTag(takePhotoPath5);
|
||||
ivScutcheon.setImageBitmap(bitmap);//显示图像
|
||||
}
|
||||
} else if (requestCode == 106 && resultCode == RESULT_OK) {
|
||||
@@ -947,8 +1016,9 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
}
|
||||
});
|
||||
} else {
|
||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "c",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivDevice.setTag(takePhotoPath);
|
||||
int angle6 = PictureUtil.readPictureDegree(takePhotoPath6);
|
||||
takePhotoPath6 = PhotoPathUtil.getTakePhotoPath(data, "c",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivDevice.setTag(takePhotoPath6);
|
||||
ivDevice.setImageBitmap(bitmap);//显示图像
|
||||
}
|
||||
} else if (requestCode == 107 && resultCode == RESULT_OK) {
|
||||
@@ -967,8 +1037,9 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
}
|
||||
});
|
||||
} else {
|
||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "d",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivUsable.setTag(takePhotoPath);
|
||||
int angle7 = PictureUtil.readPictureDegree(takePhotoPath7);
|
||||
takePhotoPath7 = PhotoPathUtil.getTakePhotoPath(data, "d",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivUsable.setTag(takePhotoPath7);
|
||||
ivUsable.setImageBitmap(bitmap);//显示图像
|
||||
}
|
||||
} else if (requestCode == 108 && resultCode == RESULT_OK) {
|
||||
@@ -987,8 +1058,9 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
}
|
||||
});
|
||||
} else {
|
||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "d",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivAvailable.setTag(takePhotoPath);
|
||||
int angle8 = PictureUtil.readPictureDegree(takePhotoPath8);
|
||||
takePhotoPath8 = PhotoPathUtil.getTakePhotoPath(data, "d",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivAvailable.setTag(takePhotoPath8);
|
||||
ivAvailable.setImageBitmap(bitmap);//显示图像
|
||||
}
|
||||
} else if (requestCode == 109 && resultCode == RESULT_OK) {
|
||||
@@ -1007,9 +1079,10 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
}
|
||||
});
|
||||
} else {
|
||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "e",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
int angle9 = PictureUtil.readPictureDegree(takePhotoPath9);
|
||||
takePhotoPath9 = PhotoPathUtil.getTakePhotoPath(data, "e",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivParking.setImageBitmap(bitmap);//显示图像
|
||||
ivParking.setTag(takePhotoPath);
|
||||
ivParking.setTag(takePhotoPath9);
|
||||
}
|
||||
} else if (requestCode == 110 && resultCode == RESULT_OK) {
|
||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||
@@ -1027,9 +1100,10 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
}
|
||||
});
|
||||
} else {
|
||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "e",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
int angle10 = PictureUtil.readPictureDegree(takePhotoPath10);
|
||||
takePhotoPath10 = PhotoPathUtil.getTakePhotoPath(data, "e",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivNumber.setImageBitmap(bitmap);//显示图像
|
||||
ivNumber.setTag(takePhotoPath);
|
||||
ivNumber.setTag(takePhotoPath10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,13 +102,17 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
private RecyclerView recyclerStation;
|
||||
private ChargingPileAdapter chargingPileAdapter;
|
||||
private int station_type = 0;
|
||||
private boolean aBoolean = false;
|
||||
private PoiEntity showPoiEntity;
|
||||
private ChargingPileDao chargingPileDao;
|
||||
private LatLng latLng;
|
||||
private RelativeLayout linearExist;
|
||||
private Spinner spinnerExist;
|
||||
private Integer body;
|
||||
private String takePhotoPath1;
|
||||
private String takePhotoPath2;
|
||||
private String takePhotoPath3;
|
||||
private String takePhotoPath4;
|
||||
private String takePhotoPath5;
|
||||
|
||||
public static ChargingStationFragment newInstance(Bundle bundle) {
|
||||
ChargingStationFragment fragment = new ChargingStationFragment();
|
||||
@@ -493,7 +497,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
ArrayList<ChargingPileEntity> chargingPileEntities = new ArrayList<>();
|
||||
chargingPileEntities.add(chargingPileEntity);
|
||||
chargingPileAdapter.setChargingPileEntities(chargingPileEntities);
|
||||
aBoolean = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -541,7 +545,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
} else {
|
||||
poiEntity.setDescribe(describe);
|
||||
}
|
||||
if (phoneData.size() <= 0) {
|
||||
if (phoneData.size()<= 0) {
|
||||
Toast.makeText(getActivity(), "请输入手机号", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
@@ -586,12 +590,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
|
||||
poiEntity.setPhotoInfo(infoPhoto);
|
||||
poiEntity.setStation_type(station_type);
|
||||
if (!aBoolean) {
|
||||
Toast.makeText(getActivity(), "请添加桩", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
aBoolean = false;
|
||||
}
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
@@ -607,6 +605,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
phoneByWork(poiEntity);
|
||||
chargingStationSaveByWork(poiEntity);
|
||||
}
|
||||
});
|
||||
@@ -708,6 +707,46 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
}
|
||||
}
|
||||
|
||||
private void phoneByWork(PoiEntity poiEntity) {
|
||||
showLoadingDialog();
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("geo",poiEntity.getGeoWkt());
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.GET_PHONE)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(GetPhoneBean.class)
|
||||
.params(httpParams)
|
||||
.callback(new Callback<GetPhoneBean>() {
|
||||
@Override
|
||||
public void onSuccess(GetPhoneBean getPhoneBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
String code = getPhoneBean.getBody().getCode();
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onSuccess: " + getPhoneBean.getBody());
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
}
|
||||
}).build();
|
||||
}
|
||||
|
||||
private void stationUploadByNetWork(Integer body, ArrayList<File> chargingStationList) {
|
||||
|
||||
|
||||
@@ -924,8 +963,9 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
}
|
||||
});
|
||||
} else {
|
||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "a",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivPanorama.setTag(takePhotoPath);
|
||||
//int angle1 = PictureUtil.readPictureDegree(takePhotoPath1);
|
||||
takePhotoPath1 = PhotoPathUtil.getTakePhotoPath(data, "a",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivPanorama.setTag(takePhotoPath1);
|
||||
ivPanorama.setImageBitmap(bitmap);//显示图像
|
||||
}
|
||||
} else if (requestCode == 102 && resultCode == RESULT_OK) {
|
||||
@@ -944,8 +984,9 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
}
|
||||
});
|
||||
} else {
|
||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "b",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivName.setTag(takePhotoPath);
|
||||
// int angle2 = PictureUtil.readPictureDegree(takePhotoPath2);
|
||||
takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivName.setTag(takePhotoPath2);
|
||||
ivName.setImageBitmap(bitmap);//显示图像
|
||||
}
|
||||
} else if (requestCode == 103 && resultCode == RESULT_OK) {
|
||||
@@ -964,8 +1005,9 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
}
|
||||
});
|
||||
} else {
|
||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "c",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivInternal.setTag(takePhotoPath);
|
||||
// int angle3 = PictureUtil.readPictureDegree(takePhotoPath3);
|
||||
takePhotoPath3 = PhotoPathUtil.getTakePhotoPath(data, "c",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivInternal.setTag(takePhotoPath3);
|
||||
ivInternal.setImageBitmap(bitmap);//显示图像
|
||||
}
|
||||
} else if (requestCode == 104 && resultCode == RESULT_OK) {
|
||||
@@ -984,8 +1026,9 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
}
|
||||
});
|
||||
} else {
|
||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "d",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivElse.setTag(takePhotoPath);
|
||||
// int angle4 = PictureUtil.readPictureDegree(takePhotoPath4);
|
||||
takePhotoPath4 = PhotoPathUtil.getTakePhotoPath(data, "d",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivElse.setTag(takePhotoPath4);
|
||||
ivElse.setImageBitmap(bitmap);//显示图像
|
||||
}
|
||||
} else if (requestCode == 105 && resultCode == RESULT_OK) {
|
||||
@@ -1004,8 +1047,9 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
}
|
||||
});
|
||||
} else {
|
||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "e",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivScutcheon.setTag(takePhotoPath);
|
||||
// int angle5 = PictureUtil.readPictureDegree(takePhotoPath5);
|
||||
takePhotoPath5 = PhotoPathUtil.getTakePhotoPath(data, "e",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivScutcheon.setTag(takePhotoPath5);
|
||||
ivScutcheon.setImageBitmap(bitmap);//显示图像
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.navinfo.outdoor.fragment;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
@@ -23,6 +24,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.google.gson.Gson;
|
||||
import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
|
||||
import com.kongzue.dialog.util.BaseDialog;
|
||||
import com.kongzue.dialog.util.DialogSettings;
|
||||
import com.kongzue.dialog.v3.MessageDialog;
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.model.Response;
|
||||
@@ -85,7 +87,7 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
|
||||
btnBank = findViewById(R.id.btn_bank);
|
||||
btnBank.setOnClickListener(this::onClick);
|
||||
tvName = (TextView) findViewById(R.id.tv_name);
|
||||
if (Constant.USER_ATTESTATION_NAME!=null){
|
||||
if (Constant.USER_ATTESTATION_NAME != null) {
|
||||
tvName.setText(Constant.USER_ATTESTATION_NAME);
|
||||
}
|
||||
etBankNum = (EditText) findViewById(R.id.et_bank_num);
|
||||
@@ -212,8 +214,24 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
|
||||
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == 400 && resultCode == RESULT_OK) {
|
||||
gatheringPath = PhotoPathUtil.getTakePhotoPath(data, "","");
|
||||
return;
|
||||
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, 400);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
gatheringPath = PhotoPathUtil.getTakePhotoPath(data, "", "");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.navinfo.outdoor.fragment;
|
||||
|
||||
public class GetPhoneBean {
|
||||
|
||||
private Integer code;
|
||||
private String message;
|
||||
private BodyBean body;
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public BodyBean getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
public void setBody(BodyBean body) {
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
public static class BodyBean {
|
||||
private String code;
|
||||
private Integer telLength;
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public Integer getTelLength() {
|
||||
return telLength;
|
||||
}
|
||||
|
||||
public void setTelLength(Integer telLength) {
|
||||
this.telLength = telLength;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,6 +40,7 @@ import com.navinfo.outdoor.base.BaseDrawerFragment;
|
||||
import com.navinfo.outdoor.bean.Info;
|
||||
import com.navinfo.outdoor.bean.OtherUploadPicBean;
|
||||
import com.navinfo.outdoor.bean.PoiSaveBean;
|
||||
import com.navinfo.outdoor.bean.PoiUploadBean;
|
||||
import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.DialogCallback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
@@ -91,7 +92,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
|
||||
private String takePhotoPath;
|
||||
private String takePhotoPath2;
|
||||
private int body;
|
||||
private Integer body;
|
||||
|
||||
public static OtherFragment newInstance(Bundle bundle) {
|
||||
OtherFragment fragment = new OtherFragment();
|
||||
@@ -428,31 +429,57 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
Toast.makeText(getActivity(), "没有保存不能上传", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
showLoadingDialog();
|
||||
// OkGo
|
||||
// // 请求方式和请求url
|
||||
// .<OtherUploadPicBean>post(HttpInterface.OTHER_TASK_UPLOAD_PIC)
|
||||
// // 请求的 tag, 主要用于取消对应的请求
|
||||
// .params("auditId", body)
|
||||
// .addFileParams("file", otherUploadList)
|
||||
// .tag(this)
|
||||
// .execute(new DialogCallback<OtherUploadPicBean>(OtherUploadPicBean.class) {
|
||||
// @Override
|
||||
// public void onSuccess(Response<OtherUploadPicBean> otherUploadPicBeanResponse) {
|
||||
// dismissLoadingDialog();
|
||||
// Toast.makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
|
||||
// Log.d("TAG", "onSuccess: " + otherUploadPicBeanResponse.toString() + "sssssssssssss");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(Response<OtherUploadPicBean> response) {
|
||||
// super.onError(response);
|
||||
// dismissLoadingDialog();
|
||||
// Toast.makeText(getActivity(), response.message() + "", Toast.LENGTH_SHORT).show();
|
||||
// Log.d("TAG", "onError: " + response.message());
|
||||
// }
|
||||
// });
|
||||
if (body == 0) {
|
||||
Toast.makeText(getActivity(), "没有保存本地", Toast.LENGTH_SHORT).show();
|
||||
Log.e("TAG", "poiUploadByNetWork: " + body + otherUploadList);
|
||||
return;
|
||||
}
|
||||
OkGo
|
||||
// 请求方式和请求url
|
||||
.<OtherUploadPicBean>post(HttpInterface.OTHER_TASK_UPLOAD_PIC)
|
||||
.<PoiUploadBean>post(HttpInterface.OTHER_TASK_UPLOAD_PIC)
|
||||
// 请求的 tag, 主要用于取消对应的请求
|
||||
.params("auditId", body)
|
||||
.addFileParams("file", otherUploadList)
|
||||
.tag(this)
|
||||
.execute(new DialogCallback<OtherUploadPicBean>(OtherUploadPicBean.class) {
|
||||
.execute(new DialogCallback<PoiUploadBean>(PoiUploadBean.class) {
|
||||
@Override
|
||||
public void onSuccess(Response<OtherUploadPicBean> response) {
|
||||
public void onSuccess(Response<PoiUploadBean> poiUploadBeanResponse) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onSuccess: " + response.toString() + "sssssssssssss");
|
||||
Log.d("TAG", "onSuccess: " + poiUploadBeanResponse.toString() + "sssssssssssss");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Response<OtherUploadPicBean> response) {
|
||||
super.onError(response);
|
||||
public void onError(Response<PoiUploadBean> poiUploadBeanResponse) {
|
||||
super.onError(poiUploadBeanResponse);
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), response.code() + "", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + response.code());
|
||||
Toast.makeText(getActivity(), poiUploadBeanResponse.code() + "", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + poiUploadBeanResponse.code() + "");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void otherSaveByNetWork(PoiEntity poiEntity) {
|
||||
@@ -579,6 +606,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// int angle1 = PictureUtil.readPictureDegree(takePhotoPath);
|
||||
//照片路径
|
||||
takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "a", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
|
||||
ivPicture.setTag(takePhotoPath);
|
||||
@@ -601,6 +629,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// int angle2 = PictureUtil.readPictureDegree(takePhotoPath2);
|
||||
//照片路径
|
||||
takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
|
||||
ivPictures.setTag(takePhotoPath2);
|
||||
|
||||
@@ -572,8 +572,8 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
public void onError(Response<OtherUploadPicBean> response) {
|
||||
super.onError(response);
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), response.code() + "", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + response.code() + "");
|
||||
Toast.makeText(getActivity(), response.message() + "", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + response.message() + "");
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -741,6 +741,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// int angle2 = PictureUtil.readPictureDegree(takePhotoPath2);
|
||||
takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivName.setTag(takePhotoPath2);
|
||||
ivName.setImageBitmap(bitmap);//显示图像
|
||||
@@ -761,6 +762,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// int angle3 = PictureUtil.readPictureDegree(takePhotoPath3);
|
||||
takePhotoPath3 = PhotoPathUtil.getTakePhotoPath(data, "c",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivInternal.setTag(takePhotoPath3);
|
||||
ivInternal.setImageBitmap(bitmap);//显示图像
|
||||
@@ -781,6 +783,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// int angle4 = PictureUtil.readPictureDegree(takePhotoPath4);
|
||||
takePhotoPath4 = PhotoPathUtil.getTakePhotoPath(data, "d",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivCard.setTag(takePhotoPath4);
|
||||
ivCard.setImageBitmap(bitmap);//显示图像
|
||||
@@ -801,6 +804,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// int angle5 = PictureUtil.readPictureDegree(takePhotoPath5);
|
||||
takePhotoPath5 = PhotoPathUtil.getTakePhotoPath(data, "e",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivElse.setTag(takePhotoPath5);
|
||||
ivElse.setImageBitmap(bitmap);//显示图像
|
||||
|
||||
@@ -148,7 +148,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
poiDao = poiDatabase.getPoiDao();
|
||||
tvPictures = (TextView) findViewById(R.id.tv_pictures);
|
||||
tvPictures.setOnClickListener(this::onClick);
|
||||
etRoadName = (EditText) findViewById(R.id.et_road_name);
|
||||
etRoadName = (EditText) findViewById(R.id.et_poi_video_name);
|
||||
ivPoiVideoPicture = (ImageView) findViewById(R.id.iv_road_picture);
|
||||
rbCar = (RadioButton) findViewById(R.id.rb_car);
|
||||
rbBicycle = (RadioButton) findViewById(R.id.rb_bicycle);
|
||||
@@ -309,7 +309,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
Toast.makeText(getContext(), "请输入poi录像 名称", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
poiEntity.setName(roadName);
|
||||
poiEntity.setName(roadName+"");
|
||||
}
|
||||
RoadExtend roadExtend = new RoadExtend();
|
||||
int type = getPictureType();
|
||||
@@ -345,6 +345,10 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
latLng.setLongitude(Double.valueOf(split[3]));
|
||||
latLngs.add(latLng);
|
||||
}
|
||||
if (strings.size()==1){
|
||||
LatLng latLng = latLngs.get(0);
|
||||
latLngs.add(latLng);
|
||||
}
|
||||
String lineString = GeometryTools.getLineString(latLngs);
|
||||
Log.d("TAG", "onGranted: "+lineString);
|
||||
poiEntity.setGeoWkt(lineString);
|
||||
|
||||
@@ -315,6 +315,10 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
latLng.setLongitude(Double.valueOf(split[3]));
|
||||
latLngs.add(latLng);
|
||||
}
|
||||
if (strings.size()==1){
|
||||
LatLng latLng = latLngs.get(0);
|
||||
latLngs.add(latLng);
|
||||
}
|
||||
String lineString = GeometryTools.getLineString(latLngs);
|
||||
Log.d("TAG", "onGranted: "+lineString);
|
||||
poiEntity.setGeoWkt(lineString);
|
||||
|
||||
@@ -1078,13 +1078,13 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
case 1:
|
||||
BitmapDescriptor poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_have_bg);
|
||||
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(poiVideoDescriptor));
|
||||
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(new Bundle());
|
||||
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
|
||||
showSlidingFragment(poiVideoFragment);
|
||||
break;
|
||||
case 2:
|
||||
BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_have_bg);
|
||||
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(roadDescriptor));
|
||||
RoadFragment roadFragment = RoadFragment.newInstance(new Bundle());
|
||||
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
|
||||
showSlidingFragment(roadFragment);
|
||||
break;
|
||||
case 3:
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -15,6 +16,7 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
|
||||
import com.kongzue.dialog.util.BaseDialog;
|
||||
import com.kongzue.dialog.util.DialogSettings;
|
||||
import com.kongzue.dialog.v3.MessageDialog;
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.model.Response;
|
||||
@@ -51,6 +53,12 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
private String takePhotoPath3;
|
||||
private ArrayList<File> takePhoneList;
|
||||
private String attestationName;
|
||||
private ImageView ivHera1;
|
||||
private TextView tvCard1;
|
||||
private ImageView ivHera2;
|
||||
private TextView tvCard2;
|
||||
private ImageView ivHera3;
|
||||
private TextView tvCard3;
|
||||
|
||||
|
||||
public static UserAttestationFragment newInstance(Bundle bundle) {
|
||||
@@ -65,7 +73,6 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
super.initData();
|
||||
@@ -89,6 +96,12 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
btnAttestation.setOnClickListener(this::onClick);
|
||||
etAttestationName = (EditText) findViewById(R.id.et_attestationName);
|
||||
etNamePhone = (EditText) findViewById(R.id.et_namePhone);
|
||||
ivHera1 = (ImageView) findViewById(R.id.iv_hera1);
|
||||
tvCard1 = (TextView) findViewById(R.id.tv_card1);
|
||||
ivHera2 = (ImageView) findViewById(R.id.iv_hera2);
|
||||
tvCard2 = (TextView) findViewById(R.id.tv_card2);
|
||||
ivHera3 = (ImageView) findViewById(R.id.iv_hera3);
|
||||
tvCard3 = (TextView) findViewById(R.id.tv_card3);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -110,7 +123,6 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
startActivityForResult(ivAttestation3, 300);
|
||||
break;
|
||||
case R.id.btn_attestation:
|
||||
|
||||
if (etAttestationName.getText().toString() == null || etAttestationName.getText().toString().equals("")) {
|
||||
Toast.makeText(getContext(), "姓名不能为空,请输入姓名", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
@@ -120,10 +132,12 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
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}$");
|
||||
@@ -131,19 +145,19 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
.compile("^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}([0-9]|X)$");
|
||||
Matcher matcherSfzhm1 = patternSfzhm1.matcher(text);
|
||||
Matcher matcherSfzhm2 = patternSfzhm2.matcher(text);
|
||||
if(!matcherSfzhm1.find() && !matcherSfzhm2.find())
|
||||
if (!matcherSfzhm1.find() && !matcherSfzhm2.find())
|
||||
return false;
|
||||
else return true;
|
||||
|
||||
}
|
||||
|
||||
private void nameAuthentication() {
|
||||
showLoadingDialog();
|
||||
takePhoneList = new ArrayList<>();
|
||||
|
||||
File takePhotoFile1 = new File(takePhotoPath1);
|
||||
File takePhotoFile2 = new File(takePhotoPath2);
|
||||
File takePhotoFile3 = new File(takePhotoPath3);
|
||||
if (!takePhotoFile1.exists() || !takePhotoFile2.exists() ||!takePhotoFile3.exists()){
|
||||
if (!takePhotoFile1.exists() || !takePhotoFile2.exists() || !takePhotoFile3.exists()) {
|
||||
Toast.makeText(getContext(), "身份证照片不能为空", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
@@ -169,7 +183,6 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
dismissLoadingDialog();
|
||||
|
||||
|
||||
|
||||
Log.d("TAG", "onSuccess: " + response.toString() + "sssssssssssss");
|
||||
if (response.body().equals("0")) {
|
||||
MessageDialog.show((AppCompatActivity) getActivity(), "提示", "不通过", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
||||
@@ -177,7 +190,7 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
// Toast.makeText(getContext(), "点击了确定", Toast.LENGTH_SHORT).show();
|
||||
//传值给持卡人
|
||||
Constant.USER_ATTESTATION_NAME=attestationName;
|
||||
Constant.USER_ATTESTATION_NAME = attestationName;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
@@ -185,7 +198,7 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
MessageDialog.show((AppCompatActivity) getActivity(), "提示", "通过", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
Constant.USER_ATTESTATION_NAME=attestationName;
|
||||
Constant.USER_ATTESTATION_NAME = attestationName;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
@@ -206,23 +219,75 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == 100 && resultCode == RESULT_OK) {
|
||||
takePhotoPath1 = PhotoPathUtil.getTakePhotoPath(data, "a","");
|
||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||
//从附加值中获取返回的图像
|
||||
Bitmap bitmap = (Bitmap) extras.get("data");
|
||||
ivAttestation1.setImageBitmap(bitmap);//显示图像
|
||||
} else if (requestCode == 200 && resultCode == RESULT_OK) {
|
||||
takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b","");
|
||||
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 {
|
||||
|
||||
takePhotoPath1 = PhotoPathUtil.getTakePhotoPath(data, "a", "");
|
||||
ivAttestation1.setTag(takePhotoPath1);
|
||||
ivAttestation1.setImageBitmap(bitmap);//显示图像
|
||||
ivHera1.setVisibility(View.GONE);
|
||||
tvCard1.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
if (requestCode == 200 && resultCode == RESULT_OK) {
|
||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||
//从附加值中获取返回的图像
|
||||
Bitmap bitmap = (Bitmap) extras.get("data");
|
||||
ivAttestation2.setImageBitmap(bitmap);//显示图像
|
||||
}else if (requestCode == 300 && resultCode == RESULT_OK) {
|
||||
takePhotoPath3 = PhotoPathUtil.getTakePhotoPath(data, "c","");
|
||||
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 {
|
||||
takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "a", "");
|
||||
ivAttestation2.setTag(takePhotoPath2);
|
||||
ivAttestation2.setImageBitmap(bitmap);//显示图像
|
||||
ivHera1.setVisibility(View.GONE);
|
||||
tvCard1.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
if (requestCode == 300 && resultCode == RESULT_OK) {
|
||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||
//从附加值中获取返回的图像
|
||||
Bitmap bitmap = (Bitmap) extras.get("data");
|
||||
ivAttestation3.setImageBitmap(bitmap);//显示图像
|
||||
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 {
|
||||
|
||||
takePhotoPath3 = PhotoPathUtil.getTakePhotoPath(data, "a", "");
|
||||
ivAttestation3.setTag(takePhotoPath3);
|
||||
ivAttestation3.setImageBitmap(bitmap);//显示图像
|
||||
ivHera1.setVisibility(View.GONE);
|
||||
tvCard1.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -64,6 +64,11 @@ public class HttpInterface {
|
||||
public static final String INSIDE_API_LIST = IPm6+"poivideotask/1/submitPoivideotask";//poi录像 保存
|
||||
//172.23.139.4:8003/poivideotask/1/uploadpic
|
||||
public static final String POI_VIDEO_UPLOAD_PIC = IPm6+"poivideotask/1/uploadpic";//poi录像-上传
|
||||
//http://172.23.139.4:8003/m4/task/1/getPhone?geo=1rn7exd5uhxy
|
||||
public static final String GET_PHONE = IPm6 + "m4/task/1/getPhone"; //任务搜索
|
||||
//172.23.139.4:8003/cstask/1/submitCstask?taskId=0&name=充电站&geo=1rn7exd5uhxy&memo=测试备注&sptype=1&ffid=104&existence=1&detail={"cp_openType":"1,2","cp_floor":1,"cp_availableState":0,"sign_exist":0}
|
||||
public static final String SUBMIT_CSTASK =IPm6+"cstask/1/submitCstask";
|
||||
|
||||
/**
|
||||
* 面状任务
|
||||
*/
|
||||
|
||||
@@ -5,7 +5,6 @@ import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
|
||||
@@ -20,12 +19,20 @@ import java.util.Date;
|
||||
* 获取图片的真实路径
|
||||
*/
|
||||
public class PhotoPathUtil {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param data
|
||||
* @param d 类型
|
||||
* @param coord 经纬度加密
|
||||
* @return
|
||||
*/
|
||||
public static String getTakePhotoPath(Intent data,String d,String coord) {
|
||||
Bitmap photo = null;
|
||||
int angle=0;
|
||||
Uri uri = data.getData();
|
||||
if (uri != null) {
|
||||
photo = BitmapFactory.decodeFile(uri.getPath());
|
||||
angle = PictureUtil.readPictureDegree(uri.getPath());
|
||||
}
|
||||
if (photo == null) {
|
||||
Bundle bundle = data.getExtras();
|
||||
@@ -38,12 +45,16 @@ public class PhotoPathUtil {
|
||||
|
||||
FileOutputStream fileOutputStream = null;
|
||||
try {
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-ddHHmmss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
long time=System.currentTimeMillis();
|
||||
//文件
|
||||
File file = new File(Constant.PICTURE_FOLDER, d+format+coord+ ".jpg");
|
||||
if (angle==0){
|
||||
angle=90;
|
||||
}
|
||||
File file = new File(Constant.PICTURE_FOLDER, d+time+"_p"+coord+"_a"+angle+".jpg");
|
||||
/***打开文件输出流*/
|
||||
fileOutputStream = new FileOutputStream(file);
|
||||
// 生成图片文件
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.navinfo.outdoor.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.media.ExifInterface;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
@@ -39,4 +40,33 @@ public class PictureUtil {
|
||||
// Uri.parse("file://" + "/sdcard/namecard/")));
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取图片属性:旋转的角度
|
||||
*
|
||||
* @param path 拍摄图片的完整路径
|
||||
* @return degree旋转的角度
|
||||
*/
|
||||
public static int readPictureDegree(String path) {
|
||||
int degree = 0;
|
||||
try {
|
||||
ExifInterface exifInterface = new ExifInterface(path);
|
||||
int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
|
||||
switch (orientation) {
|
||||
case ExifInterface.ORIENTATION_ROTATE_90:
|
||||
degree = 90;
|
||||
break;
|
||||
case ExifInterface.ORIENTATION_ROTATE_180:
|
||||
degree = 180;
|
||||
break;
|
||||
case ExifInterface.ORIENTATION_ROTATE_270:
|
||||
degree = 270;
|
||||
break;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return degree;
|
||||
}
|
||||
return degree;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.navinfo.outdoor.util;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class TimestampUtil {
|
||||
/*
|
||||
* 将时间转换为时间戳
|
||||
*/
|
||||
public static String dateToStamp(String s) throws ParseException {
|
||||
String res;
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date date = simpleDateFormat.parse(s);
|
||||
long ts = date.getTime();
|
||||
res = String.valueOf(ts);
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* 将时间戳转换为时间
|
||||
*/
|
||||
public static String stampToDate(String s){
|
||||
String res;
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
long lt = new Long(s);
|
||||
Date date = new Date(lt);
|
||||
res = simpleDateFormat.format(date);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,7 @@
|
||||
android:textSize="15sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_road_name"
|
||||
android:id="@+id/et_poi_video_name"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_vertical"
|
||||
|
||||
@@ -137,12 +137,14 @@
|
||||
app:layout_constraintTop_toTopOf="@id/iv_attestation1">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_hera1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/card_zhengmian" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_card1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
@@ -179,12 +181,14 @@
|
||||
app:layout_constraintTop_toTopOf="@id/iv_attestation2">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_hera2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/card_fanmian" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_card2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
@@ -220,11 +224,13 @@
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_hera3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/card_shouchi" />
|
||||
<TextView
|
||||
android:id="@+id/tv_card3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="*手持身份证"
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
buildscript {
|
||||
ext.anko_version = '0.10.1'//扩展库版本
|
||||
// ext.kotlin_coroutines = '1.4.1'//协程版本需要findById()...
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
|
||||
Reference in New Issue
Block a user