增加poi录像的连拍
This commit is contained in:
parent
409f2a3879
commit
7d4355a648
@ -28,7 +28,9 @@ import com.github.lazylibrary.util.FileUtils;
|
|||||||
import com.navinfo.outdoor.R;
|
import com.navinfo.outdoor.R;
|
||||||
import com.navinfo.outdoor.api.Constant;
|
import com.navinfo.outdoor.api.Constant;
|
||||||
import com.navinfo.outdoor.base.BaseActivity;
|
import com.navinfo.outdoor.base.BaseActivity;
|
||||||
|
import com.navinfo.outdoor.room.PoiEntity;
|
||||||
import com.navinfo.outdoor.util.AWMp4ParserHelper;
|
import com.navinfo.outdoor.util.AWMp4ParserHelper;
|
||||||
|
import com.navinfo.outdoor.util.GeometryTools;
|
||||||
import com.navinfo.outdoor.util.MyTecentLocationSource;
|
import com.navinfo.outdoor.util.MyTecentLocationSource;
|
||||||
import com.otaliastudios.cameraview.CameraException;
|
import com.otaliastudios.cameraview.CameraException;
|
||||||
import com.otaliastudios.cameraview.CameraListener;
|
import com.otaliastudios.cameraview.CameraListener;
|
||||||
@ -48,11 +50,17 @@ import com.tencent.tencentmap.mapsdk.maps.MapView;
|
|||||||
import com.tencent.tencentmap.mapsdk.maps.TencentMap;
|
import com.tencent.tencentmap.mapsdk.maps.TencentMap;
|
||||||
import com.tencent.tencentmap.mapsdk.maps.TextureMapView;
|
import com.tencent.tencentmap.mapsdk.maps.TextureMapView;
|
||||||
import com.tencent.tencentmap.mapsdk.maps.UiSettings;
|
import com.tencent.tencentmap.mapsdk.maps.UiSettings;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.interfaces.Removable;
|
||||||
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;
|
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;
|
||||||
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
|
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
|
||||||
import com.tencent.tencentmap.mapsdk.maps.model.CameraPosition;
|
import com.tencent.tencentmap.mapsdk.maps.model.CameraPosition;
|
||||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
|
||||||
import com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle;
|
import com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.model.Polyline;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.model.PolylineOptions;
|
||||||
|
import com.vividsolutions.jts.geom.Geometry;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
@ -85,34 +93,45 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
private MyLocationStyle locationStyle;
|
private MyLocationStyle locationStyle;
|
||||||
private TextureMapView ivMap;
|
private TextureMapView ivMap;
|
||||||
private Button stopPicture;
|
private Button stopPicture;
|
||||||
|
private CsvTimerTask timerTask;
|
||||||
|
private List<Removable> removables;
|
||||||
|
private PoiEntity poiEntity;
|
||||||
|
private Polyline polyline;
|
||||||
|
|
||||||
// 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 = 2; // 记录csv文件的间隔时间,单位为秒
|
||||||
private ViewGroup layerChange; // 切换地图和相机的父控件
|
private ViewGroup layerChange; // 切换地图和相机的父控件
|
||||||
// private boolean isFinishActivity = false; // 是否需要关闭当前activity
|
// private boolean isFinishActivity = false; // 是否需要关闭当前activity
|
||||||
private CheckBox capturePicture;//拍照
|
private CheckBox capturePicture;//拍照
|
||||||
private ArrayList<File> pictureList;
|
private ArrayList<File> pictureList;
|
||||||
private Handler handler=new Handler(new Handler.Callback() {
|
private Handler handler = new Handler(new Handler.Callback() {
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMessage(@NonNull Message msg) {
|
public boolean handleMessage(@NonNull Message msg) {
|
||||||
if (msg.what==0&&listenerPicture){
|
if (msg.what == 0 && listenerPicture) {
|
||||||
File file= (File) msg.obj;
|
File file = (File) msg.obj;
|
||||||
pictureList.add(file);
|
pictureList.add(file);
|
||||||
if (camera.isTakingPicture()){
|
if (camera.isTakingPicture()) {
|
||||||
camera.destroy();
|
camera.destroy();
|
||||||
}else {
|
} else {
|
||||||
|
if (timerTask != null) {
|
||||||
|
timerTask.cancel();
|
||||||
|
}
|
||||||
camera.takePicture();
|
camera.takePicture();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (msg.what == 1) {
|
||||||
|
if (btnSwitch != null) {
|
||||||
|
btnSwitch.setEnabled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
private boolean listenerPicture=true;
|
private boolean listenerPicture = true;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -128,14 +147,19 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
super.initView();
|
super.initView();
|
||||||
|
|
||||||
/* if (getIntent()!=null) {
|
/* if (getIntent()!=null) {
|
||||||
finalVideoPath = getIntent().getStringExtra(Constant.INTENT_VIDEO_PATH);
|
|
||||||
}*/
|
}*/
|
||||||
pictureList = new ArrayList<>();
|
pictureList = new ArrayList<>();
|
||||||
|
removables = new ArrayList<>();//存储轨迹的marker
|
||||||
layerChange = findViewById(R.id.layer_change);
|
layerChange = findViewById(R.id.layer_change);
|
||||||
|
if (getIntent() != null) {
|
||||||
|
poiEntity = (PoiEntity) getIntent().getSerializableExtra("poiEntity");
|
||||||
|
finalVideoPath = getIntent().getStringExtra(Constant.INTENT_VIDEO_PATH);
|
||||||
|
}
|
||||||
|
|
||||||
//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);
|
||||||
btnSwitch = (Button) findViewById(R.id.btn_switch);
|
btnSwitch = (Button) findViewById(R.id.btn_switch);
|
||||||
btnSwitch.setOnClickListener(this::onClick);
|
btnSwitch.setOnClickListener(this::onClick);
|
||||||
@ -151,7 +175,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
if (isChecked) { // 开始采集,设置按钮文字内容为“结束采集”
|
if (isChecked) { // 开始采集,设置按钮文字内容为“结束采集”
|
||||||
capturePicture.setText("暂停采集");
|
capturePicture.setText("暂停采集");
|
||||||
listenerPicture= true;
|
listenerPicture = true;
|
||||||
camera.takePicture();
|
camera.takePicture();
|
||||||
} else {
|
} else {
|
||||||
listenerPicture = false;
|
listenerPicture = false;
|
||||||
@ -175,10 +199,10 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
SizeSelector dimensions = SizeSelectors.and(width, height); // Matches sizes bigger than 1000x2000.
|
SizeSelector dimensions = SizeSelectors.and(width, height); // Matches sizes bigger than 1000x2000.
|
||||||
// 获取屏幕信息
|
// 获取屏幕信息
|
||||||
int[] density = DensityUtil.getDeviceInfo(this);
|
int[] density = DensityUtil.getDeviceInfo(this);
|
||||||
int x=1920, y=1440;
|
int x = 1920, y = 1440;
|
||||||
if (density!=null&&density.length>1) {
|
if (density != null && density.length > 1) {
|
||||||
x = (density[0]>=density[1]?density[0]:density[1]);
|
x = (density[0] >= density[1] ? density[0] : density[1]);
|
||||||
y = (density[0]>=density[1]?density[1]:density[0]);
|
y = (density[0] >= density[1] ? density[1] : density[0]);
|
||||||
}
|
}
|
||||||
SizeSelector ratio = SizeSelectors.aspectRatio(AspectRatio.of(x, y), 0); // Matches 1:1 sizes.
|
SizeSelector ratio = SizeSelectors.aspectRatio(AspectRatio.of(x, y), 0); // Matches 1:1 sizes.
|
||||||
|
|
||||||
@ -188,7 +212,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
SizeSelectors.biggest() // If none is found, take the biggest
|
SizeSelectors.biggest() // If none is found, take the biggest
|
||||||
);
|
);
|
||||||
camera.setVideoSize(result);
|
camera.setVideoSize(result);
|
||||||
camera.setVideoBitRate(1920*1440);
|
camera.setVideoBitRate(1920 * 1440);
|
||||||
// camera.setAudioBitRate();
|
// camera.setAudioBitRate();
|
||||||
|
|
||||||
//获取地图
|
//获取地图
|
||||||
@ -199,7 +223,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
uiSettings.setLogoScale(0.7f);
|
uiSettings.setLogoScale(0.7f);
|
||||||
// uiSettings.setAllGesturesEnabled(false);
|
// uiSettings.setAllGesturesEnabled(false);
|
||||||
setLocMarkerStyle(); // 设置当前位置显示样式
|
setLocMarkerStyle(); // 设置当前位置显示样式
|
||||||
|
initLine();
|
||||||
// camera.addFrameProcessor(new FrameProcessor() {
|
// camera.addFrameProcessor(new FrameProcessor() {
|
||||||
// @Override
|
// @Override
|
||||||
// public void process(@NonNull Frame frame) {
|
// public void process(@NonNull Frame frame) {
|
||||||
@ -212,19 +236,23 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
@Override
|
@Override
|
||||||
public void onPictureTaken(@NonNull @NotNull PictureResult result) {
|
public void onPictureTaken(@NonNull @NotNull PictureResult result) {
|
||||||
super.onPictureTaken(result);
|
super.onPictureTaken(result);
|
||||||
Calendar calendar = Calendar.getInstance();
|
|
||||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
|
||||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd HHmmss");
|
|
||||||
String format = formatter.format(calendar.getTime());
|
|
||||||
//文件
|
//文件
|
||||||
File file = new File(Constant.PICTURE_FOLDER, format + ".jpg");
|
File file = new File(finalVideoPath);
|
||||||
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 message = new Message();
|
||||||
message.what=0;
|
message.what = 0;
|
||||||
message.obj=file;
|
message.obj = file;
|
||||||
handler.sendMessageDelayed(message,2000);
|
handler.sendMessageDelayed(message, 2000);
|
||||||
|
File finalVideoFile = new File(finalVideoPath);
|
||||||
|
if (finalVideoFile.exists()&&listenerPicture) {
|
||||||
|
timerTask = new CsvTimerTask(new File(finalVideoPath + ".txt"));
|
||||||
|
timer.schedule(timerTask, 0, period * 1000);
|
||||||
|
int videoIndex = Integer.parseInt(finalVideoFile.getName().replace(".jpg", ""));
|
||||||
|
finalVideoPath = finalVideoFile.getParentFile().getAbsolutePath() + "/" + (videoIndex + 1) + ".jpg";
|
||||||
|
|
||||||
|
}
|
||||||
Toast.makeText(PicturesActivity.this, "保存成功:" + file.getPath(), Toast.LENGTH_SHORT).show();
|
Toast.makeText(PicturesActivity.this, "保存成功:" + file.getPath(), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -292,20 +320,19 @@ 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"));
|
||||||
|
|
||||||
// 开始采集,每隔2秒实时记录位置信息、视频时间以及设备时间
|
// 开始采集,每隔2秒实时记录位置信息、视频时间以及设备时间
|
||||||
if (currentTime == 0) {
|
if (currentTime == 0) {
|
||||||
timer.schedule(timerTask, 0, period*1000);
|
timer.schedule(timerTask, 0, period * 1000);
|
||||||
} else {
|
} else {
|
||||||
timerTask.setCurrentVideoTime(currentTime/1000+1);
|
timerTask.setCurrentVideoTime(currentTime / 1000 + 1);
|
||||||
timer.schedule(timerTask, 1, period*1000);
|
timer.schedule(timerTask, 1, period * 1000);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -323,8 +350,8 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
DisplayMetrics dm = new DisplayMetrics();
|
DisplayMetrics dm = new DisplayMetrics();
|
||||||
getWindowManager().getDefaultDisplay().getMetrics(dm);
|
getWindowManager().getDefaultDisplay().getMetrics(dm);
|
||||||
FrameLayout.LayoutParams layoutParamsMap = (FrameLayout.LayoutParams) ivMap.getLayoutParams();//相机的宽高
|
FrameLayout.LayoutParams layoutParamsMap = (FrameLayout.LayoutParams) ivMap.getLayoutParams();//相机的宽高
|
||||||
layoutParamsMap.height = dm.heightPixels/3;
|
layoutParamsMap.height = dm.heightPixels / 3;
|
||||||
layoutParamsMap.width = dm.widthPixels/3;
|
layoutParamsMap.width = dm.widthPixels / 3;
|
||||||
ivMap.setLayoutParams(layoutParamsMap);
|
ivMap.setLayoutParams(layoutParamsMap);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -339,76 +366,64 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initLine() {
|
||||||
|
String geo = poiEntity.getGeoWkt();
|
||||||
|
if (geo != null) {
|
||||||
|
Geometry geometry = GeometryTools.createGeometry(geo);
|
||||||
|
if (geometry.getGeometryType().equals("LineString")) {//线
|
||||||
|
BitmapDescriptor bitmapLine = null;
|
||||||
|
if (poiEntity.getType() == 3) {//poi录像
|
||||||
|
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_arrows);
|
||||||
|
} else if (poiEntity.getType() == 4) {//道路录像
|
||||||
|
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.road_arrows);
|
||||||
|
}
|
||||||
|
List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
|
||||||
|
// 构造 PolylineOpitons
|
||||||
|
PolylineOptions polylineOptions = new PolylineOptions()
|
||||||
|
.addAll(latLineString)
|
||||||
|
// 折线设置圆形线头
|
||||||
|
.lineCap(true)
|
||||||
|
// 折线的颜色为绿色
|
||||||
|
.color(0xff00ff00)
|
||||||
|
// 折线宽度为5像素
|
||||||
|
.width(20)
|
||||||
|
.arrow(true)
|
||||||
|
.arrowSpacing(150)
|
||||||
|
.arrowTexture(bitmapLine);
|
||||||
|
// 绘制折线
|
||||||
|
polyline = tencentMap.addPolyline(polylineOptions);
|
||||||
|
polyline.setZIndex(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initData() {
|
protected void initData() {
|
||||||
super.initData();
|
super.initData();
|
||||||
camera.setMode(Mode.PICTURE);
|
camera.setMode(Mode.PICTURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
switch (v.getId()) {
|
switch (v.getId()) {
|
||||||
// case R.id.capuretVideo:
|
|
||||||
// DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
||||||
// Calendar calendar = Calendar.getInstance();
|
|
||||||
// calendar.setTimeInMillis(System.currentTimeMillis());
|
|
||||||
// String format = formatter.format(calendar.getTime());
|
|
||||||
// //文件
|
|
||||||
// File file = new File(Constant.PICTURE_FOLDER, format + ".mp4");
|
|
||||||
// cameraView.takeVideo(file, 15000);
|
|
||||||
// break;
|
|
||||||
case R.id.btn_stop_picture:
|
case R.id.btn_stop_picture:
|
||||||
/* if (camera.isTakingPicture()) {
|
if (timerTask != null) {
|
||||||
|
timerTask.cancel();
|
||||||
} else {
|
}
|
||||||
|
|
||||||
}*/
|
|
||||||
camera.destroy();
|
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.putExtra(Constant.INTENT_VIDEO_PATH,pictureList );
|
intent.putExtra(Constant.INTENT_PICTURES_PATH, pictureList);
|
||||||
setResult(0x102, intent);
|
setResult(0x102, intent);
|
||||||
finish();
|
finish();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case R.id.btn_switch:
|
case R.id.btn_switch:
|
||||||
|
v.setEnabled(false);
|
||||||
|
handler.sendEmptyMessageDelayed(1, 2000); // 利用handler延迟发送更改状态信息
|
||||||
btnSwich();
|
btnSwich();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* 开始采集
|
|
||||||
*/
|
|
||||||
private void startTakenVideo() {
|
|
||||||
if (camera.isTakingVideo()) {
|
|
||||||
Toast.makeText(this, "已经在拍摄中...", Toast.LENGTH_SHORT).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
||||||
Calendar calendar = Calendar.getInstance();
|
|
||||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
|
||||||
String formatVideoName = formatter.format(calendar.getTime());
|
|
||||||
//文件
|
|
||||||
File file = new File(Constant.PICTURE_FOLDER, formatVideoName + ".mp4");
|
|
||||||
if (file.exists()) {
|
|
||||||
try {
|
|
||||||
FileOutputStream fo = new FileOutputStream(file);
|
|
||||||
FileDescriptor fileDescriptor = fo.getFD();
|
|
||||||
camera.takeVideo(fileDescriptor);
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
camera.takeVideo(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void stopTakenVideo() {
|
|
||||||
if (camera.isTakingVideo()) {
|
|
||||||
camera.stopVideo();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private Bitmap getBitMap(int resourceId) {
|
private Bitmap getBitMap(int resourceId) {
|
||||||
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), resourceId);
|
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), resourceId);
|
||||||
int width = bitmap.getWidth();
|
int width = bitmap.getWidth();
|
||||||
@ -479,7 +494,6 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
@ -498,9 +512,19 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
stopTakenVideo();
|
// stopTakenVideo();
|
||||||
camera.destroy();
|
camera.destroy();
|
||||||
// timer.cancel();
|
if (polyline != null) {
|
||||||
|
polyline.remove();
|
||||||
|
}
|
||||||
|
if (timerTask != null) {
|
||||||
|
timerTask.cancel();
|
||||||
|
}
|
||||||
|
for (int i = 0; i < removables.size(); i++) {
|
||||||
|
removables.get(i).remove();
|
||||||
|
}
|
||||||
|
removables.clear();
|
||||||
|
// timer.cancel();
|
||||||
if (EventBus.getDefault().isRegistered(this)) {
|
if (EventBus.getDefault().isRegistered(this)) {
|
||||||
EventBus.getDefault().unregister(this);
|
EventBus.getDefault().unregister(this);
|
||||||
}
|
}
|
||||||
@ -511,10 +535,10 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
public void onEventMessageMainThread(Message msg) {
|
public void onEventMessageMainThread(Message msg) {
|
||||||
switch (msg.what) {
|
switch (msg.what) {
|
||||||
case Constant.EVENT_WHAT_LOCATION_CHANGE: // 用户位置更新
|
case Constant.EVENT_WHAT_LOCATION_CHANGE: // 用户位置更新
|
||||||
if (tencentMap!=null) {
|
if (tencentMap != null) {
|
||||||
CameraUpdate cameraSigma =
|
CameraUpdate cameraSigma =
|
||||||
CameraUpdateFactory.newCameraPosition(new CameraPosition(
|
CameraUpdateFactory.newCameraPosition(new CameraPosition(
|
||||||
new LatLng(Constant.currentLocation.getLatitude(),Constant.currentLocation.getLongitude()), //中心点坐标,地图目标经纬度
|
new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), //中心点坐标,地图目标经纬度
|
||||||
16, //目标缩放级别
|
16, //目标缩放级别
|
||||||
0, //目标倾斜角
|
0, //目标倾斜角
|
||||||
0)); //目标旋转角 0~360° (正北方为0)
|
0)); //目标旋转角 0~360° (正北方为0)
|
||||||
@ -546,16 +570,21 @@ 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(",");
|
||||||
sb.append(Constant.currentLocation.getLatitude());
|
sb.append(Constant.currentLocation.getLatitude());
|
||||||
sb.append(",");
|
sb.append(",");
|
||||||
sb.append(Constant.currentLocation.getLongitude());
|
sb.append(Constant.currentLocation.getLongitude());
|
||||||
sb.append("\r\n");
|
sb.append("\r\n");
|
||||||
|
LatLng latLng = new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude());
|
||||||
|
BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.circle);
|
||||||
|
Marker marker = tencentMap.addMarker(new MarkerOptions(latLng).icon(pileDescriptor).alpha(0.9f)
|
||||||
|
.flat(true)
|
||||||
|
.clockwise(false));
|
||||||
|
removables.add(marker);
|
||||||
FileUtils.writeFile(csvFile.getAbsolutePath(), sb.toString(), true);
|
FileUtils.writeFile(csvFile.getAbsolutePath(), sb.toString(), true);
|
||||||
// currentVideoTime = currentVideoTime+period; //
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -94,25 +94,14 @@ public class StaySubmitAdapter extends RecyclerView.Adapter<StaySubmitAdapter.Vi
|
|||||||
poiEntity.setChecked(!poiEntity.isChecked());
|
poiEntity.setChecked(!poiEntity.isChecked());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (poiEntity.getIsLocalData() == 1){
|
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||||
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
@Override
|
||||||
@Override
|
public void onClick(View v) {
|
||||||
public void onClick(View v) {
|
if (onClickItem != null) {
|
||||||
if (onClickItem!=null){
|
onClickItem.item(position, poiEntity);
|
||||||
onClickItem.item(position,poiEntity);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}else {
|
});
|
||||||
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
if (onClickItem!=null){
|
|
||||||
onClickItem.item(position,poiEntity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -147,7 +136,7 @@ public class StaySubmitAdapter extends RecyclerView.Adapter<StaySubmitAdapter.Vi
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public onClickItem onClickItem ;
|
public onClickItem onClickItem;
|
||||||
|
|
||||||
public void setOnClickItem(StaySubmitAdapter.onClickItem onClickItem) {
|
public void setOnClickItem(StaySubmitAdapter.onClickItem onClickItem) {
|
||||||
this.onClickItem = onClickItem;
|
this.onClickItem = onClickItem;
|
||||||
|
@ -165,6 +165,7 @@ public class Constant {
|
|||||||
public static MapView treasureMap;
|
public static MapView treasureMap;
|
||||||
|
|
||||||
public static final String INTENT_VIDEO_PATH = "INTENT_VIDEO_PATH"; // 拍照界面指定的视频文件保存位置
|
public static final String INTENT_VIDEO_PATH = "INTENT_VIDEO_PATH"; // 拍照界面指定的视频文件保存位置
|
||||||
|
public static final String INTENT_PICTURES_PATH = "INTENT_VIDEO_PATH"; // 拍照界面指定的视频文件保存位置
|
||||||
public static final String INTENT_VIDEO_ORATATION = "INTENT_VIDEO_ORATATION"; // 视频拍摄时屏幕方向 0-强制横屏 其他-任意
|
public static final String INTENT_VIDEO_ORATATION = "INTENT_VIDEO_ORATATION"; // 视频拍摄时屏幕方向 0-强制横屏 其他-任意
|
||||||
|
|
||||||
public static SlidingUpPanelLayout SLIDING_LAYOUT = null;//設置
|
public static SlidingUpPanelLayout SLIDING_LAYOUT = null;//設置
|
||||||
|
@ -1622,7 +1622,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
poiEntity.setExistence(existence);
|
poiEntity.setExistence(existence);
|
||||||
poiEntity.setType(2);
|
poiEntity.setType(2);
|
||||||
poiEntity.setTaskStatus(2);
|
poiEntity.setTaskStatus(2);
|
||||||
poiEntity.setIsLocalData(1);
|
|
||||||
return poiEntity;
|
return poiEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,7 +325,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
|||||||
}
|
}
|
||||||
chargingStationEntity.setType(Integer.valueOf(stationBean.getType()));
|
chargingStationEntity.setType(Integer.valueOf(stationBean.getType()));
|
||||||
chargingStationEntity.setTaskStatus(statusId);
|
chargingStationEntity.setTaskStatus(statusId);
|
||||||
chargingStationEntity.setIsLocalData(1);
|
|
||||||
|
|
||||||
String encodeStr = stationBean.getGeo();
|
String encodeStr = stationBean.getGeo();
|
||||||
String geo = Geohash.getInstance().decode(encodeStr);
|
String geo = Geohash.getInstance().decode(encodeStr);
|
||||||
@ -688,7 +687,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
|||||||
poiListEntity.setType(Integer.valueOf(listBean.getType()));
|
poiListEntity.setType(Integer.valueOf(listBean.getType()));
|
||||||
poiListEntity.setIsExclusive(listBean.getIsExclusive());
|
poiListEntity.setIsExclusive(listBean.getIsExclusive());
|
||||||
poiListEntity.setTaskStatus(statusId);
|
poiListEntity.setTaskStatus(statusId);
|
||||||
poiListEntity.setIsLocalData(1);
|
|
||||||
String encodeStr = listBean.getGeo();
|
String encodeStr = listBean.getGeo();
|
||||||
String geo = Geohash.getInstance().decode(encodeStr);
|
String geo = Geohash.getInstance().decode(encodeStr);
|
||||||
poiListEntity.setGeoWkt(geo);
|
poiListEntity.setGeoWkt(geo);
|
||||||
@ -812,7 +810,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
|||||||
poiListEntity.setPrecision(String.valueOf(listBean.getPrice()));
|
poiListEntity.setPrecision(String.valueOf(listBean.getPrice()));
|
||||||
poiListEntity.setIsExclusive(listBean.getIsExclusive());
|
poiListEntity.setIsExclusive(listBean.getIsExclusive());
|
||||||
poiListEntity.setTaskStatus(statusId);
|
poiListEntity.setTaskStatus(statusId);
|
||||||
poiListEntity.setIsLocalData(1);
|
|
||||||
String encodeStr = listBean.getGeo();
|
String encodeStr = listBean.getGeo();
|
||||||
String geo = Geohash.getInstance().decode(encodeStr);
|
String geo = Geohash.getInstance().decode(encodeStr);
|
||||||
poiListEntity.setGeoWkt(geo);
|
poiListEntity.setGeoWkt(geo);
|
||||||
|
@ -754,7 +754,6 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
poiEntity.setCreateTime(format);
|
poiEntity.setCreateTime(format);
|
||||||
poiEntity.setType(5);
|
poiEntity.setType(5);
|
||||||
poiEntity.setTaskStatus(2);
|
poiEntity.setTaskStatus(2);
|
||||||
poiEntity.setIsLocalData(1);
|
|
||||||
return poiEntity;
|
return poiEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1186,7 +1186,6 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
poiEntity.setExistence(existence);
|
poiEntity.setExistence(existence);
|
||||||
poiEntity.setType(1);
|
poiEntity.setType(1);
|
||||||
poiEntity.setTaskStatus(2);
|
poiEntity.setTaskStatus(2);
|
||||||
poiEntity.setIsLocalData(1);
|
|
||||||
return poiEntity;
|
return poiEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,6 +107,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
private LatLng latLng;
|
private LatLng latLng;
|
||||||
private Marker markerPoiVideo;
|
private Marker markerPoiVideo;
|
||||||
private TextView tvPicture;
|
private TextView tvPicture;
|
||||||
|
private int isRequest;
|
||||||
|
|
||||||
public static PoiVideoFragment newInstance(Bundle bundle) {
|
public static PoiVideoFragment newInstance(Bundle bundle) {
|
||||||
PoiVideoFragment fragment = new PoiVideoFragment();
|
PoiVideoFragment fragment = new PoiVideoFragment();
|
||||||
@ -251,47 +252,41 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
etDesc.setText(describe + "");
|
etDesc.setText(describe + "");
|
||||||
}
|
}
|
||||||
String photoList = showPoiEntity.getPhoto();
|
String photoList = showPoiEntity.getPhoto();
|
||||||
if (showPoiEntity.getPhotoInfo()!=null&&photoList==null){
|
int record_way = showPoiEntity.getRecord_way();
|
||||||
tvPicture.setEnabled(false);
|
if (record_way == 1) {//录像
|
||||||
ArrayList<File> files = new ArrayList<>();
|
isRequest = 0x101;
|
||||||
List<Info> list = showPoiEntity.getPhotoInfo();
|
|
||||||
for (int i = 0; i < list.size(); i++) {
|
|
||||||
files.add(new File(list.get(i).getPhoto()));
|
|
||||||
}
|
|
||||||
if (files!=null){
|
|
||||||
Uri uri = Uri.fromFile(files.get(0));
|
|
||||||
Glide.with(getContext()).load(uri).into(ivPoiVideoPicture);
|
|
||||||
fmPoiVideoPic.setTag(files);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}else if (showPoiEntity.getPhotoInfo()==null&&photoList!=null){
|
|
||||||
tvPictures.setEnabled(false);
|
|
||||||
if (!StringUtils.isEmpty(photoList)) {
|
if (!StringUtils.isEmpty(photoList)) {
|
||||||
String[] photos = photoList.split(",");
|
|
||||||
List<File> videoFileList = new ArrayList<>();
|
|
||||||
boolean isImageLoad = false;
|
boolean isImageLoad = false;
|
||||||
if (photos != null && photos.length > 0) {
|
List<File> videoFileListByUUID = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(showPoiEntity.getId());
|
||||||
for (int i = 0; i < photos.length; i++) {
|
for (int i = 0; i < videoFileListByUUID.size(); i++) {
|
||||||
String photo = photos[i];
|
if (videoFileListByUUID.get(i).getPath().contains("0.mp4") && !videoFileListByUUID.get(i).getPath().contains("0.mp4.txt")) {
|
||||||
if (!StringUtils.isEmpty(photo)) {
|
if (videoFileListByUUID.get(i).exists() && !isImageLoad) {
|
||||||
File videoFile = new File(photo);
|
// 使用glide加载视频的第一帧
|
||||||
videoFileList.add(new File(photo));
|
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFileListByUUID.get(i)).toString(), ivPoiVideoPicture, 500);
|
||||||
if (videoFile.getPath().contains("0.mp4") && !videoFile.getPath().contains("0.mp4.txt")) {
|
isImageLoad = true;
|
||||||
if (videoFile.exists() && !isImageLoad) {
|
|
||||||
// 使用glide加载视频的第一帧
|
|
||||||
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivPoiVideoPicture, 500);
|
|
||||||
isImageLoad = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
fmPoiVideoPic.setTag(videoFileList);
|
}
|
||||||
|
fmPoiVideoPic.setTag(videoFileListByUUID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (record_way == 2) {//连拍
|
||||||
|
isRequest = 0x102;
|
||||||
|
if (!StringUtils.isEmpty(photoList)) {
|
||||||
|
boolean isImageLoad = false;
|
||||||
|
List<File> pictureFileListByUUID = AWMp4ParserHelper.getInstance().getJPGFileListByUUID(showPoiEntity.getId());
|
||||||
|
for (int i = 0; i < pictureFileListByUUID.size(); i++) {
|
||||||
|
if (pictureFileListByUUID.get(i).getPath().contains("0.jpg") && !pictureFileListByUUID.get(i).getPath().contains("0.jpg.txt")) {
|
||||||
|
if (pictureFileListByUUID.get(i).exists() && !isImageLoad) {
|
||||||
|
// 使用glide加载视频的第一帧
|
||||||
|
Glide.with(getActivity()).load(pictureFileListByUUID.get(i)).into(ivPoiVideoPicture);
|
||||||
|
isImageLoad = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fmPoiVideoPic.setTag(pictureFileListByUUID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//判断是否是已做完任务并保存成功
|
//判断是否是已做完任务并保存成功
|
||||||
if (showPoiEntity.getTaskStatus() == 3) {
|
if (showPoiEntity.getTaskStatus() == 3) {
|
||||||
@ -332,6 +327,9 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
case R.id.tv_pictures://拍照
|
case R.id.tv_pictures://拍照
|
||||||
tvPicture.setEnabled(false);
|
tvPicture.setEnabled(false);
|
||||||
Intent intents = new Intent(getContext(), PicturesActivity.class);
|
Intent intents = new Intent(getContext(), PicturesActivity.class);
|
||||||
|
File filePath = AWMp4ParserHelper.getInstance().obtainJPGFilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
|
||||||
|
intents.putExtra(Constant.INTENT_VIDEO_PATH, filePath.getAbsolutePath());
|
||||||
|
intents.putExtra("poiEntity", showPoiEntity);
|
||||||
startActivityForResult(intents, 0x102);
|
startActivityForResult(intents, 0x102);
|
||||||
break;
|
break;
|
||||||
case R.id.tv_picture://录像
|
case R.id.tv_picture://录像
|
||||||
@ -553,8 +551,8 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
@Override
|
@Override
|
||||||
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
|
||||||
if (requestCode == 0x101 && resultCode == 0x101) {
|
if (requestCode == 0x101 && resultCode == 0x101) {
|
||||||
|
isRequest = 0x101;
|
||||||
if (data != null && data.hasExtra(Constant.INTENT_VIDEO_PATH)) {
|
if (data != null && data.hasExtra(Constant.INTENT_VIDEO_PATH)) {
|
||||||
String videoPath = data.getStringExtra(Constant.INTENT_VIDEO_PATH);
|
String videoPath = data.getStringExtra(Constant.INTENT_VIDEO_PATH);
|
||||||
File videoFile = new File(videoPath);
|
File videoFile = new File(videoPath);
|
||||||
@ -565,14 +563,14 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (requestCode == 0x102 && resultCode == 0x102) {
|
} else if (requestCode == 0x102 && resultCode == 0x102) {
|
||||||
if (data != null) {
|
isRequest =0x102;
|
||||||
List<File> serializableExtra = (List<File>) data.getSerializableExtra(Constant.INTENT_VIDEO_PATH);
|
if (data != null && data.hasExtra(Constant.INTENT_PICTURES_PATH)) {
|
||||||
if (serializableExtra!=null){
|
ArrayList<File> serializableExtra = (ArrayList<File>) data.getSerializableExtra(Constant.INTENT_PICTURES_PATH);
|
||||||
Uri uri = Uri.fromFile(serializableExtra.get(0));
|
if (serializableExtra != null) {
|
||||||
Glide.with(getContext()).load(uri).into(ivPoiVideoPicture);
|
Glide.with(getActivity()).load(serializableExtra.get(0)).into(ivPoiVideoPicture);
|
||||||
fmPoiVideoPic.setTag(serializableExtra);
|
List<File> pictureFileListByUUID = AWMp4ParserHelper.getInstance().getJPGFileListByUUID(showPoiEntity.getId());
|
||||||
|
fmPoiVideoPic.setTag(pictureFileListByUUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -750,9 +748,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
poiEntity.setCreateTime(format);
|
poiEntity.setCreateTime(format);
|
||||||
poiEntity.setType(3);
|
poiEntity.setType(3);
|
||||||
poiEntity.setTaskStatus(2);
|
poiEntity.setTaskStatus(2);
|
||||||
poiEntity.setIsLocalData(1);
|
if (isRequest==0x101){
|
||||||
|
|
||||||
if (tvPicture.isEnabled()){
|
|
||||||
if (fmPoiVideoPic.getTag() == null) {
|
if (fmPoiVideoPic.getTag() == null) {
|
||||||
List<File> videoFileListByUUID = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(showPoiEntity.getId());
|
List<File> videoFileListByUUID = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(showPoiEntity.getId());
|
||||||
if (videoFileListByUUID != null) {
|
if (videoFileListByUUID != null) {
|
||||||
@ -768,16 +764,25 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
if (lineString != null) {
|
if (lineString != null) {
|
||||||
poiEntity.setGeoWkt(lineString);
|
poiEntity.setGeoWkt(lineString);
|
||||||
}
|
}
|
||||||
|
poiEntity.setRecord_way(1);//录像
|
||||||
}
|
}
|
||||||
}
|
}else if (isRequest==0x102){
|
||||||
if (tvPictures.isEnabled()){
|
if (fmPoiVideoPic.getTag() == null) {
|
||||||
if (fmPoiVideoPic.getTag() != null && !((List<File>) fmPoiVideoPic.getTag()).isEmpty()) {
|
List<File> pictureFileListByUUID = AWMp4ParserHelper.getInstance().getJPGFileListByUUID(showPoiEntity.getId());
|
||||||
ArrayList<Info> infos = new ArrayList<>();
|
if (pictureFileListByUUID != null) {
|
||||||
List<File> poiVideoPic = (List<File>) fmPoiVideoPic.getTag();
|
fmPoiVideoPic.setTag(pictureFileListByUUID);
|
||||||
for (int i = 0; i < poiVideoPic.size(); i++) {
|
|
||||||
infos.add(new Info(poiVideoPic.get(i).getPath()));
|
|
||||||
}
|
}
|
||||||
poiEntity.setPhotoInfo(infos);
|
}
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
poiEntity.setRecord_way(2);//录像
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return poiEntity;
|
return poiEntity;
|
||||||
@ -787,7 +792,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
protected PoiCheckResult checkPoiEntity(PoiEntity entity) {
|
protected PoiCheckResult checkPoiEntity(PoiEntity entity) {
|
||||||
PoiCheckResult poiCheckResult = new PoiCheckResult();
|
PoiCheckResult poiCheckResult = new PoiCheckResult();
|
||||||
if (tvPicture.isEnabled()) {
|
if (tvPicture.isEnabled()) {
|
||||||
if (tvPictures.isEnabled()){
|
if (tvPictures.isEnabled()) {
|
||||||
poiCheckResult.setCode(1);
|
poiCheckResult.setCode(1);
|
||||||
poiCheckResult.setMsg("请录像");
|
poiCheckResult.setMsg("请录像");
|
||||||
return poiCheckResult;
|
return poiCheckResult;
|
||||||
@ -795,7 +800,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
|
|
||||||
}
|
}
|
||||||
if (tvPictures.isEnabled()) {
|
if (tvPictures.isEnabled()) {
|
||||||
if (tvPicture.isEnabled()){
|
if (tvPicture.isEnabled()) {
|
||||||
poiCheckResult.setCode(1);
|
poiCheckResult.setCode(1);
|
||||||
poiCheckResult.setMsg("请拍照");
|
poiCheckResult.setMsg("请拍照");
|
||||||
return poiCheckResult;
|
return poiCheckResult;
|
||||||
|
@ -742,7 +742,6 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
|||||||
poiEntity.setCreateTime(format);
|
poiEntity.setCreateTime(format);
|
||||||
poiEntity.setType(4);
|
poiEntity.setType(4);
|
||||||
poiEntity.setTaskStatus(2);
|
poiEntity.setTaskStatus(2);
|
||||||
poiEntity.setIsLocalData(1);
|
|
||||||
if (fmRoadPic.getTag() == null) {
|
if (fmRoadPic.getTag() == null) {
|
||||||
List<File> videoFileListByUUID = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(showPoiEntity.getId());
|
List<File> videoFileListByUUID = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(showPoiEntity.getId());
|
||||||
if (videoFileListByUUID != null) {
|
if (videoFileListByUUID != null) {
|
||||||
|
@ -44,11 +44,19 @@ public class PoiEntity implements Serializable {
|
|||||||
private String dist;//距离用户位置
|
private String dist;//距离用户位置
|
||||||
private int taskStatus;//任务状态 0.未领取 1.已领取,5 立即采集,2.未保存(保存到本地但未提交成功),3.已保存(保存到本地提交成功),4已上传(结束采集)
|
private int taskStatus;//任务状态 0.未领取 1.已领取,5 立即采集,2.未保存(保存到本地但未提交成功),3.已保存(保存到本地提交成功),4已上传(结束采集)
|
||||||
private int type;//1 "POI"2 "充电站"3 "POI录像"4 "道路录像"5 "其他"6 "面状任务"
|
private int type;//1 "POI"2 "充电站"3 "POI录像"4 "道路录像"5 "其他"6 "面状任务"
|
||||||
private int station_type;//1."充电站"2 "充换电站"3 "充电桩组"4 "换电站"5 "门牌", "公交:6 情报:7
|
private int station_type;//1."充电站"2 "充换电站"3 "充电桩组"4 "换电站"7 "门牌", "公交:8 情报:9
|
||||||
private int isLocalData;//是否是本地数据 0,服务 1,本地
|
|
||||||
private int isExclusive;//任务类型 0.普通任务,1.专属任务
|
private int isExclusive;//任务类型 0.普通任务,1.专属任务
|
||||||
private int bodyId;//保存本地的bodyId
|
private int bodyId;//保存本地的bodyId
|
||||||
private int work_type;//0."车行" 1."自行车" 2."步行"
|
private int work_type;//0."车行" 1."自行车" 2."步行"
|
||||||
|
private int record_way; //1,录像,2,连拍
|
||||||
|
|
||||||
|
public int getRecord_way() {
|
||||||
|
return record_way;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRecord_way(int record_way) {
|
||||||
|
this.record_way = record_way;
|
||||||
|
}
|
||||||
|
|
||||||
public int getWork_type() {
|
public int getWork_type() {
|
||||||
return work_type;
|
return work_type;
|
||||||
@ -90,13 +98,6 @@ public class PoiEntity implements Serializable {
|
|||||||
this.isExclusive = isExclusive;
|
this.isExclusive = isExclusive;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getIsLocalData() {
|
|
||||||
return isLocalData;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsLocalData(int isLocalData) {
|
|
||||||
this.isLocalData = isLocalData;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDist() {
|
public String getDist() {
|
||||||
return dist;
|
return dist;
|
||||||
|
@ -254,6 +254,44 @@ public class AWMp4ParserHelper {
|
|||||||
return new File(folderPath+"/"+(maxIndex+1)+".mp4");
|
return new File(folderPath+"/"+(maxIndex+1)+".mp4");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据文件夹路径生成最新的视频文件路径
|
||||||
|
* */
|
||||||
|
public File obtainJPGFilePath(String folderPath) {
|
||||||
|
if (folderPath == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
File folderFile = new File(folderPath);
|
||||||
|
if (!folderFile.exists()) {
|
||||||
|
folderFile.mkdirs();
|
||||||
|
}
|
||||||
|
File[] fileList = folderFile.listFiles(new FileFilter() {
|
||||||
|
@Override
|
||||||
|
public boolean accept(File pathname) {
|
||||||
|
if (pathname.getName().endsWith(".jpg")){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (fileList == null || fileList.length==0) {
|
||||||
|
return new File(folderPath+"/0.jpg");
|
||||||
|
}
|
||||||
|
int maxIndex = 0;
|
||||||
|
for (int i = 0; i < fileList.length; i++) {
|
||||||
|
File file = fileList[i];
|
||||||
|
if (file!=null) {
|
||||||
|
int index = Integer.parseInt(file.getName().replace(".jpg", ""));
|
||||||
|
if (index>=maxIndex) {
|
||||||
|
maxIndex = index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new File(folderPath+"/"+(maxIndex+1)+".jpg");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据提供的uuid,获取指定目录下所有的视频文件
|
* 根据提供的uuid,获取指定目录下所有的视频文件
|
||||||
* */
|
* */
|
||||||
@ -272,7 +310,24 @@ public class AWMp4ParserHelper {
|
|||||||
}
|
}
|
||||||
return videoFileList;
|
return videoFileList;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 根据提供的uuid,获取指定目录下所有的视频文件
|
||||||
|
* */
|
||||||
|
public List<File> getJPGFileListByUUID(String uuid) {
|
||||||
|
List<File> videoFileList = new ArrayList<>();
|
||||||
|
if (StringUtils.isEmpty(uuid)) {
|
||||||
|
return videoFileList;
|
||||||
|
}
|
||||||
|
File folderFile = new File(Constant.PICTURE_FOLDER+"/"+uuid+"/");
|
||||||
|
if (!folderFile.exists()) {
|
||||||
|
folderFile.mkdirs();
|
||||||
|
return videoFileList;
|
||||||
|
}
|
||||||
|
for (File videoFile: folderFile.listFiles()) {
|
||||||
|
videoFileList.add(videoFile);
|
||||||
|
}
|
||||||
|
return videoFileList;
|
||||||
|
}
|
||||||
public String getVideoFileListStr(List<File> videoFileList) {
|
public String getVideoFileListStr(List<File> videoFileList) {
|
||||||
StringBuilder resultStrBuilder = new StringBuilder("");
|
StringBuilder resultStrBuilder = new StringBuilder("");
|
||||||
if (videoFileList == null || videoFileList.size()<=0){
|
if (videoFileList == null || videoFileList.size()<=0){
|
||||||
@ -298,6 +353,36 @@ public class AWMp4ParserHelper {
|
|||||||
return latLngs;
|
return latLngs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int m = 0; m < videoFileList.size(); m++) {
|
||||||
|
File videoFile = videoFileList.get(m);
|
||||||
|
|
||||||
|
String path = videoFile.getPath() + ".txt";
|
||||||
|
List<String> strings = FileUtils.readFileToList(path, "utf-8");
|
||||||
|
if (strings!=null) {
|
||||||
|
for (int i = 0; i < strings.size(); i++) {
|
||||||
|
String[] split = strings.get(i).split(",");
|
||||||
|
LatLng latLng = new LatLng();
|
||||||
|
latLng.setLatitude(Double.valueOf(split[2]));
|
||||||
|
latLng.setLongitude(Double.valueOf(split[3]));
|
||||||
|
latLngs.add(latLng);
|
||||||
|
}
|
||||||
|
if (strings.size() == 1) {
|
||||||
|
LatLng latLng = latLngs.get(0);
|
||||||
|
latLngs.add(latLng);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return latLngs;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 根据视频文件列表,获取到对应的轨迹数据
|
||||||
|
* */
|
||||||
|
public List<LatLng> getLineStringByPictureFileList(List<File> videoFileList) {
|
||||||
|
List<LatLng> latLngs = new ArrayList<>();
|
||||||
|
if (videoFileList == null || videoFileList.isEmpty()) {
|
||||||
|
return latLngs;
|
||||||
|
}
|
||||||
|
|
||||||
for (int m = 0; m < videoFileList.size(); m++) {
|
for (int m = 0; m < videoFileList.size(); m++) {
|
||||||
File videoFile = videoFileList.get(m);
|
File videoFile = videoFileList.get(m);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user