修改poi录像,道路 的拍摄,修改任务立即采集的逻辑
This commit is contained in:
parent
5ace14ca36
commit
e09db95131
@ -114,6 +114,10 @@ public class PhotographActivity extends BaseActivity implements View.OnClickList
|
||||
@Override
|
||||
public void onPictureTaken(@NonNull PictureResult 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);
|
||||
result.toFile(file, new FileCallback() {
|
||||
@Override
|
||||
|
@ -12,6 +12,7 @@ import android.graphics.Matrix;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.PersistableBundle;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
@ -87,12 +88,9 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
private ViewGroup layerChange; // 切换地图和相机的父控件
|
||||
private CheckBox capturePicture, cbMapType;//拍照
|
||||
private boolean isMapSlide = false;
|
||||
/*
|
||||
private boolean listenerPicture = false;
|
||||
*/
|
||||
private SimpleDateFormat formatter;
|
||||
private File paperFile;
|
||||
private int type;
|
||||
private int poi_video_type;
|
||||
private ImageView ivZoomAdd, ivZoomDel, ivLocation;
|
||||
private Handler handler = new Handler(new Handler.Callback() {
|
||||
@Override
|
||||
@ -104,7 +102,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
btnSwitch.setEnabled(true);
|
||||
}
|
||||
} else if (msg.what == 0x103) {
|
||||
if (type != 3) {
|
||||
if (poi_video_type != 2) {
|
||||
capturePicture.setText("开始采集");
|
||||
}
|
||||
capturePicture.setChecked(false);
|
||||
@ -117,6 +115,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
private Timer timer;
|
||||
private TimerTask timerTask;
|
||||
private int videoIndex = -1;
|
||||
private int oration;
|
||||
|
||||
@Override
|
||||
protected int getLayout() {
|
||||
@ -132,7 +131,8 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
layerChange = findViewById(R.id.layer_change);
|
||||
if (getIntent() != null) {
|
||||
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);
|
||||
assert finalVideoPath != null;
|
||||
File file = new File(finalVideoPath);
|
||||
@ -149,50 +149,26 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
ivZoomAdd.setOnClickListener(this);
|
||||
ivZoomDel = findViewById(R.id.iv_zoom_del);
|
||||
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.setOnClickListener(this);
|
||||
camera = findViewById(R.id.camera);
|
||||
camera.setOnClickListener(this);
|
||||
capturePicture = findViewById(R.id.capture_picture);
|
||||
if (type == 3) {
|
||||
if (poi_video_type == 2) {
|
||||
capturePicture.setText("拍摄");
|
||||
} else {
|
||||
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() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
if (type != 3) {
|
||||
if (poi_video_type != 2) {
|
||||
capturePicture.setText("暂停采集");
|
||||
}
|
||||
startTimer();
|
||||
} else {
|
||||
if (type != 3) {
|
||||
if (poi_video_type != 2) {
|
||||
capturePicture.setText("开始采集");
|
||||
}
|
||||
stopTimer();
|
||||
@ -231,6 +207,17 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
@Override
|
||||
public void onPictureTaken(@NonNull PictureResult 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);
|
||||
initMarkerPaper();
|
||||
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";
|
||||
Toast.makeText(PicturesActivity.this, "保存成功:" + (videoIndex + 1), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
if (type==3){
|
||||
if (poi_video_type==2){
|
||||
Message message = new Message();
|
||||
message.what = 0x103;
|
||||
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();
|
||||
getWindowManager().getDefaultDisplay().getMetrics(dm);
|
||||
FrameLayout.LayoutParams layoutParamsMap = (FrameLayout.LayoutParams) ivMap.getLayoutParams();//相机的宽高
|
||||
@ -362,14 +293,11 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.btn_stop_picture:
|
||||
/*
|
||||
listenerPicture = false;
|
||||
*/
|
||||
Intent intent = new Intent();
|
||||
finalVideoPath = Objects.requireNonNull(paperFile.getParentFile()).getAbsolutePath() + "/" + videoIndex + ".jpg";
|
||||
intent.putExtra(Constant.INTENT_PICTURES_PATH, finalVideoPath);
|
||||
intent.putExtra("type", type);
|
||||
setResult(0x102, intent);
|
||||
intent.putExtra("type", poi_video_type);
|
||||
setResult(0x111, intent);
|
||||
finish();
|
||||
break;
|
||||
case R.id.btn_switch:
|
||||
@ -496,7 +424,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
protected void onRestart() {
|
||||
super.onRestart();
|
||||
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||
if (type != 3) {
|
||||
if (poi_video_type != 2) {
|
||||
capturePicture.setChecked(false);
|
||||
capturePicture.setText("继续采集");
|
||||
}
|
||||
@ -538,6 +466,8 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEventMessageMainThread(Message msg) {
|
||||
if (msg.what == Constant.EVENT_WHAT_LOCATION_CHANGE) { // 用户位置更新
|
||||
@ -590,7 +520,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
timerTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (type == 3) {
|
||||
if (poi_video_type == 2) {
|
||||
camera.takePicture();
|
||||
} else {
|
||||
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);
|
||||
}else {
|
||||
}else if (poi_video_type==1){
|
||||
timer.schedule(timerTask, 0, 2000);
|
||||
}else if (poi_video_type==3){
|
||||
timer.schedule(timerTask, 0, 1500);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@ public class Constant {
|
||||
public static final String GET_ERR_MESSAGE3 = "自动加载libtencentloc.so失败";
|
||||
|
||||
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 PICTURE_FOLDER;
|
||||
@ -153,7 +154,7 @@ public class Constant {
|
||||
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 LIMIT_TYPE = -1; //权限类型,普通任务-0,专属任务-1
|
||||
public static int TASK_TYPE = -1; // 任务类型
|
||||
|
@ -9,6 +9,12 @@ import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
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.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
@ -235,39 +241,21 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
if (geometry > 5000) {
|
||||
Toast.makeText(getActivity(), "作业不在领取范围内,无法领取", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
}
|
||||
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() {
|
||||
}else {
|
||||
if (geometry>50){
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||
MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getActivity()), "提示", "当前位置偏离任务线", "确定").setOnOkButtonClickListener(new OnDialogButtonClickListener() {
|
||||
@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);
|
||||
}
|
||||
});
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
initGather();
|
||||
return false;
|
||||
}
|
||||
}).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;
|
||||
@ -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
|
||||
@ -347,15 +373,11 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
chargingStationEntity.setY(latLng.latitude + "");
|
||||
break;
|
||||
case "LineString": //线
|
||||
case "Polygon": //面
|
||||
List<LatLng> latLineString = GeometryTools.getLatLags(geo);
|
||||
chargingStationEntity.setX(latLineString.get(0).longitude + "");
|
||||
chargingStationEntity.setY(latLineString.get(0).latitude + "");
|
||||
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
|
||||
public void run() {
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), polygonEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
initViewByTaskStatus(1);
|
||||
|
@ -43,6 +43,7 @@ public class PhotoFragment extends BaseFragment implements View.OnClickListener
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
@ -55,6 +56,7 @@ public class PhotoFragment extends BaseFragment implements View.OnClickListener
|
||||
protected int getLayout() {
|
||||
return R.layout.fragment_photo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
@ -70,7 +72,7 @@ public class PhotoFragment extends BaseFragment implements View.OnClickListener
|
||||
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||
if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
Message message = new Message();
|
||||
message.what= Constant.PHOTO_FINISH_VIDEO;
|
||||
message.what = Constant.PHOTO_FINISH_VIDEO;
|
||||
EventBus.getDefault().post(message);
|
||||
Objects.requireNonNull(getActivity()).finish();
|
||||
return true;
|
||||
@ -79,21 +81,19 @@ public class PhotoFragment extends BaseFragment implements View.OnClickListener
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
super.initView();
|
||||
PoiEntity showPoiEntity = (PoiEntity) Objects.requireNonNull(getActivity()).getIntent().getSerializableExtra("showPoiEntity");
|
||||
deleteFiles = new ArrayList<>();
|
||||
|
||||
if (showPoiEntity!=null){
|
||||
if (showPoiEntity != null) {
|
||||
String id = showPoiEntity.getId();
|
||||
if (showPoiEntity.getRecord_way()==2){//連拍
|
||||
fileBeans = new ArrayList<>();
|
||||
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(id);
|
||||
for (int i = 0; i < fileListByUUID.size(); i++) {
|
||||
if (!fileListByUUID.get(i).getPath().contains(".txt")){
|
||||
fileBeans.add(new FileBean(fileListByUUID.get(i),false));
|
||||
}
|
||||
fileBeans = new ArrayList<>();
|
||||
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(id);
|
||||
for (int i = 0; i < fileListByUUID.size(); i++) {
|
||||
if (!fileListByUUID.get(i).getPath().contains(".txt")) {
|
||||
fileBeans.add(new FileBean(fileListByUUID.get(i), false));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -101,19 +101,19 @@ public class PhotoFragment extends BaseFragment implements View.OnClickListener
|
||||
ivPhotoFinal.setOnClickListener(this);
|
||||
TextView tvPhotoAlbumDelete = (TextView) findViewById(R.id.tv_photo_album_delete);
|
||||
tvPhotoAlbumDelete.setOnClickListener(this);
|
||||
RecyclerView photoRecycler = findViewById(R.id.photo_album_recycler);
|
||||
photoRecycler.setLayoutManager(new GridLayoutManager(getContext(),2));
|
||||
RecyclerView photoRecycler = findViewById(R.id.photo_album_recycler);
|
||||
photoRecycler.setLayoutManager(new GridLayoutManager(getContext(), 2));
|
||||
photoAdapter = new PhotoAdapter(fileBeans, getContext());
|
||||
photoRecycler.setAdapter(photoAdapter);
|
||||
photoAdapter.setPhotoClickItem(new PhotoAdapter.photoClickItem() {
|
||||
@Override
|
||||
public void item(boolean isChecked, FileBean fileBean) {
|
||||
if (isChecked){
|
||||
if (isChecked) {
|
||||
deleteFiles.add(fileBean);
|
||||
}else {
|
||||
if (deleteFiles!=null){
|
||||
} else {
|
||||
if (deleteFiles != null) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -136,19 +136,19 @@ public class PhotoFragment extends BaseFragment implements View.OnClickListener
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()){
|
||||
switch (v.getId()) {
|
||||
case R.id.iv_photo_final:
|
||||
Message message = new Message();
|
||||
message.what= Constant.PHOTO_FINISH_VIDEO;
|
||||
message.what = Constant.PHOTO_FINISH_VIDEO;
|
||||
EventBus.getDefault().post(message);
|
||||
Objects.requireNonNull(getActivity()).finish();
|
||||
break;
|
||||
case R.id.tv_photo_album_delete:
|
||||
if (fileBeans!=null){
|
||||
if (fileBeans != null) {
|
||||
for (int i = 0; i < fileBeans.size(); i++) {
|
||||
photoAdapter.deleteFile(fileBeans.get(i));
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
Toast.makeText(getContext(), "请选择要删除的数据后才可以删除", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
break;
|
||||
|
@ -74,11 +74,8 @@ import java.util.Objects;
|
||||
|
||||
public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClickListener {
|
||||
|
||||
private TextView tvPictures;
|
||||
private EditText etRoadName;
|
||||
private ImageView ivPoiVideoPicture;
|
||||
private RadioGroup rgType;
|
||||
private RadioButton rbCar, rbBicycle, rbWalking, rbManual;
|
||||
private EditText etDesc;
|
||||
private Button btnRoadSave;
|
||||
private PoiDao poiDao;
|
||||
@ -86,9 +83,8 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
private FrameLayout fmPoiVideoPic;
|
||||
private LatLng latLng;
|
||||
private Marker markerPoiVideo;
|
||||
private TextView tvPicture;
|
||||
private int isRequest;
|
||||
private TextView tvPhotoAlbum;
|
||||
private TextView tvCombo;
|
||||
private TextView tvShort;
|
||||
|
||||
public static PoiVideoFragment newInstance(Bundle bundle) {
|
||||
PoiVideoFragment fragment = new PoiVideoFragment();
|
||||
@ -148,60 +144,22 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
super.initView();
|
||||
PoiDatabase poiDatabase = PoiDatabase.getInstance(getContext());
|
||||
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);
|
||||
NestedScrollView nestedScrollView = findViewById(R.id.nested_scroll_view);
|
||||
if (slidingPaneLayout != null) {
|
||||
slidingPaneLayout.setScrollableView(nestedScrollView);
|
||||
}
|
||||
etRoadName = findViewById(R.id.et_poi_video_name);
|
||||
ivPoiVideoPicture = findViewById(R.id.iv_poi_video_picture);
|
||||
etRoadName = findViewById(R.id.et_poi_video_name);
|
||||
ivPoiVideoPicture = findViewById(R.id.iv_poi_video_picture);
|
||||
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);
|
||||
btnRoadSave = findViewById(R.id.btn_poi_video_save);
|
||||
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.setOnClickListener(this);
|
||||
fmPoiVideoPic.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
@ -214,12 +172,18 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
fileListByUUID.get(i).delete();
|
||||
}
|
||||
ivPoiVideoPicture.setImageDrawable(null);
|
||||
fmPoiVideoPic.setTag(null);
|
||||
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();
|
||||
}
|
||||
@ -244,54 +208,24 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
markerPoiVideo.setZIndex(4);
|
||||
moveLatlng(latLng, null);
|
||||
}
|
||||
int work_type = showPoiEntity.getWork_type();
|
||||
showPictureType(work_type);
|
||||
if (work_type == 3) {
|
||||
tvPicture.setVisibility(View.GONE);
|
||||
}
|
||||
String describe = showPoiEntity.getMemo();//任务描述
|
||||
if (describe != null && !describe.equals("")) {
|
||||
etDesc.setText(describe);
|
||||
}
|
||||
String photoList = showPoiEntity.getPhoto();
|
||||
int record_way = showPoiEntity.getRecord_way();
|
||||
if (record_way == 1) {//录像
|
||||
isRequest = 0x101;
|
||||
tvPictures.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(".mp4") && !fileListByUUID.get(i).getPath().contains(".mp4.txt")) {
|
||||
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;
|
||||
}
|
||||
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() {
|
||||
fmPoiVideoPic.setEnabled(false);
|
||||
tvPhotoAlbum.setEnabled(false);
|
||||
etRoadName.setEnabled(false);
|
||||
ivPoiVideoPicture.setEnabled(false);
|
||||
tvPictures.setEnabled(false);
|
||||
tvPicture.setEnabled(false);
|
||||
tvShort.setEnabled(false);
|
||||
tvCombo.setEnabled(false);
|
||||
etDesc.setEnabled(false);
|
||||
btnRoadSave.setEnabled(false);
|
||||
rgType.setEnabled(false);
|
||||
rbCar.setEnabled(false);
|
||||
rbWalking.setEnabled(false);
|
||||
rbBicycle.setEnabled(false);
|
||||
rbManual.setEnabled(false);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@ -356,32 +251,14 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
if ((boolean) data.obj) {
|
||||
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());
|
||||
if (fileListByUUID.size()==0) {
|
||||
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) {
|
||||
if (fileListByUUID.size() == 1) {
|
||||
for (int i = 0; i < fileListByUUID.size(); i++) {
|
||||
fileListByUUID.get(i).delete();
|
||||
}
|
||||
ivPoiVideoPicture.setImageDrawable(null);
|
||||
fmPoiVideoPic.setTag(null);
|
||||
} else {
|
||||
boolean isImageLoad = false;
|
||||
for (int i = 0; i < fileListByUUID.size(); i++) {
|
||||
@ -402,25 +279,35 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
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:
|
||||
initPoiSaveLocal(false);
|
||||
break;
|
||||
case R.id.tv_pictures://拍照
|
||||
isRequest = 0x102;
|
||||
case R.id.tv_short://手动拍摄
|
||||
Intent intents = new Intent(getContext(), PicturesActivity.class);
|
||||
File filePath = AWMp4ParserHelper.getInstance().obtainJPGFilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
|
||||
intents.putExtra(Constant.INTENT_JPG_PATH, filePath.getAbsolutePath());
|
||||
int pictureType = getPictureType();
|
||||
intents.putExtra("type", pictureType);
|
||||
intents.putExtra("poiEntity", showPoiEntity);
|
||||
intents.putExtra(Constant.INTENT_VIDEO_OBLATION, 0);
|
||||
intents.putExtra(Constant.INTENT_POI_VIDEO_TYPE, 2);
|
||||
startActivityForResult(intents, 0x102);
|
||||
break;
|
||||
case R.id.tv_picture://录像
|
||||
isRequest = 0x101;
|
||||
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());
|
||||
case R.id.tv_combo://自动连拍:
|
||||
Intent intent = new Intent(getContext(), PicturesActivity.class);
|
||||
File fileJpgPath = AWMp4ParserHelper.getInstance().obtainJPGFilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
|
||||
intent.putExtra(Constant.INTENT_JPG_PATH, fileJpgPath.getAbsolutePath());
|
||||
intent.putExtra("poiEntity", showPoiEntity);
|
||||
intent.putExtra(Constant.INTENT_VIDEO_OBLATION, 0);
|
||||
intent.putExtra(Constant.INTENT_POI_VIDEO_TYPE, 1);
|
||||
startActivityForResult(intent, 0x101);
|
||||
break;
|
||||
case R.id.btn_poi_video_upload:
|
||||
@ -459,26 +346,6 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
return;
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDenied(List<String> permissions, boolean never) {
|
||||
if (never) {
|
||||
@ -648,35 +516,19 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == 0x101 && resultCode == 0x101) {
|
||||
tvPictures.setEnabled(false);
|
||||
isRequest = 0x101;
|
||||
if (data != null && data.hasExtra(Constant.INTENT_VIDEO_PATH)) {
|
||||
String videoPath = data.getStringExtra(Constant.INTENT_VIDEO_PATH);
|
||||
assert videoPath != null;
|
||||
File videoFile = new File(videoPath);
|
||||
if (videoFile.exists()) {
|
||||
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);
|
||||
}
|
||||
if (requestCode == 0x101 && resultCode == 0x111) {
|
||||
tvShort.setEnabled(false);
|
||||
} else if (requestCode == 0x102 && resultCode == 0x111) {
|
||||
tvCombo.setEnabled(false);
|
||||
}
|
||||
if (data != null && data.hasExtra(Constant.INTENT_VIDEO_PATH)) {
|
||||
String videoPath = data.getStringExtra(Constant.INTENT_VIDEO_PATH);
|
||||
assert videoPath != null;
|
||||
File videoFile = new File(videoPath);
|
||||
if (videoFile.exists()) {
|
||||
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).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);
|
||||
initPoiVideoSharePre();
|
||||
}
|
||||
|
||||
/**
|
||||
* 防止程序崩溃后数据丢失
|
||||
*/
|
||||
@ -707,37 +560,6 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
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
|
||||
public void 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();
|
||||
if (!desc.equals("")) {
|
||||
poiEntity.setMemo(desc);
|
||||
@ -855,41 +673,20 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setType(3);
|
||||
poiEntity.setTaskStatus(2);
|
||||
if (isRequest == 0x101) {
|
||||
if (fmPoiVideoPic.getTag() == null) {
|
||||
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
|
||||
if (fileListByUUID != null) {
|
||||
fmPoiVideoPic.setTag(fileListByUUID);
|
||||
}
|
||||
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(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);//连拍
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
return poiEntity;
|
||||
@ -898,23 +695,9 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
@Override
|
||||
protected PoiCheckResult checkPoiEntity(PoiEntity entity) {
|
||||
PoiCheckResult poiCheckResult = new PoiCheckResult();
|
||||
if (tvPicture.isEnabled()) {
|
||||
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) {
|
||||
if (entity.getPhoto() == null) {
|
||||
poiCheckResult.setCode(1);
|
||||
poiCheckResult.setMsg("请选择录像方式");
|
||||
poiCheckResult.setMsg("请拍摄");
|
||||
return poiCheckResult;
|
||||
}
|
||||
return poiCheckResult;
|
||||
|
@ -36,6 +36,7 @@ import com.lzy.okgo.model.HttpParams;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.activity.FragmentManagement;
|
||||
import com.navinfo.outdoor.activity.PictureActivity;
|
||||
import com.navinfo.outdoor.activity.PicturesActivity;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.base.BaseDrawerFragment;
|
||||
import com.navinfo.outdoor.bean.OtherUploadPicBean;
|
||||
@ -76,18 +77,13 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
private TextView tvPictures;
|
||||
private EditText etRoadName;
|
||||
private ImageView ivRoadPicture;
|
||||
private RadioButton rbCar;
|
||||
private RadioButton rbBicycle;
|
||||
private RadioButton rbWalking;
|
||||
private EditText etDesc;
|
||||
private Button btnRoadSave;
|
||||
private RadioGroup rgType;
|
||||
private PoiDao poiDao;
|
||||
private File fileZip;
|
||||
private FrameLayout fmRoadPic;
|
||||
private Marker markerRoad;
|
||||
private LatLng latLng;
|
||||
private TextView tvVideoAlbum;
|
||||
|
||||
public static RoadFragment newInstance(Bundle bundle) {
|
||||
RoadFragment fragment = new RoadFragment();
|
||||
@ -146,45 +142,18 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
super.initView();
|
||||
PoiDatabase poiDatabase = PoiDatabase.getInstance(getContext());
|
||||
poiDao = poiDatabase.getPoiDao();
|
||||
tvPictures = (TextView) findViewById(R.id.tv_pictures);
|
||||
tvPictures = findViewById(R.id.tv_pictures);
|
||||
tvPictures.setOnClickListener(this);
|
||||
tvVideoAlbum = findViewById(R.id.tv_video_album);
|
||||
tvVideoAlbum.setOnClickListener(this);
|
||||
setSlidingUpPanelLayout(Constant.SLIDING_LAYOUT);
|
||||
NestedScrollView nestedScrollView = findViewById(R.id.nested_scroll_view);
|
||||
if (slidingPaneLayout != null) {
|
||||
slidingPaneLayout.setScrollableView(nestedScrollView);
|
||||
}
|
||||
etRoadName = (EditText) findViewById(R.id.et_road_name);
|
||||
ivRoadPicture = (ImageView) findViewById(R.id.iv_road_picture);
|
||||
// Glide.with(getContext()).load(getLocalVideoBitmap(String.valueOf(R.drawable.bg_01))).into(ivRoadPicture);
|
||||
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);
|
||||
etRoadName = findViewById(R.id.et_road_name);
|
||||
ivRoadPicture = findViewById(R.id.iv_road_picture);
|
||||
etDesc = findViewById(R.id.et_desc);
|
||||
fmRoadPic = findViewById(R.id.fm_road_picture);
|
||||
btnRoadSave = (Button) findViewById(R.id.btn_road_save);
|
||||
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.setOnClickListener(this);
|
||||
fmRoadPic.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
@ -197,12 +166,18 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
fileListByUUID.get(i).delete();
|
||||
}
|
||||
ivRoadPicture.setImageDrawable(null);
|
||||
fmRoadPic.setTag(null);
|
||||
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();
|
||||
//禁用可操作性控件
|
||||
@ -230,8 +205,6 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
markerRoad.setZIndex(4);
|
||||
moveLatlng(latLng, null);
|
||||
}
|
||||
int work_type = showPoiEntity.getWork_type();
|
||||
showPictureType(work_type);
|
||||
String describe = showPoiEntity.getDescribe();//任务描述
|
||||
if (describe != null && !describe.equals("")) {
|
||||
etDesc.setText(describe);
|
||||
@ -246,7 +219,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
if (!StringUtils.isEmpty(photo)) {
|
||||
File videoFile = 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) {
|
||||
// 使用glide加载视频的第一帧
|
||||
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() {
|
||||
fmRoadPic.setEnabled(false);
|
||||
tvVideoAlbum.setEnabled(false);
|
||||
etRoadName.setEnabled(false);
|
||||
rgType.setEnabled(false);
|
||||
ivRoadPicture.setEnabled(false);
|
||||
tvPictures.setEnabled(false);
|
||||
etDesc.setEnabled(false);
|
||||
btnRoadSave.setEnabled(false);
|
||||
rbCar.setEnabled(false);
|
||||
rbBicycle.setEnabled(false);
|
||||
rbWalking.setEnabled(false);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@ -288,13 +256,13 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
}
|
||||
} else if (data.what == Constant.VIDEO_FINISH_ROAD) {
|
||||
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
|
||||
if (fileListByUUID.size()==0) {
|
||||
if (fileListByUUID.size() == 0) {
|
||||
ivRoadPicture.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.getPath().contains(".jpg") && !videoFile.getPath().contains("paper.txt")) {
|
||||
if (videoFile.exists() && !isImageLoad) {
|
||||
// 使用glide加载视频的第一帧
|
||||
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:
|
||||
initPoiSaveLocal(false);
|
||||
break;
|
||||
case R.id.tv_video_album:
|
||||
case R.id.fm_road_picture:
|
||||
if (fmRoadPic.getTag() == null) {
|
||||
Toast.makeText(getContext(), "请录像后才可以查看", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(getContext(), "还没有拍摄", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
if (tvPictures.isEnabled()) {
|
||||
showPoiEntity.setRecord_way(1);
|
||||
Intent photoAlbumIntent = new Intent(getActivity(), FragmentManagement.class);
|
||||
photoAlbumIntent.putExtra("tag", 37);
|
||||
photoAlbumIntent.putExtra("showPoiEntity", showPoiEntity);
|
||||
startActivity(photoAlbumIntent);
|
||||
}
|
||||
Intent photoAlbumIntent = new Intent(getActivity(), FragmentManagement.class);
|
||||
photoAlbumIntent.putExtra("tag", 36);
|
||||
photoAlbumIntent.putExtra("showPoiEntity", showPoiEntity);
|
||||
startActivity(photoAlbumIntent);
|
||||
break;
|
||||
case R.id.tv_pictures:
|
||||
|
||||
// 根据用户点击的时间为视频名称赋值
|
||||
// DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
// 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 intent = new Intent(getContext(), PicturesActivity.class);
|
||||
File finalFile = AWMp4ParserHelper.getInstance().obtainJPGFilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
|
||||
intent.putExtra(Constant.INTENT_JPG_PATH, finalFile.getAbsolutePath());
|
||||
intent.putExtra(Constant.INTENT_VIDEO_OBLATION, 0);
|
||||
intent.putExtra(Constant.INTENT_POI_VIDEO_TYPE, 3);
|
||||
intent.putExtra("poiEntity", showPoiEntity);
|
||||
startActivityForResult(intent, 0x101);
|
||||
break;
|
||||
@ -550,37 +512,16 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == 0x101) {
|
||||
if (resultCode == 0x101) {
|
||||
if (resultCode == 0x111) {
|
||||
if (data != null && data.hasExtra(Constant.INTENT_VIDEO_PATH)) {
|
||||
// 扫描照片目录中当前视频的所有视频文件
|
||||
String videoPath = data.getStringExtra(Constant.INTENT_VIDEO_PATH);
|
||||
assert videoPath != null;
|
||||
File videoFile = new File(videoPath);
|
||||
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) 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);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
//获取拍照类型
|
||||
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
|
||||
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();
|
||||
if (!desc.equals("")) {
|
||||
poiEntity.setMemo(desc);
|
||||
@ -767,7 +678,6 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
Log.d("TAG", "onGranted: " + lineString);
|
||||
String photoStr = AWMp4ParserHelper.getInstance().getVideoFileListStr((List<File>) fmRoadPic.getTag());
|
||||
poiEntity.setPhoto(photoStr);
|
||||
poiEntity.setRecord_way(1);
|
||||
if (lineString != null) {
|
||||
poiEntity.setGeoWkt(lineString);
|
||||
}
|
||||
@ -780,15 +690,9 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
PoiCheckResult poiCheckResult = new PoiCheckResult();
|
||||
if (entity.getPhoto() == null) {
|
||||
poiCheckResult.setCode(1);
|
||||
poiCheckResult.setMsg("请录像");
|
||||
poiCheckResult.setMsg("请拍摄");
|
||||
return poiCheckResult;
|
||||
}
|
||||
if (entity.getWork_type() == -1) {
|
||||
poiCheckResult.setCode(1);
|
||||
poiCheckResult.setMsg("请选择录像方式");
|
||||
return poiCheckResult;
|
||||
}
|
||||
|
||||
return poiCheckResult;
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ import java.util.Objects;
|
||||
/**
|
||||
* 设置页面的fragment
|
||||
*/
|
||||
public class SetFragment extends BaseFragment implements View.OnClickListener {
|
||||
public class SetFragment extends BaseFragment implements View.OnClickListener {
|
||||
|
||||
private SharedPreferences.Editor navInfoEditor;
|
||||
|
||||
|
@ -47,6 +47,7 @@ public class VideoFragment extends BaseFragment implements View.OnClickListener
|
||||
protected int getLayout() {
|
||||
return R.layout.fragment_video;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
@ -62,7 +63,7 @@ public class VideoFragment extends BaseFragment implements View.OnClickListener
|
||||
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||
if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
Message message = new Message();
|
||||
message.what= Constant.VIDEO_FINISH_ROAD;
|
||||
message.what = Constant.VIDEO_FINISH_ROAD;
|
||||
EventBus.getDefault().post(message);
|
||||
Objects.requireNonNull(getActivity()).finish();
|
||||
return true;
|
||||
@ -71,6 +72,7 @@ public class VideoFragment extends BaseFragment implements View.OnClickListener
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
super.initView();
|
||||
@ -79,17 +81,16 @@ public class VideoFragment extends BaseFragment implements View.OnClickListener
|
||||
ArrayList<File> textFile = new ArrayList<>();
|
||||
if (showPoiEntity != null) {
|
||||
String id = showPoiEntity.getId();
|
||||
if (showPoiEntity.getRecord_way() == 1) {
|
||||
fileBeans = new ArrayList<>();
|
||||
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(id);
|
||||
for (int i = 0; i < fileListByUUID.size(); i++) {
|
||||
if (!fileListByUUID.get(i).getPath().contains(".txt")) {
|
||||
FileBean fileBean = new FileBean(fileListByUUID.get(i), false);
|
||||
fileBeans.add(fileBean);
|
||||
}else {
|
||||
textFile.add(fileListByUUID.get(i));
|
||||
}
|
||||
fileBeans = new ArrayList<>();
|
||||
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(id);
|
||||
for (int i = 0; i < fileListByUUID.size(); i++) {
|
||||
if (!fileListByUUID.get(i).getPath().contains(".txt")) {
|
||||
FileBean fileBean = new FileBean(fileListByUUID.get(i), false);
|
||||
fileBeans.add(fileBean);
|
||||
} else {
|
||||
textFile.add(fileListByUUID.get(i));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
ImageView ivPhotoFinal = (ImageView) findViewById(R.id.iv_video_final);
|
||||
@ -129,7 +130,7 @@ public class VideoFragment extends BaseFragment implements View.OnClickListener
|
||||
switch (v.getId()) {
|
||||
case R.id.iv_video_final:
|
||||
Message message = new Message();
|
||||
message.what= Constant.VIDEO_FINISH_ROAD;
|
||||
message.what = Constant.VIDEO_FINISH_ROAD;
|
||||
EventBus.getDefault().post(message);
|
||||
Objects.requireNonNull(getActivity()).finish();
|
||||
break;
|
||||
|
@ -259,17 +259,15 @@ public class PoiSaveUtils {
|
||||
}
|
||||
List<File> videoFileList = AWMp4ParserHelper.getInstance().getFileListByUUID(poiEntity.getId());
|
||||
if (videoFileList != null && !videoFileList.isEmpty()) {
|
||||
List<File> txtFileList = new ArrayList<>();
|
||||
/*List<File> txtFileList = new ArrayList<>();
|
||||
for (File videoFile : videoFileList) {
|
||||
File file = new File(videoFile.getAbsolutePath() + ".txt");
|
||||
txtFileList.add(file);
|
||||
}
|
||||
videoFileList.addAll(txtFileList);
|
||||
}*/
|
||||
//videoFileList.addAll(videoFileList);
|
||||
File fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
|
||||
ZipUtil.zipFiles(videoFileList, fileZip, null);
|
||||
if (fileZip != null) {
|
||||
photoFile.add(fileZip);
|
||||
}
|
||||
photoFile.add(fileZip);
|
||||
}
|
||||
String url = null;
|
||||
//1 "POI"2 "充电站"3 "POI录像"4 "道路录像"5 "其他"6 "面状任务"
|
||||
|
@ -52,7 +52,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:text="名称 "
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp" />
|
||||
@ -68,82 +68,20 @@
|
||||
android:textSize="14sp" />
|
||||
</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
|
||||
android:id="@+id/ll_pictures"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintLeft_toLeftOf="@id/ll_mode"
|
||||
app:layout_constraintTop_toBottomOf="@id/ll_mode">
|
||||
app:layout_constraintLeft_toLeftOf="@id/ll_name"
|
||||
app:layout_constraintTop_toBottomOf="@id/ll_name">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="03.录像 "
|
||||
android:text="02.拍摄 "
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp" />
|
||||
|
||||
@ -154,20 +92,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:gravity="center"
|
||||
android:text="点击录像"
|
||||
android:text="点击拍摄"
|
||||
android:textColor="@color/white"
|
||||
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>
|
||||
|
||||
<FrameLayout
|
||||
@ -181,7 +108,7 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="长按录像可删除"
|
||||
android:text="点击拍摄成果可查看,长按可删除"
|
||||
android:textSize="16sp"
|
||||
android:layout_marginStart="10dp"
|
||||
/>
|
||||
@ -211,7 +138,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="04.描述"
|
||||
android:text="03.描述"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp" />
|
||||
|
||||
|
@ -74,67 +74,6 @@
|
||||
android:textSize="14sp" />
|
||||
</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
|
||||
android:id="@+id/ll_pictures"
|
||||
@ -143,43 +82,32 @@
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintLeft_toLeftOf="@id/ll_mode"
|
||||
app:layout_constraintTop_toBottomOf="@id/ll_mode">
|
||||
app:layout_constraintLeft_toLeftOf="@id/ll_name"
|
||||
app:layout_constraintTop_toBottomOf="@id/ll_name">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="03.录像"
|
||||
android:text="02.拍摄"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp" />
|
||||
<TextView
|
||||
android:id="@+id/tv_picture"
|
||||
android:id="@+id/tv_short"
|
||||
style="@style/user_style"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:gravity="center"
|
||||
android:text="点击录像"
|
||||
android:text="手动拍摄"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp" />
|
||||
<TextView
|
||||
android:id="@+id/tv_pictures"
|
||||
android:id="@+id/tv_combo"
|
||||
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" />
|
||||
<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:text="自动连拍"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp" />
|
||||
</LinearLayout>
|
||||
@ -194,7 +122,7 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="长按图片或者录像可删除"
|
||||
android:text="点击拍摄成果可查看,长按可删除"
|
||||
android:textSize="16sp"
|
||||
android:layout_marginStart="10dp"/>
|
||||
<ImageView
|
||||
@ -266,7 +194,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="04.描述"
|
||||
android:text="03.描述"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp" />
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user