Merge remote-tracking branch 'OutDoor/master'
This commit is contained in:
commit
65fc766365
@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
|
|||||||
android {
|
android {
|
||||||
compileSdkVersion 29
|
compileSdkVersion 29
|
||||||
buildToolsVersion '29.0.2'
|
buildToolsVersion '29.0.2'
|
||||||
//ndkVersion '23.0.7123448'
|
ndkVersion '23.0.7123448'
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.navinfo.outdoor"
|
applicationId "com.navinfo.outdoor"
|
||||||
|
@ -98,7 +98,7 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
|||||||
private Button btnVideo, stopVideo;
|
private Button btnVideo, stopVideo;
|
||||||
|
|
||||||
private String finalVideoPath; // 摄像后最终保存的文件名
|
private String finalVideoPath; // 摄像后最终保存的文件名
|
||||||
private File tmpFile; // 合并文件的临时文件路径
|
// private File tmpFile; // 合并文件的临时文件路径
|
||||||
private Timer timer;
|
private Timer timer;
|
||||||
private CsvTimerTask timerTask; // 执行定时写入csv文件的task
|
private CsvTimerTask timerTask; // 执行定时写入csv文件的task
|
||||||
private DateFormat formatter;
|
private DateFormat formatter;
|
||||||
@ -109,7 +109,7 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
|||||||
@Override
|
@Override
|
||||||
protected int getLayout() {
|
protected int getLayout() {
|
||||||
EventBus.getDefault().register(this);
|
EventBus.getDefault().register(this);
|
||||||
tmpFile = new File(Constant.PICTURE_FOLDER, "temp.mp4");
|
// tmpFile = new File(Constant.PICTURE_FOLDER, "temp.mp4");
|
||||||
formatter = new SimpleDateFormat("yyyyMMdd HHmmss");
|
formatter = new SimpleDateFormat("yyyyMMdd HHmmss");
|
||||||
return R.layout.activity_picture;
|
return R.layout.activity_picture;
|
||||||
}
|
}
|
||||||
@ -121,9 +121,9 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
|||||||
if (getIntent()!=null) {
|
if (getIntent()!=null) {
|
||||||
finalVideoPath = getIntent().getStringExtra(Constant.INTENT_VIDEO_PATH);
|
finalVideoPath = getIntent().getStringExtra(Constant.INTENT_VIDEO_PATH);
|
||||||
}
|
}
|
||||||
if (finalVideoPath == null) {
|
// if (finalVideoPath == null) {
|
||||||
finalVideoPath = Constant.PICTURE_FOLDER+"/final.mp4";
|
// finalVideoPath = Constant.PICTURE_FOLDER+"/final.mp4";
|
||||||
}
|
// }
|
||||||
|
|
||||||
layerChange = findViewById(R.id.layer_change);
|
layerChange = findViewById(R.id.layer_change);
|
||||||
|
|
||||||
@ -145,12 +145,13 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
|||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
if (isChecked) { // 开始采集,设置按钮文字内容为“结束采集”
|
if (isChecked) { // 开始采集,设置按钮文字内容为“结束采集”
|
||||||
captureVideo.setText("暂停采集");
|
captureVideo.setText("结束采集");
|
||||||
// stopVideo.setEnabled(false);// 开始采集视频后,禁用停止采集的按钮,必须暂停采集后才可点击停止采集
|
// stopVideo.setEnabled(false);// 开始采集视频后,禁用停止采集的按钮,必须暂停采集后才可点击停止采集
|
||||||
startTakenVideo(); // 开始采集视频
|
startTakenVideo(); // 开始采集视频
|
||||||
} else {
|
} else {
|
||||||
stopTakenVideo();
|
// stopTakenVideo();
|
||||||
captureVideo.setText("开始采集");
|
captureVideo.setText("开始采集");
|
||||||
|
stopVideoAndFinish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -232,45 +233,49 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
|||||||
super.onVideoTaken(result);
|
super.onVideoTaken(result);
|
||||||
Toast.makeText(PictureActivity.this, "暂停摄像", Toast.LENGTH_SHORT).show();
|
Toast.makeText(PictureActivity.this, "暂停摄像", Toast.LENGTH_SHORT).show();
|
||||||
showLoadingDialog();
|
showLoadingDialog();
|
||||||
new Thread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (result!=null) {
|
|
||||||
File currentFile = result.getFile();
|
|
||||||
if (finalVideoPath!=null) { // 有指定的视频文件名称,合并文件
|
|
||||||
if (new File(finalVideoPath).exists()) {
|
|
||||||
List<String> spliteFileList = new ArrayList<>();
|
|
||||||
spliteFileList.add(finalVideoPath);
|
|
||||||
spliteFileList.add(currentFile.getAbsolutePath());
|
|
||||||
try {
|
|
||||||
AWMp4ParserHelper.getInstance().mergeVideos(spliteFileList, tmpFile.getAbsolutePath());
|
|
||||||
if (tmpFile.exists()) {
|
|
||||||
File finalVideoFile = new File(finalVideoPath);
|
|
||||||
finalVideoFile.delete();
|
|
||||||
currentFile.delete();
|
|
||||||
tmpFile.renameTo(finalVideoFile);
|
|
||||||
} else {
|
|
||||||
Toast.makeText(PictureActivity.this, "视频合并失败!", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e("PictureActivity", e.getMessage());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
currentFile.renameTo(new File(finalVideoPath));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
dismissLoadingDialog();
|
dismissLoadingDialog();
|
||||||
if (isFinishActivity) {
|
if (isFinishActivity) {
|
||||||
PictureActivity.this.finish();
|
PictureActivity.this.finish();
|
||||||
}
|
}
|
||||||
}
|
// new Thread(new Runnable() {
|
||||||
});
|
// @Override
|
||||||
}
|
// public void run() {
|
||||||
}).start();
|
// if (result!=null) {
|
||||||
|
// File currentFile = result.getFile();
|
||||||
|
// if (finalVideoPath!=null) { // 有指定的视频文件名称,合并文件
|
||||||
|
// if (new File(finalVideoPath).exists()) {
|
||||||
|
// List<String> spliteFileList = new ArrayList<>();
|
||||||
|
// spliteFileList.add(finalVideoPath);
|
||||||
|
// spliteFileList.add(currentFile.getAbsolutePath());
|
||||||
|
// try {
|
||||||
|
// AWMp4ParserHelper.getInstance().mergeVideos(spliteFileList, tmpFile.getAbsolutePath());
|
||||||
|
// if (tmpFile.exists()) {
|
||||||
|
// File finalVideoFile = new File(finalVideoPath);
|
||||||
|
// finalVideoFile.delete();
|
||||||
|
// currentFile.delete();
|
||||||
|
// tmpFile.renameTo(finalVideoFile);
|
||||||
|
// } else {
|
||||||
|
// Toast.makeText(PictureActivity.this, "视频合并失败!", Toast.LENGTH_SHORT).show();
|
||||||
|
// }
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// Log.e("PictureActivity", e.getMessage());
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// currentFile.renameTo(new File(finalVideoPath));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// runOnUiThread(new Runnable() {
|
||||||
|
// @Override
|
||||||
|
// public void run() {
|
||||||
|
// dismissLoadingDialog();
|
||||||
|
// if (isFinishActivity) {
|
||||||
|
// PictureActivity.this.finish();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// }).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -285,16 +290,17 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
|||||||
/**
|
/**
|
||||||
* 获取当前视频的时间,记录csv文件时使用
|
* 获取当前视频的时间,记录csv文件时使用
|
||||||
* */
|
* */
|
||||||
long currentTime = AWMp4ParserHelper.getInstance().getVedioTotalTime(new File(finalVideoPath));
|
// long currentTime = AWMp4ParserHelper.getInstance().getVedioTotalTime(new File(finalVideoPath));
|
||||||
timerTask = new CsvTimerTask(new File(finalVideoPath+".txt"));
|
timerTask = new CsvTimerTask(new File(finalVideoPath+".txt"));
|
||||||
|
|
||||||
// 开始采集,每隔2秒实时记录位置信息、视频时间以及设备时间
|
|
||||||
if (currentTime == 0) {
|
|
||||||
timer.schedule(timerTask, 0, period*1000);
|
timer.schedule(timerTask, 0, period*1000);
|
||||||
} else {
|
|
||||||
timerTask.setCurrentVideoTime(currentTime/1000+1);
|
// // 开始采集,每隔2秒实时记录位置信息、视频时间以及设备时间
|
||||||
timer.schedule(timerTask, 1, period*1000);
|
// if (currentTime == 0) {
|
||||||
}
|
// timer.schedule(timerTask, 0, period*1000);
|
||||||
|
// } else {
|
||||||
|
// timerTask.setCurrentVideoTime(currentTime/1000+1);
|
||||||
|
// timer.schedule(timerTask, 1, period*1000);
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,6 +361,15 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
|||||||
// startTakenVideo(); // 开始拍摄视频
|
// startTakenVideo(); // 开始拍摄视频
|
||||||
// break;
|
// break;
|
||||||
case R.id.btn_stop_video:
|
case R.id.btn_stop_video:
|
||||||
|
stopVideoAndFinish();
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void stopVideoAndFinish() {
|
||||||
|
showLoadingDialog();
|
||||||
if (timerTask!=null){
|
if (timerTask!=null){
|
||||||
timerTask.cancel();
|
timerTask.cancel();
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
@ -369,23 +384,20 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
|||||||
} else {
|
} else {
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void startTakenVideo() {
|
private void startTakenVideo() {
|
||||||
if (camera.isTakingVideo()) {
|
if (camera.isTakingVideo()) {
|
||||||
Toast.makeText(this, "已经在拍摄中...", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "已经在拍摄中...", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
|
// DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||||
Calendar calendar = Calendar.getInstance();
|
// Calendar calendar = Calendar.getInstance();
|
||||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
// calendar.setTimeInMillis(System.currentTimeMillis());
|
||||||
String formatVideoName = formatter.format(calendar.getTime());
|
// String formatVideoName = formatter.format(calendar.getTime());
|
||||||
//文件
|
//文件
|
||||||
File file = new File(Constant.PICTURE_FOLDER, formatVideoName + ".mp4");
|
// String path = finalVideoPath.substring(finalVideoPath.length()-20);
|
||||||
|
File file = new File(finalVideoPath);
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
try {
|
try {
|
||||||
FileOutputStream fo = new FileOutputStream(file);
|
FileOutputStream fo = new FileOutputStream(file);
|
||||||
@ -544,6 +556,12 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
|||||||
sb.append(Constant.currentLocation.getLatitude());
|
sb.append(Constant.currentLocation.getLatitude());
|
||||||
sb.append(",");
|
sb.append(",");
|
||||||
sb.append(Constant.currentLocation.getLongitude());
|
sb.append(Constant.currentLocation.getLongitude());
|
||||||
|
sb.append(",");
|
||||||
|
if (Constant.currentLocation.getBearing()!=0) {
|
||||||
|
sb.append(Constant.currentLocation.getBearing());
|
||||||
|
} else {
|
||||||
|
sb.append(Constant.currentLocation.getDirection());
|
||||||
|
}
|
||||||
sb.append("\r\n");
|
sb.append("\r\n");
|
||||||
FileUtils.writeFile(csvFile.getAbsolutePath(), sb.toString(), true);
|
FileUtils.writeFile(csvFile.getAbsolutePath(), sb.toString(), true);
|
||||||
currentVideoTime = currentVideoTime+period; //
|
currentVideoTime = currentVideoTime+period; //
|
||||||
|
@ -345,9 +345,10 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
|||||||
}
|
}
|
||||||
InsertAndUpdateUtils.getInstance().insertOrUpdateChargingPile(getActivity(), chargingPileEntityList);
|
InsertAndUpdateUtils.getInstance().insertOrUpdateChargingPile(getActivity(), chargingPileEntityList);
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取当前位置的marker
|
//获取当前位置的marker
|
||||||
senMessageMarker(chargingStationEntity.getType(), chargingStationEntity.getY(), chargingStationEntity.getX());
|
// senMessageMarker(chargingStationEntity.getType(), chargingStationEntity.getY(), chargingStationEntity.getX());
|
||||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(),chargingStationEntity);
|
// InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(),chargingStationEntity);
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -154,13 +154,14 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
|
|||||||
|
|
||||||
private void gatheringNetWork() {
|
private void gatheringNetWork() {
|
||||||
showLoadingDialog();
|
showLoadingDialog();
|
||||||
gatheringList = new ArrayList<>();
|
if (ivGathering.getTag()==null){
|
||||||
File gatheringFile = new File(gatheringPath);
|
Toast.makeText(getContext(), "银行卡照片不能为空", Toast.LENGTH_SHORT).show();
|
||||||
if (!gatheringFile.exists()) {
|
|
||||||
Toast.makeText(getContext(), "身份证照片不能为空", Toast.LENGTH_SHORT).show();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gatheringList.add(gatheringFile);
|
gatheringList = new ArrayList<>();
|
||||||
|
String ivGatheringTag = (String) ivGathering.getTag();
|
||||||
|
gatheringList.add(new File(ivGatheringTag));
|
||||||
|
|
||||||
String etBankAccount = etBankNum.getText().toString().trim();
|
String etBankAccount = etBankNum.getText().toString().trim();
|
||||||
if (etBankAccount == null || etBankAccount.equals("")) {
|
if (etBankAccount == null || etBankAccount.equals("")) {
|
||||||
Toast.makeText(getContext(), "银行卡号不能为空", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getContext(), "银行卡号不能为空", Toast.LENGTH_SHORT).show();
|
||||||
|
@ -28,6 +28,7 @@ import androidx.annotation.Nullable;
|
|||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import com.github.lazylibrary.util.FileUtils;
|
import com.github.lazylibrary.util.FileUtils;
|
||||||
|
import com.github.lazylibrary.util.StringUtils;
|
||||||
import com.github.lazylibrary.util.ZipUtil;
|
import com.github.lazylibrary.util.ZipUtil;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.hjq.permissions.OnPermissionCallback;
|
import com.hjq.permissions.OnPermissionCallback;
|
||||||
@ -162,13 +163,14 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
fmPoiVideoPic.setOnClickListener(new View.OnClickListener() {
|
fmPoiVideoPic.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (v.getTag() == null) {
|
if (v.getTag() == null || ((List<File>) v.getTag()).size() == 0) {
|
||||||
Toast.makeText(getActivity(), "还没有拍摄视频!", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "还没有拍摄视频!", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
File videoFile = (File) v.getTag();
|
|
||||||
|
File finalFile = AWMp4ParserHelper.getInstance().obtainMp4FilePath(showPoiEntity.getId(), fmPoiVideoPic.getTag());
|
||||||
Intent intent = new Intent(getContext(), PictureActivity.class);
|
Intent intent = new Intent(getContext(), PictureActivity.class);
|
||||||
intent.putExtra(Constant.INTENT_VIDEO_PATH, videoFile.getAbsolutePath());
|
intent.putExtra(Constant.INTENT_VIDEO_PATH, finalFile.getAbsolutePath());
|
||||||
startActivityForResult(intent, 0x101);
|
startActivityForResult(intent, 0x101);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -210,15 +212,27 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
showPictureType(work_type);
|
showPictureType(work_type);
|
||||||
String describe = showPoiEntity.getMemo();//任务描述
|
String describe = showPoiEntity.getMemo();//任务描述
|
||||||
if (describe != null && !describe.equals("")) {
|
if (describe != null && !describe.equals("")) {
|
||||||
etDesc.setText(describe+"");
|
etDesc.setText(describe + "");
|
||||||
}
|
}
|
||||||
String photo = showPoiEntity.getPhoto();
|
String photoList = showPoiEntity.getPhoto();
|
||||||
if (photo != null) {
|
if (!StringUtils.isEmpty(photoList)) {
|
||||||
|
String[] photos = photoList.split(",");
|
||||||
|
List<File> videoFileList = new ArrayList<>();
|
||||||
|
boolean isImageLoad = false;
|
||||||
|
if (photos != null && photos.length > 0) {
|
||||||
|
for (int i = 0; i < photos.length; i++) {
|
||||||
|
String photo = photos[i];
|
||||||
|
if (!StringUtils.isEmpty(photo)) {
|
||||||
File videoFile = new File(photo);
|
File videoFile = new File(photo);
|
||||||
if (videoFile.exists()) {
|
videoFileList.add(new File(photo));
|
||||||
|
if (videoFile.exists() && !isImageLoad) {
|
||||||
// 使用glide加载视频的第一帧
|
// 使用glide加载视频的第一帧
|
||||||
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivPoiVideoPicture, 500);
|
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivPoiVideoPicture, 500);
|
||||||
fmPoiVideoPic.setTag(videoFile);
|
isImageLoad = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fmPoiVideoPic.setTag(videoFileList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -272,27 +286,30 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
break;
|
break;
|
||||||
case R.id.tv_pictures:
|
case R.id.tv_pictures:
|
||||||
// 根据用户点击的时间为视频名称赋值
|
// 根据用户点击的时间为视频名称赋值
|
||||||
DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
|
// DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||||
String videoFormatName = formatter.format(new Date());
|
// String videoFormatName = formatter.format(new Date());
|
||||||
Intent intent = new Intent(getContext(), PictureActivity.class);
|
|
||||||
intent.putExtra(Constant.INTENT_VIDEO_PATH, Constant.PICTURE_FOLDER + "/" + videoFormatName + ".mp4");
|
|
||||||
startActivityForResult(intent, 0x101);
|
|
||||||
|
|
||||||
|
Intent intent = new Intent(getContext(), PictureActivity.class);
|
||||||
|
File finalFile = AWMp4ParserHelper.getInstance().obtainMp4FilePath(showPoiEntity.getId(), fmPoiVideoPic.getTag());
|
||||||
|
intent.putExtra(Constant.INTENT_VIDEO_PATH, finalFile.getAbsolutePath());
|
||||||
|
startActivityForResult(intent, 0x101);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case R.id.btn_poi_video_upload:
|
case R.id.btn_poi_video_upload:
|
||||||
showLoadingDialog();
|
showLoadingDialog();
|
||||||
ArrayList<File> videoFileList = new ArrayList<>();
|
ArrayList<File> fileList = new ArrayList<>();
|
||||||
if (fmPoiVideoPic.getTag() != null) {
|
if (fmPoiVideoPic.getTag() != null) {
|
||||||
File videoFile = (File) fmPoiVideoPic.getTag();
|
List<File> videoFileList = (List<File>) fmPoiVideoPic.getTag();
|
||||||
videoFileList.add(videoFile);
|
for (File videoFile : videoFileList) {
|
||||||
File file = new File(videoFile.getPath()+".txt");
|
fileList.add(videoFile);
|
||||||
videoFileList.add(file);
|
File file = new File(videoFile.getPath() + ".txt");
|
||||||
|
fileList.add(file);
|
||||||
|
}
|
||||||
fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
|
fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
ZipUtil.zipFiles(videoFileList, fileZip, null);
|
ZipUtil.zipFiles(fileList, fileZip, null);
|
||||||
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||||
if (poiDaoPoiEntity == null || poiDaoPoiEntity.getTaskStatus() == 1 || poiDaoPoiEntity.getTaskStatus() == 2 || poiDaoPoiEntity.getTaskStatus() == 0) {
|
if (poiDaoPoiEntity == null || poiDaoPoiEntity.getTaskStatus() == 1 || poiDaoPoiEntity.getTaskStatus() == 2 || poiDaoPoiEntity.getTaskStatus() == 0) {
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
@ -314,7 +331,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
|
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
}else {
|
} else {
|
||||||
dismissLoadingDialog();
|
dismissLoadingDialog();
|
||||||
Toast.makeText(getContext(), "请录像", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getContext(), "请录像", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
@ -359,13 +376,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
int pictureType = getPictureType();
|
|
||||||
if (pictureType == -1) {
|
|
||||||
Toast.makeText(getContext(), "请选择拍照方式", Toast.LENGTH_SHORT).show();
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
poiEntity.setWork_type(pictureType);
|
|
||||||
}
|
|
||||||
String desc = etDesc.getText().toString().trim();
|
String desc = etDesc.getText().toString().trim();
|
||||||
if (desc != null && !desc.equals("")) {
|
if (desc != null && !desc.equals("")) {
|
||||||
poiEntity.setMemo(desc);
|
poiEntity.setMemo(desc);
|
||||||
@ -375,31 +386,18 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
poiEntity.setTaskId(showPoiEntity.getTaskId());
|
poiEntity.setTaskId(showPoiEntity.getTaskId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
File videoFile = (File) fmPoiVideoPic.getTag();
|
if (fmPoiVideoPic.getTag() == null || ((List<File>) fmPoiVideoPic.getTag()).isEmpty()) {
|
||||||
if (videoFile == null ) {
|
|
||||||
Toast.makeText(getActivity(), "请录像", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "请录像", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
String lineString = GeometryTools.getLineString(getLineString());
|
||||||
String path = videoFile.getPath() + ".txt";
|
String filePathString = getPhotoStrFromTag();
|
||||||
poiEntity.setPhoto(videoFile.getAbsolutePath());
|
|
||||||
List<String> strings = FileUtils.readFileToList(path, "utf-8");
|
|
||||||
ArrayList<LatLng> latLngs = new ArrayList<>();
|
|
||||||
for (int i = 0; i < strings.size(); i++) {
|
|
||||||
String[] split = strings.get(i).split(",");
|
|
||||||
LatLng latLng = new LatLng();
|
|
||||||
latLng.setLatitude(Double.valueOf(split[2]));
|
|
||||||
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);
|
Log.d("TAG", "onGranted: " + lineString);
|
||||||
|
poiEntity.setPhoto(filePathString);
|
||||||
|
if (lineString != null) {
|
||||||
poiEntity.setGeoWkt(lineString);
|
poiEntity.setGeoWkt(lineString);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
@ -440,6 +438,44 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getPhotoStrFromTag() {
|
||||||
|
List<File> videoFileList = (List<File>) fmPoiVideoPic.getTag();
|
||||||
|
|
||||||
|
StringBuilder filePathStringBuilder = new StringBuilder("");
|
||||||
|
for (int m = 0; m < videoFileList.size(); m++) {
|
||||||
|
File videoFile = videoFileList.get(m);
|
||||||
|
filePathStringBuilder.append(videoFile.getAbsolutePath());
|
||||||
|
if (m != videoFileList.size() - 1) {
|
||||||
|
filePathStringBuilder.append(",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return filePathStringBuilder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<LatLng> getLineString() {
|
||||||
|
List<File> videoFileList = (List<File>) fmPoiVideoPic.getTag();
|
||||||
|
|
||||||
|
List<LatLng> latLngs = new ArrayList<>();
|
||||||
|
StringBuilder filePathStringBuilder = new StringBuilder("");
|
||||||
|
for (int m = 0; m < videoFileList.size(); m++) {
|
||||||
|
File videoFile = videoFileList.get(m);
|
||||||
|
|
||||||
|
String path = videoFile.getPath() + ".txt";
|
||||||
|
List<String> strings = FileUtils.readFileToList(path, "utf-8");
|
||||||
|
for (int i = 0; i < strings.size(); i++) {
|
||||||
|
String[] split = strings.get(i).split(",");
|
||||||
|
LatLng latLng = new LatLng();
|
||||||
|
latLng.setLatitude(Double.valueOf(split[2]));
|
||||||
|
latLng.setLongitude(Double.valueOf(split[3]));
|
||||||
|
latLngs.add(latLng);
|
||||||
|
}
|
||||||
|
if (strings.size() == 1) {
|
||||||
|
LatLng latLng = latLngs.get(0);
|
||||||
|
latLngs.add(latLng);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return latLngs;
|
||||||
|
}
|
||||||
|
|
||||||
private void poiVideoUpload(int poiVideoBody, File fileZip) {
|
private void poiVideoUpload(int poiVideoBody, File fileZip) {
|
||||||
if (poiVideoBody == 0) {
|
if (poiVideoBody == 0) {
|
||||||
@ -508,7 +544,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
@Override
|
@Override
|
||||||
public void onSuccess(PoiVideoBean poiVideoBean, int id) {
|
public void onSuccess(PoiVideoBean poiVideoBean, int id) {
|
||||||
dismissLoadingDialog();
|
dismissLoadingDialog();
|
||||||
if (poiVideoBean.getCode()==200){
|
if (poiVideoBean.getCode() == 200) {
|
||||||
Integer poiVideoBody = poiVideoBean.getBody();
|
Integer poiVideoBody = poiVideoBean.getBody();
|
||||||
if (poiVideoBody != null && poiVideoBody != 0) {
|
if (poiVideoBody != null && poiVideoBody != 0) {
|
||||||
poiEntity.setBodyId(poiVideoBody);
|
poiEntity.setBodyId(poiVideoBody);
|
||||||
@ -531,10 +567,10 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(getActivity(), ""+poiVideoBean.getMessage(), Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "" + poiVideoBean.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
Toast.makeText(getActivity(), ""+poiVideoBean.getMessage(), Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "" + poiVideoBean.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -556,11 +592,15 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
|
|
||||||
if (requestCode == 0x101 && resultCode == 0x101) {
|
if (requestCode == 0x101 && resultCode == 0x101) {
|
||||||
if (data != null && data.hasExtra(Constant.INTENT_VIDEO_PATH)) {
|
if (data != null && data.hasExtra(Constant.INTENT_VIDEO_PATH)) {
|
||||||
videoPath = data.getStringExtra(Constant.INTENT_VIDEO_PATH);
|
String videoPath = data.getStringExtra(Constant.INTENT_VIDEO_PATH);
|
||||||
File videoFile = new File(videoPath);
|
File videoFile = new File(videoPath);
|
||||||
if (videoFile.exists()) {
|
if (videoFile.exists()) {
|
||||||
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivPoiVideoPicture, 500);
|
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivPoiVideoPicture, 500);
|
||||||
fmPoiVideoPic.setTag(videoFile);
|
if (fmPoiVideoPic.getTag() == null) {
|
||||||
|
fmPoiVideoPic.setTag(new ArrayList<>());
|
||||||
|
}
|
||||||
|
List<File> fileList = (List<File>) fmPoiVideoPic.getTag();
|
||||||
|
fileList.add(videoFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -606,6 +646,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
poiEntity.setType(3);
|
poiEntity.setType(3);
|
||||||
poiEntity.setTaskStatus(2);
|
poiEntity.setTaskStatus(2);
|
||||||
poiEntity.setIsLocalData(1);
|
poiEntity.setIsLocalData(1);
|
||||||
|
poiEntity.setPhoto(getPhotoStrFromTag());
|
||||||
String newPoiEntity = new Gson().toJson(poiEntity);
|
String newPoiEntity = new Gson().toJson(poiEntity);
|
||||||
//以键值对的形式添加新值。
|
//以键值对的形式添加新值。
|
||||||
edit.putString("poiEntity", newPoiEntity);
|
edit.putString("poiEntity", newPoiEntity);
|
||||||
@ -655,8 +696,8 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||||
if (poiDaoPoiEntity!=null) {
|
if (poiDaoPoiEntity != null) {
|
||||||
if (poiDaoPoiEntity.getTaskStatus()==5){
|
if (poiDaoPoiEntity.getTaskStatus() == 5) {
|
||||||
poiDao.deletePoiEntity(poiDaoPoiEntity);
|
poiDao.deletePoiEntity(poiDaoPoiEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,13 +25,19 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import com.github.lazylibrary.util.FileUtils;
|
import com.github.lazylibrary.util.FileUtils;
|
||||||
|
import com.github.lazylibrary.util.StringUtils;
|
||||||
import com.github.lazylibrary.util.ZipUtil;
|
import com.github.lazylibrary.util.ZipUtil;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.hjq.permissions.OnPermissionCallback;
|
import com.hjq.permissions.OnPermissionCallback;
|
||||||
import com.hjq.permissions.Permission;
|
import com.hjq.permissions.Permission;
|
||||||
import com.hjq.permissions.XXPermissions;
|
import com.hjq.permissions.XXPermissions;
|
||||||
|
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.OkGo;
|
||||||
import com.lzy.okgo.model.HttpParams;
|
import com.lzy.okgo.model.HttpParams;
|
||||||
import com.lzy.okgo.model.Response;
|
import com.lzy.okgo.model.Response;
|
||||||
@ -85,7 +91,6 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
|||||||
private PoiDao poiDao;
|
private PoiDao poiDao;
|
||||||
private PoiEntity showPoiEntity;
|
private PoiEntity showPoiEntity;
|
||||||
private Button roadUpload;
|
private Button roadUpload;
|
||||||
private String videoPath;
|
|
||||||
private File fileZip;
|
private File fileZip;
|
||||||
private FrameLayout fmRoadPic;
|
private FrameLayout fmRoadPic;
|
||||||
|
|
||||||
@ -158,16 +163,39 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
|||||||
fmRoadPic.setOnClickListener(new View.OnClickListener() {
|
fmRoadPic.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (v.getTag() == null) {
|
if (v.getTag() == null || ((List<File>)v.getTag()).size()==0) {
|
||||||
Toast.makeText(getActivity(), "还没有拍摄视频!", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "还没有拍摄视频!", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
File videoFile = (File) v.getTag();
|
|
||||||
|
File finalFile = AWMp4ParserHelper.getInstance().obtainMp4FilePath(showPoiEntity.getId(), fmRoadPic.getTag());
|
||||||
Intent intent = new Intent(getContext(), PictureActivity.class);
|
Intent intent = new Intent(getContext(), PictureActivity.class);
|
||||||
intent.putExtra(Constant.INTENT_VIDEO_PATH, videoFile.getAbsolutePath());
|
intent.putExtra(Constant.INTENT_VIDEO_PATH, finalFile.getAbsolutePath());
|
||||||
startActivityForResult(intent, 0x101);
|
startActivityForResult(intent, 0x101);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
fmRoadPic.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) fmRoadPic.getTag();
|
||||||
|
if (videoFile != null) {
|
||||||
|
videoFile.delete();
|
||||||
|
//获取文件名
|
||||||
|
String csvFileName = videoFile.getName() + ".txt";
|
||||||
|
File cavFile = new File(videoFile.getParent(), csvFileName);
|
||||||
|
cavFile.delete();
|
||||||
|
ivRoadPicture.setImageDrawable(null);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
//数据展示
|
//数据展示
|
||||||
initShowPoi();
|
initShowPoi();
|
||||||
//禁用可操作性控件
|
//禁用可操作性控件
|
||||||
@ -189,13 +217,26 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
|||||||
if (describe != null && !describe.equals("")) {
|
if (describe != null && !describe.equals("")) {
|
||||||
etDesc.setText(describe);
|
etDesc.setText(describe);
|
||||||
}
|
}
|
||||||
String photo = showPoiEntity.getPhoto();
|
String photoList = showPoiEntity.getPhoto();
|
||||||
if (photo != null) {
|
if (!StringUtils.isEmpty(photoList)) {
|
||||||
|
String[] photos = photoList.split(",");
|
||||||
|
List<File> videoFileList = new ArrayList<>();
|
||||||
|
boolean isImageLoad = false;
|
||||||
|
if (photos!=null&&photos.length>0) {
|
||||||
|
for (int i = 0; i < photos.length; i++) {
|
||||||
|
String photo = photos[i];
|
||||||
|
if (!StringUtils.isEmpty(photo)) {
|
||||||
File videoFile = new File(photo);
|
File videoFile = new File(photo);
|
||||||
if (videoFile.exists()) {
|
videoFileList.add(new File(photo));
|
||||||
|
if (videoFile.exists()&&!isImageLoad) {
|
||||||
// 使用glide加载视频的第一帧
|
// 使用glide加载视频的第一帧
|
||||||
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivRoadPicture, 500);
|
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivRoadPicture, 500);
|
||||||
fmRoadPic.setTag(videoFile);
|
isImageLoad = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fmRoadPic.setTag(videoFileList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -257,27 +298,29 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
|||||||
case R.id.tv_pictures:
|
case R.id.tv_pictures:
|
||||||
|
|
||||||
// 根据用户点击的时间为视频名称赋值
|
// 根据用户点击的时间为视频名称赋值
|
||||||
DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
|
// DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||||
String videoFormatName = formatter.format(new Date());
|
// String videoFormatName = formatter.format(new Date());
|
||||||
Intent intent = new Intent(getContext(), PictureActivity.class);
|
Intent intent = new Intent(getContext(), PictureActivity.class);
|
||||||
intent.putExtra(Constant.INTENT_VIDEO_PATH, Constant.PICTURE_FOLDER + "/" + videoFormatName + ".mp4");
|
File finalFile = AWMp4ParserHelper.getInstance().obtainMp4FilePath(showPoiEntity.getId(), fmRoadPic.getTag());
|
||||||
|
intent.putExtra(Constant.INTENT_VIDEO_PATH, finalFile.getAbsolutePath());
|
||||||
startActivityForResult(intent, 0x101);
|
startActivityForResult(intent, 0x101);
|
||||||
break;
|
break;
|
||||||
case R.id.road_upload:
|
case R.id.road_upload:
|
||||||
showLoadingDialog();
|
showLoadingDialog();
|
||||||
ArrayList<File> videoFileList = new ArrayList<>();
|
ArrayList<File> fileList = new ArrayList<>();
|
||||||
if (fmRoadPic.getTag() != null) {
|
if (fmRoadPic.getTag() != null) {
|
||||||
|
List<File> videoFileList = (List<File>) fmRoadPic.getTag();
|
||||||
File videoFile = (File) fmRoadPic.getTag();
|
for (File videoFile: videoFileList) {
|
||||||
videoFileList.add(videoFile);
|
fileList.add(videoFile);
|
||||||
File file = new File(videoFile.getPath() + ".txt");
|
File file = new File(videoFile.getPath() + ".txt");
|
||||||
videoFileList.add(file);
|
fileList.add(file);
|
||||||
|
}
|
||||||
fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
|
fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
|
||||||
|
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
ZipUtil.zipFiles(videoFileList, fileZip, null);
|
ZipUtil.zipFiles(fileList, fileZip, null);
|
||||||
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||||
if (poiDaoPoiEntity == null || poiDaoPoiEntity.getTaskStatus() == 1 || poiDaoPoiEntity.getTaskStatus() == 2 || poiDaoPoiEntity.getTaskStatus() == 0) {
|
if (poiDaoPoiEntity == null || poiDaoPoiEntity.getTaskStatus() == 1 || poiDaoPoiEntity.getTaskStatus() == 2 || poiDaoPoiEntity.getTaskStatus() == 0) {
|
||||||
dismissLoadingDialog();
|
dismissLoadingDialog();
|
||||||
@ -349,30 +392,19 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
|||||||
poiEntity.setTaskId(showPoiEntity.getTaskId());
|
poiEntity.setTaskId(showPoiEntity.getTaskId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fmRoadPic.getTag() == null) {
|
if (fmRoadPic.getTag() == null||((List<File>) fmRoadPic.getTag()).isEmpty()) {
|
||||||
Toast.makeText(getActivity(), "请录像", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "请录像", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
File videoFile = (File) fmRoadPic.getTag();
|
|
||||||
String path = videoFile.getPath() + ".txt";
|
String lineString = GeometryTools.getLineString(getLineString());
|
||||||
poiEntity.setPhoto(videoFile.getAbsolutePath());
|
String filePathString = getPhotoStrFromTag();
|
||||||
List<String> strings = FileUtils.readFileToList(path, "utf-8");
|
|
||||||
ArrayList<LatLng> latLngs = new ArrayList<>();
|
|
||||||
for (int i = 0; i < strings.size(); i++) {
|
|
||||||
String[] split = strings.get(i).split(",");
|
|
||||||
LatLng latLng = new LatLng();
|
|
||||||
latLng.setLatitude(Double.valueOf(split[2]));
|
|
||||||
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);
|
Log.d("TAG", "onGranted: " + lineString);
|
||||||
|
poiEntity.setPhoto(filePathString);
|
||||||
|
if (lineString!=null) {
|
||||||
poiEntity.setGeoWkt(lineString);
|
poiEntity.setGeoWkt(lineString);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
int pictureType = getPictureType();
|
int pictureType = getPictureType();
|
||||||
if (pictureType == -1) {
|
if (pictureType == -1) {
|
||||||
Toast.makeText(getContext(), "请选择拍照方式", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getContext(), "请选择拍照方式", Toast.LENGTH_SHORT).show();
|
||||||
@ -418,6 +450,45 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getPhotoStrFromTag() {
|
||||||
|
List<File> videoFileList = (List<File>) fmRoadPic.getTag();
|
||||||
|
|
||||||
|
StringBuilder filePathStringBuilder = new StringBuilder("");
|
||||||
|
for (int m = 0; m < videoFileList.size(); m++) {
|
||||||
|
File videoFile = videoFileList.get(m);
|
||||||
|
filePathStringBuilder.append(videoFile.getAbsolutePath());
|
||||||
|
if (m != videoFileList.size()-1) {
|
||||||
|
filePathStringBuilder.append(",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return filePathStringBuilder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<LatLng> getLineString() {
|
||||||
|
List<File> videoFileList = (List<File>) fmRoadPic.getTag();
|
||||||
|
|
||||||
|
List<LatLng> latLngs = new ArrayList<>();
|
||||||
|
StringBuilder filePathStringBuilder = new StringBuilder("");
|
||||||
|
for (int m = 0; m < videoFileList.size(); m++) {
|
||||||
|
File videoFile = videoFileList.get(m);
|
||||||
|
|
||||||
|
String path = videoFile.getPath() + ".txt";
|
||||||
|
List<String> strings = FileUtils.readFileToList(path, "utf-8");
|
||||||
|
for (int i = 0; i < strings.size(); i++) {
|
||||||
|
String[] split = strings.get(i).split(",");
|
||||||
|
LatLng latLng = new LatLng();
|
||||||
|
latLng.setLatitude(Double.valueOf(split[2]));
|
||||||
|
latLng.setLongitude(Double.valueOf(split[3]));
|
||||||
|
latLngs.add(latLng);
|
||||||
|
}
|
||||||
|
if (strings.size() == 1) {
|
||||||
|
LatLng latLng = latLngs.get(0);
|
||||||
|
latLngs.add(latLng);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return latLngs;
|
||||||
|
}
|
||||||
|
|
||||||
private void poiVideoUpload(int body, File fileZip) {
|
private void poiVideoUpload(int body, File fileZip) {
|
||||||
if (body == 0) {
|
if (body == 0) {
|
||||||
Toast.makeText(getContext(), "请先保存本地在上传", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getContext(), "请先保存本地在上传", Toast.LENGTH_SHORT).show();
|
||||||
@ -534,11 +605,32 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
|||||||
if (requestCode == 0x101) {
|
if (requestCode == 0x101) {
|
||||||
if (resultCode == 0x101) {
|
if (resultCode == 0x101) {
|
||||||
if (data != null && data.hasExtra(Constant.INTENT_VIDEO_PATH)) {
|
if (data != null && data.hasExtra(Constant.INTENT_VIDEO_PATH)) {
|
||||||
videoPath = data.getStringExtra(Constant.INTENT_VIDEO_PATH);
|
String videoPath = data.getStringExtra(Constant.INTENT_VIDEO_PATH);
|
||||||
File videoFile = new File(videoPath);
|
File videoFile = new File(videoPath);
|
||||||
if (videoFile.exists()) {
|
if (videoFile.exists()) {
|
||||||
|
Bitmap bitmap = AWMp4ParserHelper.getInstance().getLocalVideoBitmap(videoPath);
|
||||||
|
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(getActivity(),PictureActivity.class);
|
||||||
|
startActivityForResult(intentPanorama, 0x101);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}else {
|
||||||
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivRoadPicture, 500);
|
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivRoadPicture, 500);
|
||||||
fmRoadPic.setTag(videoFile);
|
if (fmRoadPic.getTag() == null) {
|
||||||
|
fmRoadPic.setTag(new ArrayList<>());
|
||||||
|
}
|
||||||
|
List<File> fileList = (List<File>) fmRoadPic.getTag();
|
||||||
|
fileList.add(videoFile);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,14 +118,6 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
|||||||
startActivityForResult(ivAttestation3, 300);
|
startActivityForResult(ivAttestation3, 300);
|
||||||
break;
|
break;
|
||||||
case R.id.btn_attestation:
|
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("")) {
|
if (etAttestationName.getText().toString() == null || etAttestationName.getText().toString().equals("")) {
|
||||||
Toast.makeText(getContext(), "姓名不能为空,请输入姓名", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getContext(), "姓名不能为空,请输入姓名", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
@ -216,6 +208,7 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
|||||||
|
|
||||||
Log.d("TAG", "onSuccess: " + response.toString() + "sssssssssssss");
|
Log.d("TAG", "onSuccess: " + response.toString() + "sssssssssssss");
|
||||||
if (response.body().equals("0")) {
|
if (response.body().equals("0")) {
|
||||||
|
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||||
MessageDialog.show((AppCompatActivity) getActivity(), "提示", "不通过", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
MessageDialog.show((AppCompatActivity) getActivity(), "提示", "不通过", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||||
@ -226,6 +219,7 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||||
MessageDialog.show((AppCompatActivity) getActivity(), "提示", "通过", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
MessageDialog.show((AppCompatActivity) getActivity(), "提示", "通过", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||||
|
@ -14,17 +14,20 @@ import com.bumptech.glide.load.resource.bitmap.BitmapTransformation;
|
|||||||
import com.bumptech.glide.load.resource.bitmap.VideoDecoder;
|
import com.bumptech.glide.load.resource.bitmap.VideoDecoder;
|
||||||
import com.bumptech.glide.request.RequestOptions;
|
import com.bumptech.glide.request.RequestOptions;
|
||||||
import com.coremedia.iso.boxes.Container;
|
import com.coremedia.iso.boxes.Container;
|
||||||
|
import com.github.lazylibrary.util.StringUtils;
|
||||||
import com.googlecode.mp4parser.authoring.Movie;
|
import com.googlecode.mp4parser.authoring.Movie;
|
||||||
import com.googlecode.mp4parser.authoring.Track;
|
import com.googlecode.mp4parser.authoring.Track;
|
||||||
import com.googlecode.mp4parser.authoring.builder.DefaultMp4Builder;
|
import com.googlecode.mp4parser.authoring.builder.DefaultMp4Builder;
|
||||||
import com.googlecode.mp4parser.authoring.container.mp4.MovieCreator;
|
import com.googlecode.mp4parser.authoring.container.mp4.MovieCreator;
|
||||||
import com.googlecode.mp4parser.authoring.tracks.AppendTrack;
|
import com.googlecode.mp4parser.authoring.tracks.AppendTrack;
|
||||||
|
import com.navinfo.outdoor.api.Constant;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.RandomAccessFile;
|
import java.io.RandomAccessFile;
|
||||||
import java.nio.channels.FileChannel;
|
import java.nio.channels.FileChannel;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
@ -38,10 +41,12 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public class AWMp4ParserHelper {
|
public class AWMp4ParserHelper {
|
||||||
private static AWMp4ParserHelper instance;
|
private static AWMp4ParserHelper instance;
|
||||||
|
private static SimpleDateFormat simpleDateFormat;
|
||||||
|
|
||||||
public static AWMp4ParserHelper getInstance() {
|
public static AWMp4ParserHelper getInstance() {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
instance = new AWMp4ParserHelper();
|
instance = new AWMp4ParserHelper();
|
||||||
|
simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||||
}
|
}
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
@ -182,4 +187,31 @@ public class AWMp4ParserHelper {
|
|||||||
}
|
}
|
||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成mp4文件拍摄的生成路径
|
||||||
|
* */
|
||||||
|
public File obtainMp4FilePath(String uuid, Object tag) {
|
||||||
|
if (tag == null) {
|
||||||
|
return new File(Constant.PICTURE_FOLDER+"/"+uuid+"-0.mp4");
|
||||||
|
}
|
||||||
|
List<File> fileList = (List<File>) tag;
|
||||||
|
if (fileList == null || fileList.isEmpty()) {
|
||||||
|
return new File(Constant.PICTURE_FOLDER+"/"+uuid+"-0.mp4");
|
||||||
|
}
|
||||||
|
int maxIndex = 0;
|
||||||
|
for (int i = 0; i < fileList.size(); i++) {
|
||||||
|
File file = fileList.get(i);
|
||||||
|
if (file!=null) {
|
||||||
|
String[] fileSplite = file.getName().replace(".mp4", "").split("-");
|
||||||
|
if (fileSplite!=null&&fileSplite.length>0&&fileSplite[fileSplite.length-1]!=null) {
|
||||||
|
int index = Integer.parseInt(fileSplite[fileSplite.length-1]);
|
||||||
|
if (index>=maxIndex) {
|
||||||
|
maxIndex = index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new File(Constant.PICTURE_FOLDER+"/"+uuid+"-"+(maxIndex+1)+".mp4");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,6 +72,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/uploding_shape"
|
android:background="@drawable/uploding_shape"
|
||||||
android:text="结束采集"
|
android:text="结束采集"
|
||||||
|
android:visibility="gone"
|
||||||
android:textColor="@color/colorBlue"
|
android:textColor="@color/colorBlue"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/capuretVideo"
|
app:layout_constraintBottom_toBottomOf="@id/capuretVideo"
|
||||||
app:layout_constraintLeft_toRightOf="@id/capuretVideo"
|
app:layout_constraintLeft_toRightOf="@id/capuretVideo"
|
||||||
|
@ -150,7 +150,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginLeft="5dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="拍照"
|
android:text="录像"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="15sp" />
|
android:textSize="15sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user