修改poi录像,道路 的拍摄,修改任务立即采集的逻辑

This commit is contained in:
wangdongsheng 2021-09-12 16:42:10 +08:00
parent 5ace14ca36
commit e09db95131
12 changed files with 261 additions and 761 deletions

View File

@ -114,6 +114,10 @@ public class PhotographActivity extends BaseActivity implements View.OnClickList
@Override @Override
public void onPictureTaken(@NonNull PictureResult result) { public void onPictureTaken(@NonNull PictureResult result) {
super.onPictureTaken(result); super.onPictureTaken(result);
if (Objects.requireNonNull(cameraView.getPictureSize()).getWidth() < cameraView.getPictureSize().getHeight()) {
Toast.makeText(PhotographActivity.this, "不允许竖向拍摄...", Toast.LENGTH_SHORT).show();
return;
}
File file = new File(photo_path); File file = new File(photo_path);
result.toFile(file, new FileCallback() { result.toFile(file, new FileCallback() {
@Override @Override

View File

@ -12,6 +12,7 @@ import android.graphics.Matrix;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.os.PersistableBundle;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
@ -87,12 +88,9 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
private ViewGroup layerChange; // 切换地图和相机的父控件 private ViewGroup layerChange; // 切换地图和相机的父控件
private CheckBox capturePicture, cbMapType;//拍照 private CheckBox capturePicture, cbMapType;//拍照
private boolean isMapSlide = false; private boolean isMapSlide = false;
/*
private boolean listenerPicture = false;
*/
private SimpleDateFormat formatter; private SimpleDateFormat formatter;
private File paperFile; private File paperFile;
private int type; private int poi_video_type;
private ImageView ivZoomAdd, ivZoomDel, ivLocation; private ImageView ivZoomAdd, ivZoomDel, ivLocation;
private Handler handler = new Handler(new Handler.Callback() { private Handler handler = new Handler(new Handler.Callback() {
@Override @Override
@ -104,7 +102,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
btnSwitch.setEnabled(true); btnSwitch.setEnabled(true);
} }
} else if (msg.what == 0x103) { } else if (msg.what == 0x103) {
if (type != 3) { if (poi_video_type != 2) {
capturePicture.setText("开始采集"); capturePicture.setText("开始采集");
} }
capturePicture.setChecked(false); capturePicture.setChecked(false);
@ -117,6 +115,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
private Timer timer; private Timer timer;
private TimerTask timerTask; private TimerTask timerTask;
private int videoIndex = -1; private int videoIndex = -1;
private int oration;
@Override @Override
protected int getLayout() { protected int getLayout() {
@ -132,7 +131,8 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
layerChange = findViewById(R.id.layer_change); layerChange = findViewById(R.id.layer_change);
if (getIntent() != null) { if (getIntent() != null) {
poiEntity = (PoiEntity) getIntent().getSerializableExtra("poiEntity"); poiEntity = (PoiEntity) getIntent().getSerializableExtra("poiEntity");
type = getIntent().getIntExtra("type", 0); poi_video_type = getIntent().getIntExtra(Constant.INTENT_POI_VIDEO_TYPE,-1);
oration = getIntent().getIntExtra(Constant.INTENT_VIDEO_OBLATION, -1);
finalVideoPath = getIntent().getStringExtra(Constant.INTENT_JPG_PATH); finalVideoPath = getIntent().getStringExtra(Constant.INTENT_JPG_PATH);
assert finalVideoPath != null; assert finalVideoPath != null;
File file = new File(finalVideoPath); File file = new File(finalVideoPath);
@ -149,50 +149,26 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
ivZoomAdd.setOnClickListener(this); ivZoomAdd.setOnClickListener(this);
ivZoomDel = findViewById(R.id.iv_zoom_del); ivZoomDel = findViewById(R.id.iv_zoom_del);
ivZoomDel.setOnClickListener(this); ivZoomDel.setOnClickListener(this);
/* cbMapType =findViewById(R.id.cb_map_type);
cbMapType.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
setLocMarkerStyle(LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER);
}
});*/
ivLocation = findViewById(R.id.iv_location); ivLocation = findViewById(R.id.iv_location);
ivLocation.setOnClickListener(this); ivLocation.setOnClickListener(this);
camera = findViewById(R.id.camera); camera = findViewById(R.id.camera);
camera.setOnClickListener(this); camera.setOnClickListener(this);
capturePicture = findViewById(R.id.capture_picture); capturePicture = findViewById(R.id.capture_picture);
if (type == 3) { if (poi_video_type == 2) {
capturePicture.setText("拍摄"); capturePicture.setText("拍摄");
} else { } else {
capturePicture.setText("开始采集"); capturePicture.setText("开始采集");
} }
/* capturePicture.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) { // 开始采集设置按钮文字内容为结束采集
if (type != 3) {
capturePicture.setText("暂停采集");
}
listenerPicture = true;
camera.takePicture();
} else {
listenerPicture = false;
if (type != 3) {
capturePicture.setText("开始采集");
}
}
}
});*/
capturePicture.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { capturePicture.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) { if (isChecked) {
if (type != 3) { if (poi_video_type != 2) {
capturePicture.setText("暂停采集"); capturePicture.setText("暂停采集");
} }
startTimer(); startTimer();
} else { } else {
if (type != 3) { if (poi_video_type != 2) {
capturePicture.setText("开始采集"); capturePicture.setText("开始采集");
} }
stopTimer(); stopTimer();
@ -231,6 +207,17 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
@Override @Override
public void onPictureTaken(@NonNull PictureResult result) { public void onPictureTaken(@NonNull PictureResult result) {
super.onPictureTaken(result); super.onPictureTaken(result);
if (oration == 0) { // oblation为0时拍摄视频必须为横屏
// 如果当前手机是竖向则不允许拍摄
if (Objects.requireNonNull(camera.getPictureSize()).getWidth() < camera.getPictureSize().getHeight()) {
Toast.makeText(PicturesActivity.this, "不允许竖向拍摄...", Toast.LENGTH_SHORT).show();
stopTimer();
if (poi_video_type != 2) {
capturePicture.setText("开始采集");
}
return;
}
}
File file = new File(finalVideoPath); File file = new File(finalVideoPath);
initMarkerPaper(); initMarkerPaper();
result.toFile(file, new FileCallback() { result.toFile(file, new FileCallback() {
@ -243,7 +230,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
finalVideoPath = Objects.requireNonNull(file.getParentFile()).getAbsolutePath() + "/" + (videoIndex + 1) + ".jpg"; finalVideoPath = Objects.requireNonNull(file.getParentFile()).getAbsolutePath() + "/" + (videoIndex + 1) + ".jpg";
Toast.makeText(PicturesActivity.this, "保存成功:" + (videoIndex + 1), Toast.LENGTH_SHORT).show(); Toast.makeText(PicturesActivity.this, "保存成功:" + (videoIndex + 1), Toast.LENGTH_SHORT).show();
} }
if (type==3){ if (poi_video_type==2){
Message message = new Message(); Message message = new Message();
message.what = 0x103; message.what = 0x103;
handler.sendMessage(message); handler.sendMessage(message);
@ -252,62 +239,6 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
}); });
} }
}); });
/* camera.addCameraListener(new CameraListener() {//相机预览监听
@Override
public void onPictureTaken(@NonNull @NotNull PictureResult result) {
if (listenerPicture) {
super.onPictureTaken(result);
//文件
File file = new File(finalVideoPath);
result.toFile(file, new FileCallback() {
@Override
public void onFileReady(@Nullable @org.jetbrains.annotations.Nullable File file) {
if (listenerPicture) {
assert file != null;
if (file.exists()) {
videoIndex = Integer.parseInt(file.getName().replace(".jpg", ""));
finalVideoPath = Objects.requireNonNull(file.getParentFile()).getAbsolutePath() + "/" + (videoIndex + 1) + ".jpg";
}
Message message = new Message();
initMarkerPaper();
if (type == 3) {
message.what = 0x103;
handler.sendMessageDelayed(message, 0);
Toast.makeText(PicturesActivity.this, "保存成功:" + (videoIndex+1), Toast.LENGTH_SHORT).show();
} else {
message.what = 0x101;
Toast.makeText(PicturesActivity.this, "保存成功" + (videoIndex+1), Toast.LENGTH_SHORT).show();
handler.sendMessageDelayed(message, 1500);
}
}
}
});
if (camera.isTakingVideo()) {
message("Captured while taking video. Size=" + result.getSize());
}
long callbackTime = System.currentTimeMillis();
captureTime = callbackTime - 300;
Log.d("captureTime", captureTime + "");
}
}
//录像监听
@Override
public void onVideoTaken(@NonNull @NotNull VideoResult result) {
super.onVideoTaken(result);
Toast.makeText(PicturesActivity.this, "暂停摄像", Toast.LENGTH_SHORT).show();
}
@Override
public void onCameraError(@NonNull @NotNull CameraException exception) {
super.onCameraError(exception);
Toast.makeText(PicturesActivity.this, exception.toString(), Toast.LENGTH_SHORT).show();
}
@Override
public void onVideoRecordingStart() {
super.onVideoRecordingStart();
}
});*/
DisplayMetrics dm = new DisplayMetrics(); DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm); getWindowManager().getDefaultDisplay().getMetrics(dm);
FrameLayout.LayoutParams layoutParamsMap = (FrameLayout.LayoutParams) ivMap.getLayoutParams();//相机的宽高 FrameLayout.LayoutParams layoutParamsMap = (FrameLayout.LayoutParams) ivMap.getLayoutParams();//相机的宽高
@ -362,14 +293,11 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
public void onClick(View v) { public void onClick(View v) {
switch (v.getId()) { switch (v.getId()) {
case R.id.btn_stop_picture: case R.id.btn_stop_picture:
/*
listenerPicture = false;
*/
Intent intent = new Intent(); Intent intent = new Intent();
finalVideoPath = Objects.requireNonNull(paperFile.getParentFile()).getAbsolutePath() + "/" + videoIndex + ".jpg"; finalVideoPath = Objects.requireNonNull(paperFile.getParentFile()).getAbsolutePath() + "/" + videoIndex + ".jpg";
intent.putExtra(Constant.INTENT_PICTURES_PATH, finalVideoPath); intent.putExtra(Constant.INTENT_PICTURES_PATH, finalVideoPath);
intent.putExtra("type", type); intent.putExtra("type", poi_video_type);
setResult(0x102, intent); setResult(0x111, intent);
finish(); finish();
break; break;
case R.id.btn_switch: case R.id.btn_switch:
@ -496,7 +424,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
protected void onRestart() { protected void onRestart() {
super.onRestart(); super.onRestart();
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
if (type != 3) { if (poi_video_type != 2) {
capturePicture.setChecked(false); capturePicture.setChecked(false);
capturePicture.setText("继续采集"); capturePicture.setText("继续采集");
} }
@ -538,6 +466,8 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
} }
} }
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMessageMainThread(Message msg) { public void onEventMessageMainThread(Message msg) {
if (msg.what == Constant.EVENT_WHAT_LOCATION_CHANGE) { // 用户位置更新 if (msg.what == Constant.EVENT_WHAT_LOCATION_CHANGE) { // 用户位置更新
@ -590,7 +520,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
timerTask = new TimerTask() { timerTask = new TimerTask() {
@Override @Override
public void run() { public void run() {
if (type == 3) { if (poi_video_type == 2) {
camera.takePicture(); camera.takePicture();
} else { } else {
Message message = new Message(); Message message = new Message();
@ -599,10 +529,12 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
} }
} }
}; };
if (type==3){ if (poi_video_type==2){
timer.schedule(timerTask, 0); timer.schedule(timerTask, 0);
}else { }else if (poi_video_type==1){
timer.schedule(timerTask, 0, 2000); timer.schedule(timerTask, 0, 2000);
}else if (poi_video_type==3){
timer.schedule(timerTask, 0, 1500);
} }
} }

View File

@ -36,6 +36,7 @@ public class Constant {
public static final String GET_ERR_MESSAGE3 = "自动加载libtencentloc.so失败"; public static final String GET_ERR_MESSAGE3 = "自动加载libtencentloc.so失败";
public static final String ROOT_FOLDER = SdkFolderCreate.getSDPath() + "/navinfoOutDoor"; public static final String ROOT_FOLDER = SdkFolderCreate.getSDPath() + "/navinfoOutDoor";
public static final String INTENT_POI_ROAD = "poi_road";
public static String BASE_FOLDER = ROOT_FOLDER; public static String BASE_FOLDER = ROOT_FOLDER;
// 保存图片的目录 // 保存图片的目录
public static String PICTURE_FOLDER; public static String PICTURE_FOLDER;
@ -153,7 +154,7 @@ public class Constant {
public static final int PHOTO_FINISH_VIDEO = 49;//拍照列表的返回 public static final int PHOTO_FINISH_VIDEO = 49;//拍照列表的返回
public static final String INTENT_POI_VIDEO_TYPE ="poi_video_type";
public static int NUMBER = 200; //任务个数 public static int NUMBER = 200; //任务个数
public static int LIMIT_TYPE = -1; //权限类型普通任务-0专属任务-1 public static int LIMIT_TYPE = -1; //权限类型普通任务-0专属任务-1
public static int TASK_TYPE = -1; // 任务类型 public static int TASK_TYPE = -1; // 任务类型

View File

@ -9,6 +9,12 @@ import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
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.model.HttpParams; import com.lzy.okgo.model.HttpParams;
import com.navinfo.outdoor.R; import com.navinfo.outdoor.R;
import com.navinfo.outdoor.api.Constant; import com.navinfo.outdoor.api.Constant;
@ -235,39 +241,21 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
if (geometry > 5000) { if (geometry > 5000) {
Toast.makeText(getActivity(), "作业不在领取范围内,无法领取", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "作业不在领取范围内,无法领取", Toast.LENGTH_SHORT).show();
return; return;
} }else {
} if (geometry>50){
if (poiEntity != null) { DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
int type = poiEntity.getType(); MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getActivity()), "提示", "当前位置偏离任务线", "确定").setOnOkButtonClickListener(new OnDialogButtonClickListener() {
if (type == 6) {
int taskStatus = poiEntity.getTaskStatus();
if (taskStatus != 1) {
initPolygonTask(HttpInterface.RECEIVED_POLYGON_TASK, poiEntity.getTaskId(), true);
} else {
new Thread(new Runnable() {
@Override @Override
public void run() { public boolean onClick(BaseDialog baseDialog, View v) {
PoiEntity taskIdPoiEntity = poiDao.getTaskIdPoiEntity(poiEntity.getTaskId()); initGather();
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() { return false;
@Override
public void run() {
initCompleteTask(HttpInterface.SUBMIT_POLYGON_TASK, poiEntity.getTaskId(), true, taskIdPoiEntity);
}
});
} }
}).start(); });
}else {
initGather();
} }
} else if (type == 1) {//poi的领取类型
receivedTaskByNet(HttpInterface.RECEIVED_POI_TASK, poiEntity.getTaskId(), true, poiEntity, 5);
} else if (type == 2) {//充电站的领取类型
chargingTaskByWork(HttpInterface.RECEIVED_CTASK, poiEntity.getTaskId(), true, 5);
} else if (type == 3) {//poi录像的领取类型
taskByNet(HttpInterface.RECEIVED_POI_VIDEO_TASK, poiEntity.getTaskId(), true, poiEntity, 5);
} else if (type == 4) {//道路的领取类型
taskByNet(HttpInterface.RECEIVED_ROAD_TASK, poiEntity.getTaskId(), true, poiEntity, 5);
} else if (type == 5) {//其他的领取类型
receivedTaskByNet(HttpInterface.RECEIVED_OTHER_TASK, poiEntity.getTaskId(), true, poiEntity, 5);
} }
} }
break; break;
@ -296,6 +284,44 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
} }
} }
private void initGather() {
if (poiEntity != null) {
int type = poiEntity.getType();
if (type == 6) {
int taskStatus = poiEntity.getTaskStatus();
if (taskStatus != 1) {
initPolygonTask(HttpInterface.RECEIVED_POLYGON_TASK, poiEntity.getTaskId(), true);
} else {
new Thread(new Runnable() {
@Override
public void run() {
PoiEntity taskIdPoiEntity = poiDao.getTaskIdPoiEntity(poiEntity.getTaskId());
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
@Override
public void run() {
initCompleteTask(HttpInterface.SUBMIT_POLYGON_TASK, poiEntity.getTaskId(), true, taskIdPoiEntity);
}
});
}
}).start();
}
} else if (type == 1) {//poi的领取类型
receivedTaskByNet(HttpInterface.RECEIVED_POI_TASK, poiEntity.getTaskId(), true, poiEntity, 5);
} else if (type == 2) {//充电站的领取类型
chargingTaskByWork(HttpInterface.RECEIVED_CTASK, poiEntity.getTaskId(), true, 5);
} else if (type == 3) {//poi录像的领取类型
taskByNet(HttpInterface.RECEIVED_POI_VIDEO_TASK, poiEntity.getTaskId(), true, poiEntity, 5);
} else if (type == 4) {//道路的领取类型
taskByNet(HttpInterface.RECEIVED_ROAD_TASK, poiEntity.getTaskId(), true, poiEntity, 5);
} else if (type == 5) {//其他的领取类型
receivedTaskByNet(HttpInterface.RECEIVED_OTHER_TASK, poiEntity.getTaskId(), true, poiEntity, 5);
}
}
}
/** /**
* @param url 筛选充电站领取任务 * @param url 筛选充电站领取任务
* @param * @param
@ -347,15 +373,11 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
chargingStationEntity.setY(latLng.latitude + ""); chargingStationEntity.setY(latLng.latitude + "");
break; break;
case "LineString": //线 case "LineString": //线
case "Polygon": //
List<LatLng> latLineString = GeometryTools.getLatLags(geo); List<LatLng> latLineString = GeometryTools.getLatLags(geo);
chargingStationEntity.setX(latLineString.get(0).longitude + ""); chargingStationEntity.setX(latLineString.get(0).longitude + "");
chargingStationEntity.setY(latLineString.get(0).latitude + ""); chargingStationEntity.setY(latLineString.get(0).latitude + "");
break; break;
case "Polygon": //
List<LatLng> latPolygon = GeometryTools.getLatLags(geo);
chargingStationEntity.setX(latPolygon.get(0).longitude + "");
chargingStationEntity.setY(latPolygon.get(0).latitude + "");
break;
} }
//充电桩 //充电桩
@ -482,7 +504,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
@Override @Override
public void run() { public void run() {
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), polygonEntity); InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), polygonEntity);
getActivity().runOnUiThread(new Runnable() { Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
initViewByTaskStatus(1); initViewByTaskStatus(1);

View File

@ -43,6 +43,7 @@ public class PhotoFragment extends BaseFragment implements View.OnClickListener
fragment.setArguments(bundle); fragment.setArguments(bundle);
return fragment; return fragment;
} }
@Override @Override
public void onStart() { public void onStart() {
super.onStart(); super.onStart();
@ -55,6 +56,7 @@ public class PhotoFragment extends BaseFragment implements View.OnClickListener
protected int getLayout() { protected int getLayout() {
return R.layout.fragment_photo; return R.layout.fragment_photo;
} }
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
@ -70,7 +72,7 @@ public class PhotoFragment extends BaseFragment implements View.OnClickListener
public boolean onKey(View v, int keyCode, KeyEvent event) { public boolean onKey(View v, int keyCode, KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) { if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
Message message = new Message(); Message message = new Message();
message.what= Constant.PHOTO_FINISH_VIDEO; message.what = Constant.PHOTO_FINISH_VIDEO;
EventBus.getDefault().post(message); EventBus.getDefault().post(message);
Objects.requireNonNull(getActivity()).finish(); Objects.requireNonNull(getActivity()).finish();
return true; return true;
@ -79,21 +81,19 @@ public class PhotoFragment extends BaseFragment implements View.OnClickListener
} }
}); });
} }
@Override @Override
protected void initView() { protected void initView() {
super.initView(); super.initView();
PoiEntity showPoiEntity = (PoiEntity) Objects.requireNonNull(getActivity()).getIntent().getSerializableExtra("showPoiEntity"); PoiEntity showPoiEntity = (PoiEntity) Objects.requireNonNull(getActivity()).getIntent().getSerializableExtra("showPoiEntity");
deleteFiles = new ArrayList<>(); deleteFiles = new ArrayList<>();
if (showPoiEntity != null) {
if (showPoiEntity!=null){
String id = showPoiEntity.getId(); String id = showPoiEntity.getId();
if (showPoiEntity.getRecord_way()==2){//連拍 fileBeans = new ArrayList<>();
fileBeans = new ArrayList<>(); List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(id);
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(id); for (int i = 0; i < fileListByUUID.size(); i++) {
for (int i = 0; i < fileListByUUID.size(); i++) { if (!fileListByUUID.get(i).getPath().contains(".txt")) {
if (!fileListByUUID.get(i).getPath().contains(".txt")){ fileBeans.add(new FileBean(fileListByUUID.get(i), false));
fileBeans.add(new FileBean(fileListByUUID.get(i),false));
}
} }
} }
} }
@ -101,19 +101,19 @@ public class PhotoFragment extends BaseFragment implements View.OnClickListener
ivPhotoFinal.setOnClickListener(this); ivPhotoFinal.setOnClickListener(this);
TextView tvPhotoAlbumDelete = (TextView) findViewById(R.id.tv_photo_album_delete); TextView tvPhotoAlbumDelete = (TextView) findViewById(R.id.tv_photo_album_delete);
tvPhotoAlbumDelete.setOnClickListener(this); tvPhotoAlbumDelete.setOnClickListener(this);
RecyclerView photoRecycler = findViewById(R.id.photo_album_recycler); RecyclerView photoRecycler = findViewById(R.id.photo_album_recycler);
photoRecycler.setLayoutManager(new GridLayoutManager(getContext(),2)); photoRecycler.setLayoutManager(new GridLayoutManager(getContext(), 2));
photoAdapter = new PhotoAdapter(fileBeans, getContext()); photoAdapter = new PhotoAdapter(fileBeans, getContext());
photoRecycler.setAdapter(photoAdapter); photoRecycler.setAdapter(photoAdapter);
photoAdapter.setPhotoClickItem(new PhotoAdapter.photoClickItem() { photoAdapter.setPhotoClickItem(new PhotoAdapter.photoClickItem() {
@Override @Override
public void item(boolean isChecked, FileBean fileBean) { public void item(boolean isChecked, FileBean fileBean) {
if (isChecked){ if (isChecked) {
deleteFiles.add(fileBean); deleteFiles.add(fileBean);
}else { } else {
if (deleteFiles!=null){ if (deleteFiles != null) {
for (int i = 0; i < deleteFiles.size(); i++) { for (int i = 0; i < deleteFiles.size(); i++) {
if (fileBean.getFile().getPath().equals(deleteFiles.get(i).getFile().getPath())){ if (fileBean.getFile().getPath().equals(deleteFiles.get(i).getFile().getPath())) {
deleteFiles.remove(fileBean); deleteFiles.remove(fileBean);
} }
} }
@ -136,19 +136,19 @@ public class PhotoFragment extends BaseFragment implements View.OnClickListener
@Override @Override
public void onClick(View v) { public void onClick(View v) {
switch (v.getId()){ switch (v.getId()) {
case R.id.iv_photo_final: case R.id.iv_photo_final:
Message message = new Message(); Message message = new Message();
message.what= Constant.PHOTO_FINISH_VIDEO; message.what = Constant.PHOTO_FINISH_VIDEO;
EventBus.getDefault().post(message); EventBus.getDefault().post(message);
Objects.requireNonNull(getActivity()).finish(); Objects.requireNonNull(getActivity()).finish();
break; break;
case R.id.tv_photo_album_delete: case R.id.tv_photo_album_delete:
if (fileBeans!=null){ if (fileBeans != null) {
for (int i = 0; i < fileBeans.size(); i++) { for (int i = 0; i < fileBeans.size(); i++) {
photoAdapter.deleteFile(fileBeans.get(i)); photoAdapter.deleteFile(fileBeans.get(i));
} }
}else { } else {
Toast.makeText(getContext(), "请选择要删除的数据后才可以删除", Toast.LENGTH_SHORT).show(); Toast.makeText(getContext(), "请选择要删除的数据后才可以删除", Toast.LENGTH_SHORT).show();
} }
break; break;

View File

@ -74,11 +74,8 @@ import java.util.Objects;
public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClickListener { public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClickListener {
private TextView tvPictures;
private EditText etRoadName; private EditText etRoadName;
private ImageView ivPoiVideoPicture; private ImageView ivPoiVideoPicture;
private RadioGroup rgType;
private RadioButton rbCar, rbBicycle, rbWalking, rbManual;
private EditText etDesc; private EditText etDesc;
private Button btnRoadSave; private Button btnRoadSave;
private PoiDao poiDao; private PoiDao poiDao;
@ -86,9 +83,8 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
private FrameLayout fmPoiVideoPic; private FrameLayout fmPoiVideoPic;
private LatLng latLng; private LatLng latLng;
private Marker markerPoiVideo; private Marker markerPoiVideo;
private TextView tvPicture; private TextView tvCombo;
private int isRequest; private TextView tvShort;
private TextView tvPhotoAlbum;
public static PoiVideoFragment newInstance(Bundle bundle) { public static PoiVideoFragment newInstance(Bundle bundle) {
PoiVideoFragment fragment = new PoiVideoFragment(); PoiVideoFragment fragment = new PoiVideoFragment();
@ -148,60 +144,22 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
super.initView(); super.initView();
PoiDatabase poiDatabase = PoiDatabase.getInstance(getContext()); PoiDatabase poiDatabase = PoiDatabase.getInstance(getContext());
poiDao = poiDatabase.getPoiDao(); poiDao = poiDatabase.getPoiDao();
tvPictures = findViewById(R.id.tv_pictures);//拍照
tvPictures.setOnClickListener(this);
tvPicture = findViewById(R.id.tv_picture);//录像
tvPicture.setOnClickListener(this);
setSlidingUpPanelLayout(Constant.SLIDING_LAYOUT); setSlidingUpPanelLayout(Constant.SLIDING_LAYOUT);
NestedScrollView nestedScrollView = findViewById(R.id.nested_scroll_view); NestedScrollView nestedScrollView = findViewById(R.id.nested_scroll_view);
if (slidingPaneLayout != null) { if (slidingPaneLayout != null) {
slidingPaneLayout.setScrollableView(nestedScrollView); slidingPaneLayout.setScrollableView(nestedScrollView);
} }
etRoadName = findViewById(R.id.et_poi_video_name); etRoadName = findViewById(R.id.et_poi_video_name);
ivPoiVideoPicture = findViewById(R.id.iv_poi_video_picture); ivPoiVideoPicture = findViewById(R.id.iv_poi_video_picture);
etDesc = findViewById(R.id.et_desc); etDesc = findViewById(R.id.et_desc);
//手动拍照
tvShort = findViewById(R.id.tv_short);
tvShort.setOnClickListener(this);
//自动连拍
tvCombo = findViewById(R.id.tv_combo);
tvCombo.setOnClickListener(this);
fmPoiVideoPic = findViewById(R.id.fm_poi_video_picture); fmPoiVideoPic = findViewById(R.id.fm_poi_video_picture);
btnRoadSave = findViewById(R.id.btn_poi_video_save); fmPoiVideoPic.setOnClickListener(this);
btnRoadSave.setOnClickListener(this);
Button btnPoiVideoUpload = findViewById(R.id.btn_poi_video_upload);
btnPoiVideoUpload.setOnClickListener(this);
rgType = findViewById(R.id.rg_type);
rbCar = findViewById(R.id.rb_car);
rbBicycle = findViewById(R.id.rb_bicycle);
rbWalking = findViewById(R.id.rb_walking);
rbManual = findViewById(R.id.rb_manual);
tvPhotoAlbum = findViewById(R.id.tv_photo_album);
tvPhotoAlbum.setOnClickListener(this);
/*fmRoadPic.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (v.getTag() == null || ((List<File>) v.getTag()).size() == 0) {
Toast.makeText(getActivity(), "还没有拍摄视频!", Toast.LENGTH_SHORT).show();
return;
}
File finalFile = AWMp4ParserHelper.getInstance().obtainMp4FilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
Intent intent = new Intent(getContext(), PictureActivity.class);
intent.putExtra(Constant.INTENT_VIDEO_PATH, finalFile.getAbsolutePath());
intent.putExtra(Constant.INTENT_VIDEO_OBLATION, 0);
intent.putExtra("poiEntity", showPoiEntity);
startActivityForResult(intent, 0x101);
}
});*/
rgType.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
switch (checkedId) {
case R.id.rb_car:
case R.id.rb_bicycle:
case R.id.rb_walking:
tvPicture.setVisibility(View.VISIBLE);
break;
case R.id.rb_manual:
tvPicture.setVisibility(View.GONE);
break;
}
}
});
fmPoiVideoPic.setOnLongClickListener(new View.OnLongClickListener() { fmPoiVideoPic.setOnLongClickListener(new View.OnLongClickListener() {
@Override @Override
public boolean onLongClick(View v) { public boolean onLongClick(View v) {
@ -214,12 +172,18 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
fileListByUUID.get(i).delete(); fileListByUUID.get(i).delete();
} }
ivPoiVideoPicture.setImageDrawable(null); ivPoiVideoPicture.setImageDrawable(null);
fmPoiVideoPic.setTag(null);
return false; return false;
} }
}); });
return false; return false;
} }
}); });
btnRoadSave = findViewById(R.id.btn_poi_video_save);
btnRoadSave.setOnClickListener(this);
Button btnPoiVideoUpload = findViewById(R.id.btn_poi_video_upload);
btnPoiVideoUpload.setOnClickListener(this);
//添加数据 //添加数据
initShowPoi(); initShowPoi();
} }
@ -244,54 +208,24 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
markerPoiVideo.setZIndex(4); markerPoiVideo.setZIndex(4);
moveLatlng(latLng, null); moveLatlng(latLng, null);
} }
int work_type = showPoiEntity.getWork_type();
showPictureType(work_type);
if (work_type == 3) {
tvPicture.setVisibility(View.GONE);
}
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 photoList = showPoiEntity.getPhoto(); String photoList = showPoiEntity.getPhoto();
int record_way = showPoiEntity.getRecord_way(); if (!StringUtils.isEmpty(photoList)) {
if (record_way == 1) {//录像 boolean isImageLoad = false;
isRequest = 0x101; List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
tvPictures.setEnabled(false); for (int i = 0; i < fileListByUUID.size(); i++) {
if (!StringUtils.isEmpty(photoList)) { if (fileListByUUID.get(i).getPath().contains(".jpg") && !fileListByUUID.get(i).getPath().contains("paper.txt")) {
boolean isImageLoad = false; if (fileListByUUID.get(i).exists() && !isImageLoad) {
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId()); // 使用glide加载视频的第一帧
for (int i = 0; i < fileListByUUID.size(); i++) { Glide.with(Objects.requireNonNull(getActivity())).load(fileListByUUID.get(i)).into(ivPoiVideoPicture);
if (fileListByUUID.get(i).getPath().contains(".mp4") && !fileListByUUID.get(i).getPath().contains(".mp4.txt")) { isImageLoad = true;
if (fileListByUUID.get(i).exists() && !isImageLoad) {
// 使用glide加载视频的第一帧
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(fileListByUUID.get(i)).toString(), ivPoiVideoPicture, 500);
isImageLoad = true;
}
}
fmPoiVideoPic.setTag(fileListByUUID);
}
}
} else if (record_way == 2) {//连拍
isRequest = 0x102;
if (work_type == 3) {
showWorkType(work_type);
}
tvPicture.setEnabled(false);
if (!StringUtils.isEmpty(photoList)) {
boolean isImageLoad = false;
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
for (int i = 0; i < fileListByUUID.size(); i++) {
if (fileListByUUID.get(i).getPath().contains(".jpg") && !fileListByUUID.get(i).getPath().contains("paper.txt")) {
if (fileListByUUID.get(i).exists() && !isImageLoad) {
// 使用glide加载视频的第一帧
Glide.with(Objects.requireNonNull(getActivity())).load(fileListByUUID.get(i)).into(ivPoiVideoPicture);
isImageLoad = true;
}
} }
} }
fmPoiVideoPic.setTag(fileListByUUID);
} }
fmPoiVideoPic.setTag(fileListByUUID);
} }
} }
//判断是否是已做完任务并保存成功 //判断是否是已做完任务并保存成功
@ -301,53 +235,14 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
} }
} }
private void showWorkType(int work_type) {
switch (work_type) {
case 0:
rgType.setEnabled(false);
rbCar.setEnabled(true);
rbWalking.setEnabled(false);
rbBicycle.setEnabled(false);
rbManual.setEnabled(false);
break;
case 1:
rgType.setEnabled(false);
rbCar.setEnabled(false);
rbBicycle.setEnabled(true);
rbWalking.setEnabled(false);
rbManual.setEnabled(false);
break;
case 2:
rgType.setEnabled(false);
rbCar.setEnabled(false);
rbBicycle.setEnabled(false);
rbWalking.setEnabled(true);
rbManual.setEnabled(false);
break;
case 3:
rgType.setEnabled(false);
rbCar.setEnabled(false);
rbWalking.setEnabled(false);
rbBicycle.setEnabled(false);
rbManual.setEnabled(true);
break;
}
}
private void disables() { private void disables() {
fmPoiVideoPic.setEnabled(false); fmPoiVideoPic.setEnabled(false);
tvPhotoAlbum.setEnabled(false);
etRoadName.setEnabled(false); etRoadName.setEnabled(false);
ivPoiVideoPicture.setEnabled(false); ivPoiVideoPicture.setEnabled(false);
tvPictures.setEnabled(false); tvShort.setEnabled(false);
tvPicture.setEnabled(false); tvCombo.setEnabled(false);
etDesc.setEnabled(false); etDesc.setEnabled(false);
btnRoadSave.setEnabled(false); btnRoadSave.setEnabled(false);
rgType.setEnabled(false);
rbCar.setEnabled(false);
rbWalking.setEnabled(false);
rbBicycle.setEnabled(false);
rbManual.setEnabled(false);
} }
@Subscribe @Subscribe
@ -356,32 +251,14 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
if ((boolean) data.obj) { if ((boolean) data.obj) {
initPoiVideoSharePre(); initPoiVideoSharePre();
} }
} else if (data.what == Constant.VIDEO_FINISH_ROAD) { } else if (data.what == Constant.PHOTO_FINISH_VIDEO) {
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId()); List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
if (fileListByUUID.size()==0) { if (fileListByUUID.size() == 1) {
ivPoiVideoPicture.setImageDrawable(null);
} else {
boolean isImageLoad = false;
for (int i = 0; i < fileListByUUID.size(); i++) {
File videoFile = fileListByUUID.get(i);
if (videoFile.getPath().contains(".mp4") && !videoFile.getPath().contains(".mp4.txt")) {
if (videoFile.exists() && !isImageLoad) {
// 使用glide加载视频的第一帧
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivPoiVideoPicture, 500);
isImageLoad = true;
}
}
}
fmPoiVideoPic.setTag(fileListByUUID);
}
}else if (data.what==Constant.PHOTO_FINISH_VIDEO){
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
if (fileListByUUID.size()==1) {
for (int i = 0; i < fileListByUUID.size(); i++) { for (int i = 0; i < fileListByUUID.size(); i++) {
fileListByUUID.get(i).delete(); fileListByUUID.get(i).delete();
} }
ivPoiVideoPicture.setImageDrawable(null); ivPoiVideoPicture.setImageDrawable(null);
fmPoiVideoPic.setTag(null);
} else { } else {
boolean isImageLoad = false; boolean isImageLoad = false;
for (int i = 0; i < fileListByUUID.size(); i++) { for (int i = 0; i < fileListByUUID.size(); i++) {
@ -402,25 +279,35 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
@Override @Override
public void onClick(View v) { public void onClick(View v) {
switch (v.getId()) { switch (v.getId()) {
case R.id.fm_poi_video_picture:
if (fmPoiVideoPic.getTag() == null) {
Toast.makeText(getContext(), "还没有拍摄", Toast.LENGTH_SHORT).show();
return;
}
Intent photoAlbumIntent = new Intent(getActivity(), FragmentManagement.class);
photoAlbumIntent.putExtra("tag", 36);
photoAlbumIntent.putExtra("showPoiEntity", showPoiEntity);
startActivity(photoAlbumIntent);
break;
case R.id.btn_poi_video_save: case R.id.btn_poi_video_save:
initPoiSaveLocal(false); initPoiSaveLocal(false);
break; break;
case R.id.tv_pictures://拍照 case R.id.tv_short://手动拍摄
isRequest = 0x102;
Intent intents = new Intent(getContext(), PicturesActivity.class); Intent intents = new Intent(getContext(), PicturesActivity.class);
File filePath = AWMp4ParserHelper.getInstance().obtainJPGFilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath()); File filePath = AWMp4ParserHelper.getInstance().obtainJPGFilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
intents.putExtra(Constant.INTENT_JPG_PATH, filePath.getAbsolutePath()); intents.putExtra(Constant.INTENT_JPG_PATH, filePath.getAbsolutePath());
int pictureType = getPictureType();
intents.putExtra("type", pictureType);
intents.putExtra("poiEntity", showPoiEntity); intents.putExtra("poiEntity", showPoiEntity);
intents.putExtra(Constant.INTENT_VIDEO_OBLATION, 0);
intents.putExtra(Constant.INTENT_POI_VIDEO_TYPE, 2);
startActivityForResult(intents, 0x102); startActivityForResult(intents, 0x102);
break; break;
case R.id.tv_picture://录像 case R.id.tv_combo://自动连拍:
isRequest = 0x101; Intent intent = new Intent(getContext(), PicturesActivity.class);
Intent intent = new Intent(getContext(), PictureActivity.class); File fileJpgPath = AWMp4ParserHelper.getInstance().obtainJPGFilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
File finalFile = AWMp4ParserHelper.getInstance().obtainMp4FilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath()); intent.putExtra(Constant.INTENT_JPG_PATH, fileJpgPath.getAbsolutePath());
intent.putExtra(Constant.INTENT_VIDEO_PATH, finalFile.getAbsolutePath());
intent.putExtra("poiEntity", showPoiEntity); intent.putExtra("poiEntity", showPoiEntity);
intent.putExtra(Constant.INTENT_VIDEO_OBLATION, 0);
intent.putExtra(Constant.INTENT_POI_VIDEO_TYPE, 1);
startActivityForResult(intent, 0x101); startActivityForResult(intent, 0x101);
break; break;
case R.id.btn_poi_video_upload: case R.id.btn_poi_video_upload:
@ -459,26 +346,6 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
return; return;
} }
break; break;
case R.id.tv_photo_album:
if (tvPicture.isEnabled() && tvPictures.isEnabled()) {//如果两个都有
Toast.makeText(getActivity(), "请拍照或者录像!", Toast.LENGTH_SHORT).show();
return;
}
if (tvPicture.isEnabled()) {
showPoiEntity.setRecord_way(1);
Intent photoAlbumIntent = new Intent(getActivity(), FragmentManagement.class);
photoAlbumIntent.putExtra("tag", 37);
photoAlbumIntent.putExtra("showPoiEntity", showPoiEntity);
startActivity(photoAlbumIntent);
}
if (tvPictures.isEnabled()) {
showPoiEntity.setRecord_way(2);
Intent photoAlbumIntent = new Intent(getActivity(), FragmentManagement.class);
photoAlbumIntent.putExtra("tag", 36);
photoAlbumIntent.putExtra("showPoiEntity", showPoiEntity);
startActivity(photoAlbumIntent);
}
break;
} }
} }
@ -512,6 +379,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
} }
} }
@Override @Override
public void onDenied(List<String> permissions, boolean never) { public void onDenied(List<String> permissions, boolean never) {
if (never) { if (never) {
@ -648,35 +516,19 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
@Override @Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 0x101 && resultCode == 0x101) { if (requestCode == 0x101 && resultCode == 0x111) {
tvPictures.setEnabled(false); tvShort.setEnabled(false);
isRequest = 0x101; } else if (requestCode == 0x102 && resultCode == 0x111) {
if (data != null && data.hasExtra(Constant.INTENT_VIDEO_PATH)) { tvCombo.setEnabled(false);
String videoPath = data.getStringExtra(Constant.INTENT_VIDEO_PATH); }
assert videoPath != null; if (data != null && data.hasExtra(Constant.INTENT_VIDEO_PATH)) {
File videoFile = new File(videoPath); String videoPath = data.getStringExtra(Constant.INTENT_VIDEO_PATH);
if (videoFile.exists()) { assert videoPath != null;
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivPoiVideoPicture, 500); File videoFile = new File(videoPath);
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId()); if (videoFile.exists()) {
fmPoiVideoPic.setTag(fileListByUUID); AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivPoiVideoPicture, 500);
} List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
} fmPoiVideoPic.setTag(fileListByUUID);
} else if (requestCode == 0x102 && resultCode == 0x102) {
tvPicture.setEnabled(false);
isRequest = 0x102;
if (data != null && data.hasExtra(Constant.INTENT_PICTURES_PATH)) {
int type = data.getIntExtra("type", 0);
if (type == 3) {
showWorkType(type);
}
String videoPath = data.getStringExtra(Constant.INTENT_PICTURES_PATH);
assert videoPath != null;
File pictureFile = new File(videoPath);
if (pictureFile.exists()) {
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(pictureFile).toString(), ivPoiVideoPicture, 500);
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
fmPoiVideoPic.setTag(fileListByUUID);
}
} }
} }
} }
@ -686,6 +538,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
initPoiVideoSharePre(); initPoiVideoSharePre();
} }
/** /**
* 防止程序崩溃后数据丢失 * 防止程序崩溃后数据丢失
*/ */
@ -707,37 +560,6 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
Log.d("TAG", "initRoadSharePre: " + newPoiEntity); Log.d("TAG", "initRoadSharePre: " + newPoiEntity);
} }
//获取拍照类型
private int getPictureType() {
if (rbCar != null && rbCar.isChecked()) {
return 0;
} else if (rbBicycle != null && rbBicycle.isChecked()) {
return 1;
} else if (rbWalking != null && rbWalking.isChecked()) {
return 2;
} else if (rbManual != null && rbManual.isChecked()) {
return 3;
}
return -1;
}
private void showPictureType(int type) {
switch (type) {
case 0:
rbCar.setChecked(true);
break;
case 1:
rbBicycle.setChecked(true);
break;
case 2:
rbWalking.setChecked(true);
break;
case 3:
rbManual.setChecked(true);
break;
}
}
@Override @Override
public void onDestroyView() { public void onDestroyView() {
super.onDestroyView(); super.onDestroyView();
@ -840,10 +662,6 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
} }
}); });
} }
int pictureType = getPictureType();
if (pictureType != -1) {
poiEntity.setWork_type(pictureType);
}
String desc = etDesc.getText().toString().trim(); String desc = etDesc.getText().toString().trim();
if (!desc.equals("")) { if (!desc.equals("")) {
poiEntity.setMemo(desc); poiEntity.setMemo(desc);
@ -855,41 +673,20 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
poiEntity.setCreateTime(format); poiEntity.setCreateTime(format);
poiEntity.setType(3); poiEntity.setType(3);
poiEntity.setTaskStatus(2); poiEntity.setTaskStatus(2);
if (isRequest == 0x101) { if (fmPoiVideoPic.getTag() == null) {
if (fmPoiVideoPic.getTag() == null) { List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId()); if (fileListByUUID != null) {
if (fileListByUUID != null) { fmPoiVideoPic.setTag(fileListByUUID);
fmPoiVideoPic.setTag(fileListByUUID);
}
} }
if (fmPoiVideoPic.getTag() != null && !((List<File>) fmPoiVideoPic.getTag()).isEmpty()) { }
List<LatLng> lineStringByFileList = AWMp4ParserHelper.getInstance().getLineStringByFileList((List<File>) fmPoiVideoPic.getTag()); if (fmPoiVideoPic.getTag() != null && !((List<File>) fmPoiVideoPic.getTag()).isEmpty()) {
String lineString = GeometryTools.getLineString(lineStringByFileList); List<LatLng> lineStringByFileList = AWMp4ParserHelper.getInstance().getLineStringByFileList((List<File>) fmPoiVideoPic.getTag());
Log.d("TAG", "onGranted: " + lineString); String lineString = GeometryTools.getLineString(lineStringByFileList);
String photoStr = AWMp4ParserHelper.getInstance().getVideoFileListStr((List<File>) fmPoiVideoPic.getTag()); Log.d("TAG", "onGranted: " + lineString);
poiEntity.setPhoto(photoStr); String photoStr = AWMp4ParserHelper.getInstance().getVideoFileListStr((List<File>) fmPoiVideoPic.getTag());
if (lineString != null) { poiEntity.setPhoto(photoStr);
poiEntity.setGeoWkt(lineString); if (lineString != null) {
} poiEntity.setGeoWkt(lineString);
poiEntity.setRecord_way(1);//录像
}
} else if (isRequest == 0x102) {
if (fmPoiVideoPic.getTag() == null) {
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
if (fileListByUUID != null) {
fmPoiVideoPic.setTag(fileListByUUID);
}
}
if (fmPoiVideoPic.getTag() != null && !((List<File>) fmPoiVideoPic.getTag()).isEmpty()) {
List<LatLng> lineStringByFileList = AWMp4ParserHelper.getInstance().getLineStringByFileList((List<File>) fmPoiVideoPic.getTag());
String lineString = GeometryTools.getLineString(lineStringByFileList);
Log.d("TAG", "onGranted: " + lineString);
String photoStr = AWMp4ParserHelper.getInstance().getVideoFileListStr((List<File>) fmPoiVideoPic.getTag());
poiEntity.setPhoto(photoStr);
if (lineString != null) {
poiEntity.setGeoWkt(lineString);
}
poiEntity.setRecord_way(2);//连拍
} }
} }
return poiEntity; return poiEntity;
@ -898,23 +695,9 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
@Override @Override
protected PoiCheckResult checkPoiEntity(PoiEntity entity) { protected PoiCheckResult checkPoiEntity(PoiEntity entity) {
PoiCheckResult poiCheckResult = new PoiCheckResult(); PoiCheckResult poiCheckResult = new PoiCheckResult();
if (tvPicture.isEnabled()) { if (entity.getPhoto() == null) {
if (tvPictures.isEnabled()) {
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请录像");
return poiCheckResult;
}
}
if (tvPictures.isEnabled()) {
if (tvPicture.isEnabled()) {
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请拍照");
return poiCheckResult;
}
}
if (entity.getWork_type() == -1) {
poiCheckResult.setCode(1); poiCheckResult.setCode(1);
poiCheckResult.setMsg("选择录像方式"); poiCheckResult.setMsg("请拍摄");
return poiCheckResult; return poiCheckResult;
} }
return poiCheckResult; return poiCheckResult;

View File

@ -36,6 +36,7 @@ import com.lzy.okgo.model.HttpParams;
import com.navinfo.outdoor.R; import com.navinfo.outdoor.R;
import com.navinfo.outdoor.activity.FragmentManagement; import com.navinfo.outdoor.activity.FragmentManagement;
import com.navinfo.outdoor.activity.PictureActivity; import com.navinfo.outdoor.activity.PictureActivity;
import com.navinfo.outdoor.activity.PicturesActivity;
import com.navinfo.outdoor.api.Constant; import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseDrawerFragment; import com.navinfo.outdoor.base.BaseDrawerFragment;
import com.navinfo.outdoor.bean.OtherUploadPicBean; import com.navinfo.outdoor.bean.OtherUploadPicBean;
@ -76,18 +77,13 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
private TextView tvPictures; private TextView tvPictures;
private EditText etRoadName; private EditText etRoadName;
private ImageView ivRoadPicture; private ImageView ivRoadPicture;
private RadioButton rbCar;
private RadioButton rbBicycle;
private RadioButton rbWalking;
private EditText etDesc; private EditText etDesc;
private Button btnRoadSave; private Button btnRoadSave;
private RadioGroup rgType;
private PoiDao poiDao; private PoiDao poiDao;
private File fileZip; private File fileZip;
private FrameLayout fmRoadPic; private FrameLayout fmRoadPic;
private Marker markerRoad; private Marker markerRoad;
private LatLng latLng; private LatLng latLng;
private TextView tvVideoAlbum;
public static RoadFragment newInstance(Bundle bundle) { public static RoadFragment newInstance(Bundle bundle) {
RoadFragment fragment = new RoadFragment(); RoadFragment fragment = new RoadFragment();
@ -146,45 +142,18 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
super.initView(); super.initView();
PoiDatabase poiDatabase = PoiDatabase.getInstance(getContext()); PoiDatabase poiDatabase = PoiDatabase.getInstance(getContext());
poiDao = poiDatabase.getPoiDao(); poiDao = poiDatabase.getPoiDao();
tvPictures = (TextView) findViewById(R.id.tv_pictures); tvPictures = findViewById(R.id.tv_pictures);
tvPictures.setOnClickListener(this); tvPictures.setOnClickListener(this);
tvVideoAlbum = findViewById(R.id.tv_video_album);
tvVideoAlbum.setOnClickListener(this);
setSlidingUpPanelLayout(Constant.SLIDING_LAYOUT); setSlidingUpPanelLayout(Constant.SLIDING_LAYOUT);
NestedScrollView nestedScrollView = findViewById(R.id.nested_scroll_view); NestedScrollView nestedScrollView = findViewById(R.id.nested_scroll_view);
if (slidingPaneLayout != null) { if (slidingPaneLayout != null) {
slidingPaneLayout.setScrollableView(nestedScrollView); slidingPaneLayout.setScrollableView(nestedScrollView);
} }
etRoadName = (EditText) findViewById(R.id.et_road_name); etRoadName = findViewById(R.id.et_road_name);
ivRoadPicture = (ImageView) findViewById(R.id.iv_road_picture); ivRoadPicture = findViewById(R.id.iv_road_picture);
// Glide.with(getContext()).load(getLocalVideoBitmap(String.valueOf(R.drawable.bg_01))).into(ivRoadPicture); etDesc = findViewById(R.id.et_desc);
rbCar = (RadioButton) findViewById(R.id.rb_car);
rbBicycle = (RadioButton) findViewById(R.id.rb_bicycle);
rbWalking = (RadioButton) findViewById(R.id.rb_walking);
etDesc = (EditText) findViewById(R.id.et_desc);
fmRoadPic = findViewById(R.id.fm_road_picture); fmRoadPic = findViewById(R.id.fm_road_picture);
btnRoadSave = (Button) findViewById(R.id.btn_road_save); fmRoadPic.setOnClickListener(this);
btnRoadSave.setOnClickListener(this);
rgType = (RadioGroup) findViewById(R.id.rg_type);
Button roadUpload = findViewById(R.id.road_upload);
roadUpload.setOnClickListener(this);
showPictureType(1);
/*fmRoadPic.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (v.getTag() == null || ((List<File>) v.getTag()).size() == 0) {
Toast.makeText(getActivity(), "还没有拍摄视频!", Toast.LENGTH_SHORT).show();
return;
}
File finalFile = AWMp4ParserHelper.getInstance().obtainMp4FilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
Intent intent = new Intent(getContext(), PictureActivity.class);
intent.putExtra(Constant.INTENT_VIDEO_PATH, finalFile.getAbsolutePath());
intent.putExtra(Constant.INTENT_VIDEO_OBLATION, 0);
intent.putExtra("poiEntity", showPoiEntity);
startActivityForResult(intent, 0x101);
}
});*/
fmRoadPic.setOnLongClickListener(new View.OnLongClickListener() { fmRoadPic.setOnLongClickListener(new View.OnLongClickListener() {
@Override @Override
public boolean onLongClick(View v) { public boolean onLongClick(View v) {
@ -197,12 +166,18 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
fileListByUUID.get(i).delete(); fileListByUUID.get(i).delete();
} }
ivRoadPicture.setImageDrawable(null); ivRoadPicture.setImageDrawable(null);
fmRoadPic.setTag(null);
return false; return false;
} }
}); });
return false; return false;
} }
}); });
btnRoadSave = findViewById(R.id.btn_road_save);
btnRoadSave.setOnClickListener(this);
Button roadUpload = findViewById(R.id.road_upload);
roadUpload.setOnClickListener(this);
//数据展示 //数据展示
initShowPoi(); initShowPoi();
//禁用可操作性控件 //禁用可操作性控件
@ -230,8 +205,6 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
markerRoad.setZIndex(4); markerRoad.setZIndex(4);
moveLatlng(latLng, null); moveLatlng(latLng, null);
} }
int work_type = showPoiEntity.getWork_type();
showPictureType(work_type);
String describe = showPoiEntity.getDescribe();//任务描述 String describe = showPoiEntity.getDescribe();//任务描述
if (describe != null && !describe.equals("")) { if (describe != null && !describe.equals("")) {
etDesc.setText(describe); etDesc.setText(describe);
@ -246,7 +219,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
if (!StringUtils.isEmpty(photo)) { if (!StringUtils.isEmpty(photo)) {
File videoFile = new File(photo); File videoFile = new File(photo);
videoFileList.add(new File(photo)); videoFileList.add(new File(photo));
if (videoFile.getPath().contains(".mp4") && !videoFile.getPath().contains(".mp4.txt")) { if (videoFile.getPath().contains(".jpg") && !videoFile.getPath().contains("paper.txt")) {
if (videoFile.exists() && !isImageLoad) { 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);
@ -268,16 +241,11 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
//禁用控件 //禁用控件
private void disables() { private void disables() {
fmRoadPic.setEnabled(false); fmRoadPic.setEnabled(false);
tvVideoAlbum.setEnabled(false);
etRoadName.setEnabled(false); etRoadName.setEnabled(false);
rgType.setEnabled(false);
ivRoadPicture.setEnabled(false); ivRoadPicture.setEnabled(false);
tvPictures.setEnabled(false); tvPictures.setEnabled(false);
etDesc.setEnabled(false); etDesc.setEnabled(false);
btnRoadSave.setEnabled(false); btnRoadSave.setEnabled(false);
rbCar.setEnabled(false);
rbBicycle.setEnabled(false);
rbWalking.setEnabled(false);
} }
@Subscribe @Subscribe
@ -288,13 +256,13 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
} }
} else if (data.what == Constant.VIDEO_FINISH_ROAD) { } else if (data.what == Constant.VIDEO_FINISH_ROAD) {
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId()); List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
if (fileListByUUID.size()==0) { if (fileListByUUID.size() == 0) {
ivRoadPicture.setImageDrawable(null); ivRoadPicture.setImageDrawable(null);
} else { } else {
boolean isImageLoad = false; boolean isImageLoad = false;
for (int i = 0; i < fileListByUUID.size(); i++) { for (int i = 0; i < fileListByUUID.size(); i++) {
File videoFile = fileListByUUID.get(i); File videoFile = fileListByUUID.get(i);
if (videoFile.getPath().contains(".mp4") && !videoFile.getPath().contains(".mp4.txt")) { if (videoFile.getPath().contains(".jpg") && !videoFile.getPath().contains("paper.txt")) {
if (videoFile.exists() && !isImageLoad) { 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);
@ -313,28 +281,22 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
case R.id.btn_road_save: case R.id.btn_road_save:
initPoiSaveLocal(false); initPoiSaveLocal(false);
break; break;
case R.id.tv_video_album: case R.id.fm_road_picture:
if (fmRoadPic.getTag() == null) { if (fmRoadPic.getTag() == null) {
Toast.makeText(getContext(), "请录像后才可以查看", Toast.LENGTH_SHORT).show(); Toast.makeText(getContext(), "还没有拍摄", Toast.LENGTH_SHORT).show();
return; return;
} }
if (tvPictures.isEnabled()) { Intent photoAlbumIntent = new Intent(getActivity(), FragmentManagement.class);
showPoiEntity.setRecord_way(1); photoAlbumIntent.putExtra("tag", 36);
Intent photoAlbumIntent = new Intent(getActivity(), FragmentManagement.class); photoAlbumIntent.putExtra("showPoiEntity", showPoiEntity);
photoAlbumIntent.putExtra("tag", 37); startActivity(photoAlbumIntent);
photoAlbumIntent.putExtra("showPoiEntity", showPoiEntity);
startActivity(photoAlbumIntent);
}
break; break;
case R.id.tv_pictures: case R.id.tv_pictures:
Intent intent = new Intent(getContext(), PicturesActivity.class);
// 根据用户点击的时间为视频名称赋值 File finalFile = AWMp4ParserHelper.getInstance().obtainJPGFilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
// DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss"); intent.putExtra(Constant.INTENT_JPG_PATH, finalFile.getAbsolutePath());
// String videoFormatName = formatter.format(new Date());
Intent intent = new Intent(getContext(), PictureActivity.class);
File finalFile = AWMp4ParserHelper.getInstance().obtainMp4FilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
intent.putExtra(Constant.INTENT_VIDEO_PATH, finalFile.getAbsolutePath());
intent.putExtra(Constant.INTENT_VIDEO_OBLATION, 0); intent.putExtra(Constant.INTENT_VIDEO_OBLATION, 0);
intent.putExtra(Constant.INTENT_POI_VIDEO_TYPE, 3);
intent.putExtra("poiEntity", showPoiEntity); intent.putExtra("poiEntity", showPoiEntity);
startActivityForResult(intent, 0x101); startActivityForResult(intent, 0x101);
break; break;
@ -550,37 +512,16 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 0x101) { if (requestCode == 0x101) {
if (resultCode == 0x101) { if (resultCode == 0x111) {
if (data != null && data.hasExtra(Constant.INTENT_VIDEO_PATH)) { if (data != null && data.hasExtra(Constant.INTENT_VIDEO_PATH)) {
// 扫描照片目录中当前视频的所有视频文件 // 扫描照片目录中当前视频的所有视频文件
String videoPath = data.getStringExtra(Constant.INTENT_VIDEO_PATH); String videoPath = data.getStringExtra(Constant.INTENT_VIDEO_PATH);
assert videoPath != null; assert videoPath != null;
File videoFile = new File(videoPath); File videoFile = new File(videoPath);
if (videoFile.exists()) { if (videoFile.exists()) {
Bitmap bitmap = AWMp4ParserHelper.getInstance().getLocalVideoBitmap(videoPath); AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivRoadPicture, 500);
int height = bitmap.getHeight(); List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
int width = bitmap.getWidth(); fmRoadPic.setTag(fileListByUUID);
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getContext()), "提示", "请重新录像,要求横屏录像", "确定").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
Intent intentPanorama = new Intent(getActivity(), PictureActivity.class);
File finalFile = AWMp4ParserHelper.getInstance().obtainMp4FilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
intentPanorama.putExtra(Constant.INTENT_VIDEO_PATH, finalFile.getAbsolutePath());
intentPanorama.putExtra(Constant.INTENT_VIDEO_OBLATION, 0);
startActivityForResult(intentPanorama, 0x101);
return false;
}
});
} else {
if (videoFile.exists()) {
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivRoadPicture, 500);
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
fmRoadPic.setTag(fileListByUUID);
}
}
} }
} }
} }
@ -615,32 +556,6 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
Log.d("TAG", "initRoadSharePre: " + newPoiEntity); Log.d("TAG", "initRoadSharePre: " + newPoiEntity);
} }
//获取拍照类型
private int getPictureType() {
if (rbCar != null && rbCar.isChecked()) {
return 0;
} else if (rbBicycle != null && rbBicycle.isChecked()) {
return 1;
} else if (rbWalking != null && rbWalking.isChecked()) {
return 2;
}
return -1;
}
private void showPictureType(int type) {
switch (type) {
case 0:
rbCar.setChecked(true);
break;
case 1:
rbBicycle.setChecked(true);
break;
case 2:
rbWalking.setChecked(true);
break;
}
}
@Override @Override
public void onDestroyView() { public void onDestroyView() {
@ -740,10 +655,6 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
} }
}); });
} }
int pictureType = getPictureType();
if (pictureType != -1) {
poiEntity.setWork_type(pictureType);
}
String desc = etDesc.getText().toString().trim(); String desc = etDesc.getText().toString().trim();
if (!desc.equals("")) { if (!desc.equals("")) {
poiEntity.setMemo(desc); poiEntity.setMemo(desc);
@ -767,7 +678,6 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
Log.d("TAG", "onGranted: " + lineString); Log.d("TAG", "onGranted: " + lineString);
String photoStr = AWMp4ParserHelper.getInstance().getVideoFileListStr((List<File>) fmRoadPic.getTag()); String photoStr = AWMp4ParserHelper.getInstance().getVideoFileListStr((List<File>) fmRoadPic.getTag());
poiEntity.setPhoto(photoStr); poiEntity.setPhoto(photoStr);
poiEntity.setRecord_way(1);
if (lineString != null) { if (lineString != null) {
poiEntity.setGeoWkt(lineString); poiEntity.setGeoWkt(lineString);
} }
@ -780,15 +690,9 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
PoiCheckResult poiCheckResult = new PoiCheckResult(); PoiCheckResult poiCheckResult = new PoiCheckResult();
if (entity.getPhoto() == null) { if (entity.getPhoto() == null) {
poiCheckResult.setCode(1); poiCheckResult.setCode(1);
poiCheckResult.setMsg("录像"); poiCheckResult.setMsg("拍摄");
return poiCheckResult; return poiCheckResult;
} }
if (entity.getWork_type() == -1) {
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请选择录像方式");
return poiCheckResult;
}
return poiCheckResult; return poiCheckResult;
} }

