修改poiVideo的新需求
This commit is contained in:
parent
7517520a9f
commit
409f2a3879
@ -11,6 +11,7 @@ import android.graphics.Bitmap;
|
|||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.graphics.Matrix;
|
import android.graphics.Matrix;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@ -83,24 +84,42 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
private TencentMap tencentMap;
|
private TencentMap tencentMap;
|
||||||
private MyLocationStyle locationStyle;
|
private MyLocationStyle locationStyle;
|
||||||
private TextureMapView ivMap;
|
private TextureMapView ivMap;
|
||||||
private CheckBox captureVideo; // 拍摄视频
|
private Button stopPicture;
|
||||||
private Button btnVideo, stopVideo;
|
|
||||||
|
|
||||||
private String finalVideoPath; // 摄像后最终保存的文件名
|
// private String finalVideoPath; // 摄像后最终保存的文件名
|
||||||
private File tmpFile; // 合并文件的临时文件路径
|
// private File tmpFile; // 合并文件的临时文件路径
|
||||||
private Timer timer;
|
//private Timer timer;
|
||||||
private CsvTimerTask timerTask; // 执行定时写入csv文件的task
|
// private CsvTimerTask timerTask; // 执行定时写入csv文件的task
|
||||||
private DateFormat formatter;
|
// private DateFormat formatter;
|
||||||
private final long period = 1; // 记录csv文件的间隔时间,单位为秒
|
// private final long period = 1; // 记录csv文件的间隔时间,单位为秒
|
||||||
private ViewGroup layerChange; // 切换地图和相机的父控件
|
private ViewGroup layerChange; // 切换地图和相机的父控件
|
||||||
private boolean isFinishActivity = false; // 是否需要关闭当前activity
|
// private boolean isFinishActivity = false; // 是否需要关闭当前activity
|
||||||
|
private CheckBox capturePicture;//拍照
|
||||||
|
private ArrayList<File> pictureList;
|
||||||
|
private Handler handler=new Handler(new Handler.Callback() {
|
||||||
|
@Override
|
||||||
|
public boolean handleMessage(@NonNull Message msg) {
|
||||||
|
if (msg.what==0&&listenerPicture){
|
||||||
|
File file= (File) msg.obj;
|
||||||
|
pictureList.add(file);
|
||||||
|
if (camera.isTakingPicture()){
|
||||||
|
camera.destroy();
|
||||||
|
}else {
|
||||||
|
camera.takePicture();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
private boolean listenerPicture=true;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getLayout() {
|
protected int getLayout() {
|
||||||
EventBus.getDefault().register(this);
|
/* EventBus.getDefault().register(this);
|
||||||
tmpFile = new File(Constant.PICTURE_FOLDER, "temp.mp4");
|
tmpFile = new File(Constant.PICTURE_FOLDER, "temp.mp4");
|
||||||
formatter = new SimpleDateFormat("yyyyMMdd HHmmss");
|
formatter = new SimpleDateFormat("yyyyMMdd HHmmss");*/
|
||||||
return R.layout.activity_pictures;
|
return R.layout.activity_pictures;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,16 +127,13 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
protected void initView() {
|
protected void initView() {
|
||||||
super.initView();
|
super.initView();
|
||||||
|
|
||||||
if (getIntent()!=null) {
|
/* if (getIntent()!=null) {
|
||||||
finalVideoPath = getIntent().getStringExtra(Constant.INTENT_VIDEO_PATH);
|
finalVideoPath = getIntent().getStringExtra(Constant.INTENT_VIDEO_PATH);
|
||||||
}
|
}*/
|
||||||
if (finalVideoPath == null) {
|
pictureList = new ArrayList<>();
|
||||||
finalVideoPath = Constant.PICTURE_FOLDER+"/final.mp4";
|
|
||||||
}
|
|
||||||
|
|
||||||
layerChange = findViewById(R.id.layer_change);
|
layerChange = findViewById(R.id.layer_change);
|
||||||
|
|
||||||
timer = new Timer();
|
//timer = new Timer();
|
||||||
|
|
||||||
// this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
// this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||||
ivMap = (TextureMapView) findViewById(R.id.iv_map);
|
ivMap = (TextureMapView) findViewById(R.id.iv_map);
|
||||||
@ -129,23 +145,23 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
CameraLogger.setLogLevel(CameraLogger.LEVEL_VERBOSE);
|
CameraLogger.setLogLevel(CameraLogger.LEVEL_VERBOSE);
|
||||||
camera = findViewById(R.id.camera);
|
camera = findViewById(R.id.camera);
|
||||||
camera.setOnClickListener(this::onClick);
|
camera.setOnClickListener(this::onClick);
|
||||||
captureVideo = findViewById(R.id.capuretVideo);
|
capturePicture = findViewById(R.id.capuret_picture);
|
||||||
captureVideo.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) { // 开始采集,设置按钮文字内容为“结束采集”
|
||||||
captureVideo.setText("暂停采集");
|
capturePicture.setText("暂停采集");
|
||||||
// stopVideo.setEnabled(false);// 开始采集视频后,禁用停止采集的按钮,必须暂停采集后才可点击停止采集
|
listenerPicture= true;
|
||||||
startTakenVideo(); // 开始采集视频
|
camera.takePicture();
|
||||||
} else {
|
} else {
|
||||||
stopTakenVideo();
|
listenerPicture = false;
|
||||||
captureVideo.setText("开始采集");
|
capturePicture.setText("开始采集");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
stopVideo = findViewById(R.id.btn_stop_video);
|
stopPicture = findViewById(R.id.btn_stop_picture);
|
||||||
stopVideo.setOnClickListener(this::onClick);
|
stopPicture.setOnClickListener(this::onClick);
|
||||||
//拍照权限
|
//拍照权限
|
||||||
camera.setLifecycleOwner(this);
|
camera.setLifecycleOwner(this);
|
||||||
camera.setEngine(Engine.CAMERA1);
|
camera.setEngine(Engine.CAMERA1);
|
||||||
@ -198,12 +214,17 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
super.onPictureTaken(result);
|
super.onPictureTaken(result);
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||||
|
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd HHmmss");
|
||||||
String format = formatter.format(calendar.getTime());
|
String format = formatter.format(calendar.getTime());
|
||||||
//文件
|
//文件
|
||||||
File file = new File(Constant.PICTURE_FOLDER, format + ".jpg");
|
File file = new File(Constant.PICTURE_FOLDER, format + ".jpg");
|
||||||
result.toFile(file, new FileCallback() {
|
result.toFile(file, new FileCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onFileReady(@Nullable @org.jetbrains.annotations.Nullable File file) {
|
public void onFileReady(@Nullable @org.jetbrains.annotations.Nullable File file) {
|
||||||
|
Message message = new Message();
|
||||||
|
message.what=0;
|
||||||
|
message.obj=file;
|
||||||
|
handler.sendMessageDelayed(message,2000);
|
||||||
Toast.makeText(PicturesActivity.this, "保存成功:" + file.getPath(), Toast.LENGTH_SHORT).show();
|
Toast.makeText(PicturesActivity.this, "保存成功:" + file.getPath(), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -221,7 +242,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
super.onVideoTaken(result);
|
super.onVideoTaken(result);
|
||||||
Toast.makeText(PicturesActivity.this, "暂停摄像", Toast.LENGTH_SHORT).show();
|
Toast.makeText(PicturesActivity.this, "暂停摄像", Toast.LENGTH_SHORT).show();
|
||||||
//showLoadingDialog();
|
//showLoadingDialog();
|
||||||
new Thread(new Runnable() {
|
/* new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (result!=null) {
|
if (result!=null) {
|
||||||
@ -259,7 +280,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -271,9 +292,9 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
@Override
|
@Override
|
||||||
public void onVideoRecordingStart() {
|
public void onVideoRecordingStart() {
|
||||||
super.onVideoRecordingStart();
|
super.onVideoRecordingStart();
|
||||||
/**
|
/* *//**
|
||||||
* 获取当前视频的时间,记录csv文件时使用
|
* 获取当前视频的时间,记录csv文件时使用
|
||||||
* */
|
* *//*
|
||||||
long currentTime = AWMp4ParserHelper.getInstance().getVedioTotalTime(new File(finalVideoPath));
|
long currentTime = AWMp4ParserHelper.getInstance().getVedioTotalTime(new File(finalVideoPath));
|
||||||
timerTask = new CsvTimerTask(new File(finalVideoPath+".txt"));
|
timerTask = new CsvTimerTask(new File(finalVideoPath+".txt"));
|
||||||
|
|
||||||
@ -284,17 +305,17 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
timerTask.setCurrentVideoTime(currentTime/1000+1);
|
timerTask.setCurrentVideoTime(currentTime/1000+1);
|
||||||
timer.schedule(timerTask, 1, period*1000);
|
timer.schedule(timerTask, 1, period*1000);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onVideoRecordingEnd() {
|
public void onVideoRecordingEnd() {
|
||||||
super.onVideoRecordingEnd();
|
super.onVideoRecordingEnd();
|
||||||
if (timerTask!=null){
|
/* if (timerTask!=null){
|
||||||
timerTask.cancel();
|
timerTask.cancel();
|
||||||
}else {
|
}else {
|
||||||
// Toast.makeText(PictureActivity.this, "请先拍照", Toast.LENGTH_SHORT).show();
|
// Toast.makeText(PictureActivity.this, "请先拍照", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -321,7 +342,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
@Override
|
@Override
|
||||||
protected void initData() {
|
protected void initData() {
|
||||||
super.initData();
|
super.initData();
|
||||||
camera.setMode(Mode.VIDEO);
|
camera.setMode(Mode.PICTURE);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
@ -335,22 +356,17 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
// File file = new File(Constant.PICTURE_FOLDER, format + ".mp4");
|
// File file = new File(Constant.PICTURE_FOLDER, format + ".mp4");
|
||||||
// cameraView.takeVideo(file, 15000);
|
// cameraView.takeVideo(file, 15000);
|
||||||
// break;
|
// break;
|
||||||
case R.id.btn_stop_video:
|
case R.id.btn_stop_picture:
|
||||||
if (timerTask!=null){
|
/* if (camera.isTakingPicture()) {
|
||||||
timerTask.cancel();
|
|
||||||
Intent intent = new Intent();
|
|
||||||
intent.putExtra(Constant.INTENT_VIDEO_PATH, finalVideoPath);
|
|
||||||
setResult(0x101, intent);
|
|
||||||
}else {
|
|
||||||
Toast.makeText(this, "本段视频没有计时!", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
if (camera.isTakingVideo()) {
|
|
||||||
isFinishActivity = true;
|
|
||||||
camera.stopVideo();
|
|
||||||
} else {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}*/
|
||||||
|
camera.destroy();
|
||||||
|
Intent intent = new Intent();
|
||||||
|
intent.putExtra(Constant.INTENT_VIDEO_PATH,pictureList );
|
||||||
|
setResult(0x102, intent);
|
||||||
|
finish();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case R.id.btn_switch:
|
case R.id.btn_switch:
|
||||||
@ -484,7 +500,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
stopTakenVideo();
|
stopTakenVideo();
|
||||||
camera.destroy();
|
camera.destroy();
|
||||||
timer.cancel();
|
// timer.cancel();
|
||||||
if (EventBus.getDefault().isRegistered(this)) {
|
if (EventBus.getDefault().isRegistered(this)) {
|
||||||
EventBus.getDefault().unregister(this);
|
EventBus.getDefault().unregister(this);
|
||||||
}
|
}
|
||||||
@ -530,7 +546,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
public void run() {
|
public void run() {
|
||||||
// 记录当前时间、视频时间、以及当前经纬度信息
|
// 记录当前时间、视频时间、以及当前经纬度信息
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
sb.append(formatter.format(new Date())); // 记录当前时间
|
// sb.append(formatter.format(new Date())); // 记录当前时间
|
||||||
sb.append(",");
|
sb.append(",");
|
||||||
sb.append(currentVideoTime) ;// 记录视频时间
|
sb.append(currentVideoTime) ;// 记录视频时间
|
||||||
sb.append(",");
|
sb.append(",");
|
||||||
@ -539,7 +555,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
sb.append(Constant.currentLocation.getLongitude());
|
sb.append(Constant.currentLocation.getLongitude());
|
||||||
sb.append("\r\n");
|
sb.append("\r\n");
|
||||||
FileUtils.writeFile(csvFile.getAbsolutePath(), sb.toString(), true);
|
FileUtils.writeFile(csvFile.getAbsolutePath(), sb.toString(), true);
|
||||||
currentVideoTime = currentVideoTime+period; //
|
// currentVideoTime = currentVideoTime+period; //
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -28,6 +28,7 @@ import androidx.annotation.Nullable;
|
|||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.core.widget.NestedScrollView;
|
import androidx.core.widget.NestedScrollView;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
import com.github.lazylibrary.util.FileUtils;
|
import com.github.lazylibrary.util.FileUtils;
|
||||||
import com.github.lazylibrary.util.StringUtils;
|
import com.github.lazylibrary.util.StringUtils;
|
||||||
import com.github.lazylibrary.util.ZipUtil;
|
import com.github.lazylibrary.util.ZipUtil;
|
||||||
@ -48,6 +49,7 @@ import com.navinfo.outdoor.activity.PictureActivity;
|
|||||||
import com.navinfo.outdoor.activity.PicturesActivity;
|
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.Info;
|
||||||
import com.navinfo.outdoor.bean.OtherUploadPicBean;
|
import com.navinfo.outdoor.bean.OtherUploadPicBean;
|
||||||
import com.navinfo.outdoor.bean.PoiSaveBean;
|
import com.navinfo.outdoor.bean.PoiSaveBean;
|
||||||
import com.navinfo.outdoor.bean.PoiVideoBean;
|
import com.navinfo.outdoor.bean.PoiVideoBean;
|
||||||
@ -74,6 +76,7 @@ import org.greenrobot.eventbus.EventBus;
|
|||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -103,6 +106,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
private NestedScrollView nestedScrollView;
|
private NestedScrollView nestedScrollView;
|
||||||
private LatLng latLng;
|
private LatLng latLng;
|
||||||
private Marker markerPoiVideo;
|
private Marker markerPoiVideo;
|
||||||
|
private TextView tvPicture;
|
||||||
|
|
||||||
public static PoiVideoFragment newInstance(Bundle bundle) {
|
public static PoiVideoFragment newInstance(Bundle bundle) {
|
||||||
PoiVideoFragment fragment = new PoiVideoFragment();
|
PoiVideoFragment fragment = new PoiVideoFragment();
|
||||||
@ -162,8 +166,10 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
super.initView();
|
super.initView();
|
||||||
poiDatabase = PoiDatabase.getInstance(getContext());
|
poiDatabase = PoiDatabase.getInstance(getContext());
|
||||||
poiDao = poiDatabase.getPoiDao();
|
poiDao = poiDatabase.getPoiDao();
|
||||||
tvPictures = (TextView) findViewById(R.id.tv_pictures);
|
tvPictures = (TextView) findViewById(R.id.tv_pictures);//拍照
|
||||||
tvPictures.setOnClickListener(this::onClick);
|
tvPictures.setOnClickListener(this::onClick);
|
||||||
|
tvPicture = (TextView) findViewById(R.id.tv_picture);//录像
|
||||||
|
tvPicture.setOnClickListener(this::onClick);
|
||||||
setSlidingUpPanelLayout(Constant.SLIDING_LAYOUT);
|
setSlidingUpPanelLayout(Constant.SLIDING_LAYOUT);
|
||||||
nestedScrollView = findViewById(R.id.nested_scroll_view);
|
nestedScrollView = findViewById(R.id.nested_scroll_view);
|
||||||
if (slidingPaneLayout != null) {
|
if (slidingPaneLayout != null) {
|
||||||
@ -181,7 +187,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
btnPoiVideoUpload = findViewById(R.id.btn_poi_video_upload);
|
btnPoiVideoUpload = findViewById(R.id.btn_poi_video_upload);
|
||||||
btnPoiVideoUpload.setOnClickListener(this::onClick);
|
btnPoiVideoUpload.setOnClickListener(this::onClick);
|
||||||
rgType = (RadioGroup) findViewById(R.id.rg_type);
|
rgType = (RadioGroup) findViewById(R.id.rg_type);
|
||||||
fmPoiVideoPic.setOnClickListener(new View.OnClickListener() {
|
/* fmPoiVideoPic.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (v.getTag() == null || ((List<File>) v.getTag()).size() == 0) {
|
if (v.getTag() == null || ((List<File>) v.getTag()).size() == 0) {
|
||||||
@ -196,7 +202,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
intent.putExtra(Constant.INTENT_VIDEO_PATH, finalFile.getAbsolutePath());
|
intent.putExtra(Constant.INTENT_VIDEO_PATH, finalFile.getAbsolutePath());
|
||||||
startActivityForResult(intent, 0x101);
|
startActivityForResult(intent, 0x101);
|
||||||
}
|
}
|
||||||
});
|
});*/
|
||||||
fmPoiVideoPic.setOnLongClickListener(new View.OnLongClickListener() {
|
fmPoiVideoPic.setOnLongClickListener(new View.OnLongClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onLongClick(View v) {
|
public boolean onLongClick(View v) {
|
||||||
@ -245,29 +251,47 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
etDesc.setText(describe + "");
|
etDesc.setText(describe + "");
|
||||||
}
|
}
|
||||||
String photoList = showPoiEntity.getPhoto();
|
String photoList = showPoiEntity.getPhoto();
|
||||||
if (!StringUtils.isEmpty(photoList)) {
|
if (showPoiEntity.getPhotoInfo()!=null&&photoList==null){
|
||||||
String[] photos = photoList.split(",");
|
tvPicture.setEnabled(false);
|
||||||
List<File> videoFileList = new ArrayList<>();
|
ArrayList<File> files = new ArrayList<>();
|
||||||
boolean isImageLoad = false;
|
List<Info> list = showPoiEntity.getPhotoInfo();
|
||||||
if (photos != null && photos.length > 0) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
for (int i = 0; i < photos.length; i++) {
|
files.add(new File(list.get(i).getPhoto()));
|
||||||
String photo = photos[i];
|
}
|
||||||
if (!StringUtils.isEmpty(photo)) {
|
if (files!=null){
|
||||||
File videoFile = new File(photo);
|
Uri uri = Uri.fromFile(files.get(0));
|
||||||
videoFileList.add(new File(photo));
|
Glide.with(getContext()).load(uri).into(ivPoiVideoPicture);
|
||||||
if (videoFile.getPath().contains("0.mp4") && !videoFile.getPath().contains("0.mp4.txt")) {
|
fmPoiVideoPic.setTag(files);
|
||||||
if (videoFile.exists() && !isImageLoad) {
|
}
|
||||||
// 使用glide加载视频的第一帧
|
|
||||||
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivPoiVideoPicture, 500);
|
|
||||||
isImageLoad = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
}else if (showPoiEntity.getPhotoInfo()==null&&photoList!=null){
|
||||||
|
tvPictures.setEnabled(false);
|
||||||
|
if (!StringUtils.isEmpty(photoList)) {
|
||||||
|
String[] photos = photoList.split(",");
|
||||||
|
List<File> videoFileList = new ArrayList<>();
|
||||||
|
boolean isImageLoad = false;
|
||||||
|
if (photos != null && photos.length > 0) {
|
||||||
|
for (int i = 0; i < photos.length; i++) {
|
||||||
|
String photo = photos[i];
|
||||||
|
if (!StringUtils.isEmpty(photo)) {
|
||||||
|
File videoFile = new File(photo);
|
||||||
|
videoFileList.add(new File(photo));
|
||||||
|
if (videoFile.getPath().contains("0.mp4") && !videoFile.getPath().contains("0.mp4.txt")) {
|
||||||
|
if (videoFile.exists() && !isImageLoad) {
|
||||||
|
// 使用glide加载视频的第一帧
|
||||||
|
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivPoiVideoPicture, 500);
|
||||||
|
isImageLoad = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
fmPoiVideoPic.setTag(videoFileList);
|
||||||
}
|
}
|
||||||
fmPoiVideoPic.setTag(videoFileList);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//判断是否是已做完任务并保存成功
|
//判断是否是已做完任务并保存成功
|
||||||
if (showPoiEntity.getTaskStatus() == 3) {
|
if (showPoiEntity.getTaskStatus() == 3) {
|
||||||
@ -280,6 +304,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
rgType.setEnabled(false);
|
rgType.setEnabled(false);
|
||||||
ivPoiVideoPicture.setEnabled(false);
|
ivPoiVideoPicture.setEnabled(false);
|
||||||
tvPictures.setEnabled(false);
|
tvPictures.setEnabled(false);
|
||||||
|
tvPicture.setEnabled(false);
|
||||||
etDesc.setEnabled(false);
|
etDesc.setEnabled(false);
|
||||||
btnRoadSave.setEnabled(false);
|
btnRoadSave.setEnabled(false);
|
||||||
rbCar.setEnabled(false);
|
rbCar.setEnabled(false);
|
||||||
@ -304,7 +329,13 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
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_pictures://拍照
|
||||||
|
tvPicture.setEnabled(false);
|
||||||
|
Intent intents = new Intent(getContext(), PicturesActivity.class);
|
||||||
|
startActivityForResult(intents, 0x102);
|
||||||
|
break;
|
||||||
|
case R.id.tv_picture://录像
|
||||||
|
tvPictures.setEnabled(false);
|
||||||
// 根据用户点击的时间为视频名称赋值
|
// 根据用户点击的时间为视频名称赋值
|
||||||
// DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
|
// DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||||
// String videoFormatName = formatter.format(new Date());
|
// String videoFormatName = formatter.format(new Date());
|
||||||
@ -314,7 +345,6 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
intent.putExtra("poiEntity", showPoiEntity);
|
intent.putExtra("poiEntity", showPoiEntity);
|
||||||
startActivityForResult(intent, 0x101);
|
startActivityForResult(intent, 0x101);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case R.id.btn_poi_video_upload:
|
case R.id.btn_poi_video_upload:
|
||||||
showLoadingDialog();
|
showLoadingDialog();
|
||||||
setLoadingDialogText("压缩中...");
|
setLoadingDialogText("压缩中...");
|
||||||
@ -534,6 +564,16 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
fmPoiVideoPic.setTag(videoFileListByUUID);
|
fmPoiVideoPic.setTag(videoFileListByUUID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (requestCode == 0x102 && resultCode == 0x102) {
|
||||||
|
if (data != null) {
|
||||||
|
List<File> serializableExtra = (List<File>) data.getSerializableExtra(Constant.INTENT_VIDEO_PATH);
|
||||||
|
if (serializableExtra!=null){
|
||||||
|
Uri uri = Uri.fromFile(serializableExtra.get(0));
|
||||||
|
Glide.with(getContext()).load(uri).into(ivPoiVideoPicture);
|
||||||
|
fmPoiVideoPic.setTag(serializableExtra);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -602,7 +642,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
obtain.what = Constant.JOB_WORD_MONITOR;
|
obtain.what = Constant.JOB_WORD_MONITOR;
|
||||||
obtain.obj = true;
|
obtain.obj = true;
|
||||||
EventBus.getDefault().post(obtain);
|
EventBus.getDefault().post(obtain);
|
||||||
}else {
|
} else {
|
||||||
Message obtain = Message.obtain();
|
Message obtain = Message.obtain();
|
||||||
obtain.what = Constant.JOB_WORD_MONITOR;
|
obtain.what = Constant.JOB_WORD_MONITOR;
|
||||||
obtain.obj = true;
|
obtain.obj = true;
|
||||||
@ -701,7 +741,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
}
|
}
|
||||||
String desc = etDesc.getText().toString().trim();
|
String desc = etDesc.getText().toString().trim();
|
||||||
if (desc != null && !desc.equals("")) {
|
if (desc != null && !desc.equals("")) {
|
||||||
poiEntity.setDescribe(desc);
|
poiEntity.setMemo(desc);
|
||||||
}
|
}
|
||||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
@ -711,20 +751,33 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
poiEntity.setType(3);
|
poiEntity.setType(3);
|
||||||
poiEntity.setTaskStatus(2);
|
poiEntity.setTaskStatus(2);
|
||||||
poiEntity.setIsLocalData(1);
|
poiEntity.setIsLocalData(1);
|
||||||
if (fmPoiVideoPic.getTag() == null) {
|
|
||||||
List<File> videoFileListByUUID = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(showPoiEntity.getId());
|
if (tvPicture.isEnabled()){
|
||||||
if (videoFileListByUUID != null) {
|
if (fmPoiVideoPic.getTag() == null) {
|
||||||
fmPoiVideoPic.setTag(videoFileListByUUID);
|
List<File> videoFileListByUUID = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(showPoiEntity.getId());
|
||||||
|
if (videoFileListByUUID != null) {
|
||||||
|
fmPoiVideoPic.setTag(videoFileListByUUID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (fmPoiVideoPic.getTag() != null && !((List<File>) fmPoiVideoPic.getTag()).isEmpty()) {
|
||||||
|
List<LatLng> lineStringByVideoFileList = AWMp4ParserHelper.getInstance().getLineStringByVideoFileList((List<File>) fmPoiVideoPic.getTag());
|
||||||
|
String lineString = GeometryTools.getLineString(lineStringByVideoFileList);
|
||||||
|
Log.d("TAG", "onGranted: " + lineString);
|
||||||
|
String photoStr = AWMp4ParserHelper.getInstance().getVideoFileListStr((List<File>) fmPoiVideoPic.getTag());
|
||||||
|
poiEntity.setPhoto(photoStr);
|
||||||
|
if (lineString != null) {
|
||||||
|
poiEntity.setGeoWkt(lineString);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fmPoiVideoPic.getTag() != null && !((List<File>) fmPoiVideoPic.getTag()).isEmpty()) {
|
if (tvPictures.isEnabled()){
|
||||||
List<LatLng> lineStringByVideoFileList = AWMp4ParserHelper.getInstance().getLineStringByVideoFileList((List<File>) fmPoiVideoPic.getTag());
|
if (fmPoiVideoPic.getTag() != null && !((List<File>) fmPoiVideoPic.getTag()).isEmpty()) {
|
||||||
String lineString = GeometryTools.getLineString(lineStringByVideoFileList);
|
ArrayList<Info> infos = new ArrayList<>();
|
||||||
Log.d("TAG", "onGranted: " + lineString);
|
List<File> poiVideoPic = (List<File>) fmPoiVideoPic.getTag();
|
||||||
String photoStr = AWMp4ParserHelper.getInstance().getVideoFileListStr((List<File>) fmPoiVideoPic.getTag());
|
for (int i = 0; i < poiVideoPic.size(); i++) {
|
||||||
poiEntity.setPhoto(photoStr);
|
infos.add(new Info(poiVideoPic.get(i).getPath()));
|
||||||
if (lineString != null) {
|
}
|
||||||
poiEntity.setGeoWkt(lineString);
|
poiEntity.setPhotoInfo(infos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return poiEntity;
|
return poiEntity;
|
||||||
@ -733,10 +786,20 @@ 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 (entity.getPhoto() == null) {
|
if (tvPicture.isEnabled()) {
|
||||||
poiCheckResult.setCode(1);
|
if (tvPictures.isEnabled()){
|
||||||
poiCheckResult.setMsg("请录像");
|
poiCheckResult.setCode(1);
|
||||||
return poiCheckResult;
|
poiCheckResult.setMsg("请录像");
|
||||||
|
return poiCheckResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (tvPictures.isEnabled()) {
|
||||||
|
if (tvPicture.isEnabled()){
|
||||||
|
poiCheckResult.setCode(1);
|
||||||
|
poiCheckResult.setMsg("请拍照");
|
||||||
|
return poiCheckResult;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (entity.getWork_type() == -1) {
|
if (entity.getWork_type() == -1) {
|
||||||
poiCheckResult.setCode(1);
|
poiCheckResult.setCode(1);
|
||||||
|
@ -733,7 +733,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
|||||||
}
|
}
|
||||||
String desc = etDesc.getText().toString().trim();
|
String desc = etDesc.getText().toString().trim();
|
||||||
if (desc != null && !desc.equals("")) {
|
if (desc != null && !desc.equals("")) {
|
||||||
poiEntity.setDescribe(desc);
|
poiEntity.setMemo(desc);
|
||||||
}
|
}
|
||||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
@ -717,6 +717,10 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
public void run() {
|
public void run() {
|
||||||
List<PoiEntity> allTaskStatus = poiDao.getAllTaskStatus(taskStatus, taskStatus, type, type, limit, limit);
|
List<PoiEntity> allTaskStatus = poiDao.getAllTaskStatus(taskStatus, taskStatus, type, type, limit, limit);
|
||||||
//List<PoiEntity> allTaskStatus = poiDao.getAllPoi();
|
//List<PoiEntity> allTaskStatus = poiDao.getAllPoi();
|
||||||
|
List<PoiEntity> allPoiStatus = poiDao.getAllPoiStatus();
|
||||||
|
if (allPoiStatus!=null){
|
||||||
|
poiDao.deleteAll(allPoiStatus);
|
||||||
|
}
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -28,6 +28,8 @@ public interface PoiDao {
|
|||||||
@Query("SELECT * FROM poi where type=:type")
|
@Query("SELECT * FROM poi where type=:type")
|
||||||
List<PoiEntity> getAllPoiType(int type);
|
List<PoiEntity> getAllPoiType(int type);
|
||||||
|
|
||||||
|
@Query("SELECT * FROM poi where taskStatus =5")
|
||||||
|
List<PoiEntity> getAllPoiStatus();
|
||||||
|
|
||||||
@Query("SELECT * FROM poi WHERE (:taskStatus =-1 or taskStatus=:taskStatus1) and (:type=-1 or type=:type1) and (:isExclusive=-1 or isExclusive=:isExclusive1) ")
|
@Query("SELECT * FROM poi WHERE (:taskStatus =-1 or taskStatus=:taskStatus1) and (:type=-1 or type=:type1) and (:isExclusive=-1 or isExclusive=:isExclusive1) ")
|
||||||
// @Query("SELECT * FROM poi WHERE taskStatus=:taskStatus and type=:type and (:isExclusive=-1 or isExclusive=:isExclusive) ")
|
// @Query("SELECT * FROM poi WHERE taskStatus=:taskStatus and type=:type and (:isExclusive=-1 or isExclusive=:isExclusive) ")
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/capuretVideo"
|
android:id="@+id/capuret_picture"
|
||||||
style="@style/user_data_style"
|
style="@style/user_data_style"
|
||||||
android:layout_width="100dp"
|
android:layout_width="100dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@ -56,16 +56,16 @@
|
|||||||
android:text="开始采集"
|
android:text="开始采集"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintRight_toLeftOf="@id/btn_stop_video" />
|
app:layout_constraintRight_toLeftOf="@id/btn_stop_picture" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btn_stop_video"
|
android:id="@+id/btn_stop_picture"
|
||||||
android:layout_width="100dp"
|
android:layout_width="100dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/uploding_shape"
|
android:background="@drawable/uploding_shape"
|
||||||
android:text="结束采集"
|
android:text="结束采集"
|
||||||
android:textColor="@color/colorBlue"
|
android:textColor="@color/colorBlue"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/capuretVideo"
|
app:layout_constraintBottom_toBottomOf="@id/capuret_picture"
|
||||||
app:layout_constraintLeft_toRightOf="@id/capuretVideo"
|
app:layout_constraintLeft_toRightOf="@id/capuret_picture"
|
||||||
app:layout_constraintRight_toRightOf="parent" />
|
app:layout_constraintRight_toRightOf="parent" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -151,7 +151,7 @@
|
|||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_pictures"
|
android:id="@+id/tv_picture"
|
||||||
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"
|
||||||
@ -160,7 +160,16 @@
|
|||||||
android:text="录像"
|
android:text="录像"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="15sp" />
|
android:textSize="15sp" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_pictures"
|
||||||
|
style="@style/user_style"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="拍照"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="15sp" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user