View File

@ -20,7 +20,7 @@ import java.util.Objects;
/** /**
* 设置页面的fragment * 设置页面的fragment
*/ */
public class SetFragment extends BaseFragment implements View.OnClickListener { public class SetFragment extends BaseFragment implements View.OnClickListener {
private SharedPreferences.Editor navInfoEditor; private SharedPreferences.Editor navInfoEditor;

View File

@ -47,6 +47,7 @@ public class VideoFragment extends BaseFragment implements View.OnClickListener
protected int getLayout() { protected int getLayout() {
return R.layout.fragment_video; return R.layout.fragment_video;
} }
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
@ -62,7 +63,7 @@ public class VideoFragment extends BaseFragment implements View.OnClickListener
public boolean onKey(View v, int keyCode, KeyEvent event) { public boolean onKey(View v, int keyCode, KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) { if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
Message message = new Message(); Message message = new Message();
message.what= Constant.VIDEO_FINISH_ROAD; message.what = Constant.VIDEO_FINISH_ROAD;
EventBus.getDefault().post(message); EventBus.getDefault().post(message);
Objects.requireNonNull(getActivity()).finish(); Objects.requireNonNull(getActivity()).finish();
return true; return true;
@ -71,6 +72,7 @@ public class VideoFragment extends BaseFragment implements View.OnClickListener
} }
}); });
} }
@Override @Override
protected void initView() { protected void initView() {
super.initView(); super.initView();
@ -79,17 +81,16 @@ public class VideoFragment extends BaseFragment implements View.OnClickListener
ArrayList<File> textFile = new ArrayList<>(); ArrayList<File> textFile = new ArrayList<>();
if (showPoiEntity != null) { if (showPoiEntity != null) {
String id = showPoiEntity.getId(); String id = showPoiEntity.getId();
if (showPoiEntity.getRecord_way() == 1) { fileBeans = new ArrayList<>();
fileBeans = new ArrayList<>(); List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(id);
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(id); for (int i = 0; i < fileListByUUID.size(); i++) {
for (int i = 0; i < fileListByUUID.size(); i++) { if (!fileListByUUID.get(i).getPath().contains(".txt")) {
if (!fileListByUUID.get(i).getPath().contains(".txt")) { FileBean fileBean = new FileBean(fileListByUUID.get(i), false);
FileBean fileBean = new FileBean(fileListByUUID.get(i), false); fileBeans.add(fileBean);
fileBeans.add(fileBean); } else {
}else { textFile.add(fileListByUUID.get(i));
textFile.add(fileListByUUID.get(i));
}
} }
} }
} }
ImageView ivPhotoFinal = (ImageView) findViewById(R.id.iv_video_final); ImageView ivPhotoFinal = (ImageView) findViewById(R.id.iv_video_final);
@ -129,7 +130,7 @@ public class VideoFragment extends BaseFragment implements View.OnClickListener
switch (v.getId()) { switch (v.getId()) {
case R.id.iv_video_final: case R.id.iv_video_final:
Message message = new Message(); Message message = new Message();
message.what= Constant.VIDEO_FINISH_ROAD; message.what = Constant.VIDEO_FINISH_ROAD;
EventBus.getDefault().post(message); EventBus.getDefault().post(message);
Objects.requireNonNull(getActivity()).finish(); Objects.requireNonNull(getActivity()).finish();
break; break;

View File

@ -259,17 +259,15 @@ public class PoiSaveUtils {
} }
List<File> videoFileList = AWMp4ParserHelper.getInstance().getFileListByUUID(poiEntity.getId()); List<File> videoFileList = AWMp4ParserHelper.getInstance().getFileListByUUID(poiEntity.getId());
if (videoFileList != null && !videoFileList.isEmpty()) { if (videoFileList != null && !videoFileList.isEmpty()) {
List<File> txtFileList = new ArrayList<>(); /*List<File> txtFileList = new ArrayList<>();
for (File videoFile : videoFileList) { for (File videoFile : videoFileList) {
File file = new File(videoFile.getAbsolutePath() + ".txt"); File file = new File(videoFile.getAbsolutePath() + ".txt");
txtFileList.add(file); txtFileList.add(file);
} }*/
videoFileList.addAll(txtFileList); //videoFileList.addAll(videoFileList);
File fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip"); File fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
ZipUtil.zipFiles(videoFileList, fileZip, null); ZipUtil.zipFiles(videoFileList, fileZip, null);
if (fileZip != null) { photoFile.add(fileZip);
photoFile.add(fileZip);
}
} }
String url = null; String url = null;
//1 "POI"2 "充电站"3 "POI录像"4 "道路录像"5 "其他"6 "面状任务" //1 "POI"2 "充电站"3 "POI录像"4 "道路录像"5 "其他"6 "面状任务"

View File

@ -52,7 +52,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginLeft="15dp" android:layout_marginStart="15dp"
android:text="名称 " android:text="名称 "
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="15sp" /> android:textSize="15sp" />
@ -68,82 +68,20 @@
android:textSize="14sp" /> android:textSize="14sp" />
</LinearLayout> </LinearLayout>
<TextView
android:id="@+id/tv_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="02.拍照方式"
android:textColor="@color/black"
android:textSize="16sp"
app:layout_constraintLeft_toLeftOf="@id/ll_name"
app:layout_constraintTop_toBottomOf="@+id/ll_name" />
<LinearLayout
android:id="@+id/ll_mode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:layout_marginTop="15dp"
android:orientation="horizontal"
app:layout_constraintTop_toBottomOf="@id/tv_mode">
<RadioGroup
android:id="@+id/rg_type"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="horizontal">
<RadioButton
android:id="@+id/rb_car"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="车行"
android:textColor="@color/test_color_selector" />
<RadioButton
android:id="@+id/rb_bicycle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="自行车"
android:textColor="@color/test_color_selector" />
<RadioButton
android:id="@+id/rb_walking"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="步行"
android:textColor="@color/test_color_selector" />
<!-- <RadioButton-->
<!-- android:id="@+id/rb_manual"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_weight="1"-->
<!-- android:text="手动"-->
<!-- android:textColor="@color/test_color_selector" />-->
</RadioGroup>
</LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/ll_pictures" android:id="@+id/ll_pictures"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="10dp" android:layout_marginStart="10dp"
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
android:orientation="horizontal" android:orientation="horizontal"
app:layout_constraintLeft_toLeftOf="@id/ll_mode" app:layout_constraintLeft_toLeftOf="@id/ll_name"
app:layout_constraintTop_toBottomOf="@id/ll_mode"> app:layout_constraintTop_toBottomOf="@id/ll_name">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="03.录像 " android:text="02.拍摄 "
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="16sp" /> android:textSize="16sp" />
@ -154,20 +92,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="5dp" android:layout_marginStart="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" />
<TextView
android:id="@+id/tv_video_album"
style="@style/user_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:gravity="center"
android:text="点击查看成果"
android:textColor="@color/white"
android:textSize="15sp" />
</LinearLayout> </LinearLayout>
<FrameLayout <FrameLayout
@ -181,7 +108,7 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="长按录像可删除" android:text="点击拍摄成果可查看,长按可删除"
android:textSize="16sp" android:textSize="16sp"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
/> />
@ -211,7 +138,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
android:text="04.描述" android:text="03.描述"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="16sp" /> android:textSize="16sp" />

View File

@ -74,67 +74,6 @@
android:textSize="14sp" /> android:textSize="14sp" />
</LinearLayout> </LinearLayout>
<TextView
android:id="@+id/tv_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="02.拍照方式"
android:textColor="@color/black"
android:textSize="16sp"
app:layout_constraintLeft_toLeftOf="@id/ll_name"
app:layout_constraintTop_toBottomOf="@+id/ll_name" />
<LinearLayout
android:id="@+id/ll_mode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:layout_marginTop="15dp"
android:orientation="horizontal"
app:layout_constraintTop_toBottomOf="@id/tv_mode">
<RadioGroup
android:id="@+id/rg_type"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="horizontal">
<RadioButton
android:id="@+id/rb_car"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="车行"
android:textColor="@color/test_color_selector" />
<RadioButton
android:id="@+id/rb_bicycle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="骑行"
android:textColor="@color/test_color_selector" />
<RadioButton
android:id="@+id/rb_walking"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="步行"
android:textColor="@color/test_color_selector" />
<RadioButton
android:id="@+id/rb_manual"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="手动"
android:textColor="@color/test_color_selector" />
</RadioGroup>
</LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/ll_pictures" android:id="@+id/ll_pictures"
@ -143,43 +82,32 @@
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
android:orientation="horizontal" android:orientation="horizontal"
app:layout_constraintLeft_toLeftOf="@id/ll_mode" app:layout_constraintLeft_toLeftOf="@id/ll_name"
app:layout_constraintTop_toBottomOf="@id/ll_mode"> app:layout_constraintTop_toBottomOf="@id/ll_name">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="03.录像" android:text="02.拍摄"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="16sp" /> android:textSize="16sp" />
<TextView <TextView
android:id="@+id/tv_picture" android:id="@+id/tv_short"
style="@style/user_style" style="@style/user_style"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="5dp" android:layout_marginStart="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" />
<TextView <TextView
android:id="@+id/tv_pictures" android:id="@+id/tv_combo"
style="@style/user_style" style="@style/user_style"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="5dp" android:layout_marginStart="5dp"
android:gravity="center" android:gravity="center"
android:text="点击拍照" android:text="自动连拍"
android:textColor="@color/white"
android:textSize="15sp" />
<TextView
android:id="@+id/tv_photo_album"
style="@style/user_style"
android:visibility="visible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:gravity="center"
android:text="点击查看成果"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="15sp" /> android:textSize="15sp" />
</LinearLayout> </LinearLayout>
@ -194,7 +122,7 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="长按图片或者录像可删除" android:text="点击拍摄成果可查看,长按可删除"
android:textSize="16sp" android:textSize="16sp"
android:layout_marginStart="10dp"/> android:layout_marginStart="10dp"/>
<ImageView <ImageView
@ -266,7 +194,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
android:text="04.描述" android:text="03.描述"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="16sp" /> android:textSize="16sp" />