修改录像功能

This commit is contained in:
wangdongsheng 2021-08-23 17:06:59 +08:00
parent a5f91bf1b0
commit 7a68019c7f
6 changed files with 149 additions and 236 deletions

View File

@ -212,7 +212,8 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
* app:cameraVideoSizeMaxWidth="2000"
* app:cameraVideoSizeMaxArea="2000000"
*/
camera.setVideoBitRate(2000000);
camera.setVideoBitRate(2100000);
//获取地图
tencentMap = ivMap.getMap();

View File

@ -93,78 +93,64 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
private MyLocationStyle locationStyle;
private TextureMapView ivMap;
private Button stopPicture;
private CsvTimerTask timerTask;
private List<Removable> removables;
private PoiEntity poiEntity;
private Polyline polyline;
private String finalVideoPath; // 摄像后最终保存的文件名
// private File tmpFile; // 合并文件的临时文件路径
private Timer timer;
// private CsvTimerTask timerTask; // 执行定时写入csv文件的task
// private DateFormat formatter;
private final long period = 2; // 记录csv文件的间隔时间单位为秒
private ViewGroup layerChange; // 切换地图和相机的父控件
// 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) {
if (msg.what == 0x101 && listenerPicture) {
File file = (File) msg.obj;
pictureList.add(file);
if (camera.isTakingPicture()) {
camera.destroy();
} else {
if (timerTask != null) {
timerTask.cancel();
}
camera.takePicture();
}
} else if (msg.what == 1) {
camera.takePicture();
} else if (msg.what == 0x102) {
if (btnSwitch != null) {
btnSwitch.setEnabled(true);
}
} else if (msg.what == 0x103) {
File file = (File) msg.obj;
pictureList.add(file);
listenerPicture = false;
capturePicture.setText("开始采集");
capturePicture.setChecked(false);
}
return false;
}
});
private boolean listenerPicture = true;
private boolean listenerPicture = false;
private SimpleDateFormat formatter;
private File paperFile;
private int type;
private int videoIndex;
@Override
protected int getLayout() {
/* EventBus.getDefault().register(this);
tmpFile = new File(Constant.PICTURE_FOLDER, "temp.mp4");
formatter = new SimpleDateFormat("yyyyMMdd HHmmss");*/
EventBus.getDefault().register(this);
return R.layout.activity_pictures;
}
@Override
protected void initView() {
super.initView();
/* if (getIntent()!=null) {
}*/
pictureList = new ArrayList<>();
removables = new ArrayList<>();//存储轨迹的marker
layerChange = findViewById(R.id.layer_change);
if (getIntent() != null) {
poiEntity = (PoiEntity) getIntent().getSerializableExtra("poiEntity");
finalVideoPath = getIntent().getStringExtra(Constant.INTENT_VIDEO_PATH);
type = getIntent().getIntExtra("type", 0);
finalVideoPath = getIntent().getStringExtra(Constant.INTENT_JPG_PATH);
File file = new File(finalVideoPath);
paperFile = new File(file.getParentFile().getAbsoluteFile() + "/" + "paper.txt");
}
timer = new Timer();
// this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
formatter = new SimpleDateFormat("yyyyMMdd HHmmss");
ivMap = (TextureMapView) findViewById(R.id.iv_map);
btnSwitch = (Button) findViewById(R.id.btn_switch);
btnSwitch.setOnClickListener(this::onClick);
// capturePicture = (ImageButton) findViewById(R.id.capturePicture);
// capturePicture.setOnClickListener(this::onClick);
//相机记录器
CameraLogger.setLogLevel(CameraLogger.LEVEL_VERBOSE);
camera = findViewById(R.id.camera);
@ -180,6 +166,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
} else {
listenerPicture = false;
capturePicture.setText("开始采集");
}
}
});
@ -192,47 +179,51 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
UiSettings uiSettings = tencentMap.getUiSettings();
//设置logo的大小
uiSettings.setLogoScale(0.7f);
// uiSettings.setAllGesturesEnabled(false);
setLocMarkerStyle(); // 设置当前位置显示样式
initLine();
// camera.addFrameProcessor(new FrameProcessor() {
// @Override
// public void process(@NonNull Frame frame) {
// Log.e("PictureActivity", frame.getTime()+"");
// }
// });
//相机预览监听
camera.addCameraListener(new CameraListener() {
@Override
public void onPictureTaken(@NonNull @NotNull PictureResult result) {
super.onPictureTaken(result);
//文件
File file = new File(finalVideoPath);
result.toFile(file, new FileCallback() {
@Override
public void onFileReady(@Nullable @org.jetbrains.annotations.Nullable File file) {
Message message = new Message();
message.what = 0;
message.obj = file;
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";
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) {
if (file.exists()) {
videoIndex = Integer.parseInt(file.getName().replace(".jpg", ""));
finalVideoPath = file.getParentFile().getAbsolutePath() + "/" + (videoIndex + 1) + ".jpg";
}
initMarkerPaper();
Message message = new Message();
if (type == 3) {
message.what = 0x103;
message.obj = file;
handler.sendMessageDelayed(message, 0);
Toast.makeText(PicturesActivity.this, "保存成功:" + file.getPath(), Toast.LENGTH_SHORT).show();
} else {
message.what = 0x101;
message.obj = file;
Toast.makeText(PicturesActivity.this, "保存成功" + file.getPath(), Toast.LENGTH_SHORT).show();
handler.sendMessageDelayed(message, 2000);
}
}
}
Toast.makeText(PicturesActivity.this, "保存成功:" + file.getPath(), Toast.LENGTH_SHORT).show();
});
if (camera.isTakingVideo()) {
message("Captured while taking video. Size=" + result.getSize(), false);
}
});
if (camera.isTakingVideo()) {
message("Captured while taking video. Size=" + result.getSize(), false);
long callbackTime = System.currentTimeMillis();
captureTime = callbackTime - 300;
Log.d("captureTime", captureTime + "");
}
long callbackTime = System.currentTimeMillis();
captureTime = callbackTime - 300;
Log.d("captureTime", captureTime + "");
}
//录像监听
@ -240,46 +231,6 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
public void onVideoTaken(@NonNull @NotNull VideoResult result) {
super.onVideoTaken(result);
Toast.makeText(PicturesActivity.this, "暂停摄像", Toast.LENGTH_SHORT).show();
//showLoadingDialog();
/* new Thread(new Runnable() {
@Override
public void run() {
if (result!=null) {
File currentFile = result.getFile();
if (finalVideoPath!=null) { // 有指定的视频文件名称合并文件
if (new File(finalVideoPath).exists()) {
List<String> spliteFileList = new ArrayList<>();
spliteFileList.add(finalVideoPath);
spliteFileList.add(currentFile.getAbsolutePath());
try {
AWMp4ParserHelper.getInstance().mergeVideos(spliteFileList, tmpFile.getAbsolutePath());
if (tmpFile.exists()) {
File finalVideoFile = new File(finalVideoPath);
finalVideoFile.delete();
currentFile.delete();
tmpFile.renameTo(finalVideoFile);
} else {
Toast.makeText(PicturesActivity.this, "视频合并失败!", Toast.LENGTH_SHORT).show();
}
} catch (Exception e) {
Log.e("PictureActivity", e.getMessage());
}
} else {
currentFile.renameTo(new File(finalVideoPath));
}
}
}
runOnUiThread(new Runnable() {
@Override
public void run() {
dismissLoadingDialog();
if (isFinishActivity) {
PicturesActivity.this.finish();
}
}
});
}
}).start();*/
}
@Override
@ -291,29 +242,6 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
@Override
public void onVideoRecordingStart() {
super.onVideoRecordingStart();
/* *//**
* 获取当前视频的时间记录csv文件时使用
* *//*
long currentTime = AWMp4ParserHelper.getInstance().getVedioTotalTime(new File(finalVideoPath));
timerTask = new CsvTimerTask(new File(finalVideoPath + ".txt"));
// 开始采集每隔2秒实时记录位置信息视频时间以及设备时间
if (currentTime == 0) {
timer.schedule(timerTask, 0, period * 1000);
} else {
timerTask.setCurrentVideoTime(currentTime / 1000 + 1);
timer.schedule(timerTask, 1, period * 1000);
}
}
@Override
public void onVideoRecordingEnd() {
super.onVideoRecordingEnd();
/* if (timerTask!=null){
timerTask.cancel();
}else {
// Toast.makeText(PictureActivity.this, "请先拍照", Toast.LENGTH_SHORT).show();
}*/
}
});
@ -378,18 +306,17 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
public void onClick(View v) {
switch (v.getId()) {
case R.id.btn_stop_picture:
if (timerTask != null) {
timerTask.cancel();
}
listenerPicture = false;
Intent intent = new Intent();
intent.putExtra(Constant.INTENT_PICTURES_PATH, pictureList);
finalVideoPath = paperFile.getParentFile().getAbsolutePath() + "/" +videoIndex+ ".jpg";
intent.putExtra(Constant.INTENT_PICTURES_PATH, finalVideoPath);
setResult(0x102, intent);
finish();
break;
case R.id.btn_switch:
v.setEnabled(false);
handler.sendEmptyMessageDelayed(1, 2000); // 利用handler延迟发送更改状态信息
handler.sendEmptyMessageDelayed(0x102, 2000); // 利用handler延迟发送更改状态信息
btnSwich();
break;
}
@ -488,14 +415,11 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
if (polyline != null) {
polyline.remove();
}
if (timerTask != null) {
timerTask.cancel();
}
listenerPicture = false;
for (int i = 0; i < removables.size(); i++) {
removables.get(i).remove();
}
removables.clear();
// timer.cancel();
if (EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().unregister(this);
}
@ -519,43 +443,29 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
}
}
/**
* 记录视频拍摄的时间及经纬度
*/
private class CsvTimerTask extends TimerTask {
private File csvFile;
private long currentVideoTime; // 记录当前的视频时间
public CsvTimerTask(File csvFile) {
this.csvFile = csvFile;
if (!csvFile.exists()) {
csvFile.getParentFile().mkdirs();
}
}
public void setCurrentVideoTime(long currentVideoTime) {
this.currentVideoTime = currentVideoTime;
}
@Override
public void run() {
// 记录当前时间视频时间以及当前经纬度信息
StringBuffer sb = new StringBuffer();
// sb.append(formatter.format(new Date())); // 记录当前时间
sb.append(",");
sb.append(currentVideoTime);// 记录视频时间
sb.append(",");
sb.append(Constant.currentLocation.getLatitude());
sb.append(",");
sb.append(Constant.currentLocation.getLongitude());
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);
public void initMarkerPaper() {
// 记录当前时间视频时间以及当前经纬度信息
StringBuffer sb = new StringBuffer();
sb.append(formatter.format(new Date())); // 记录当前时
sb.append(",");
sb.append(videoIndex);//個數
sb.append(",");
sb.append(Constant.currentLocation.getLatitude());
sb.append(",");
sb.append(Constant.currentLocation.getLongitude());
sb.append(",");
if (Constant.currentLocation.getBearing() != 0) {
sb.append(Constant.currentLocation.getBearing());
} else {
sb.append(Constant.currentLocation.getDirection());
}
sb.append("\r\n");
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(paperFile.getAbsolutePath(), sb.toString(), true);
}
}

View File

@ -165,6 +165,7 @@ public class Constant {
public static MapView treasureMap;
public static final String INTENT_VIDEO_PATH = "INTENT_VIDEO_PATH"; // 拍照界面指定的视频文件保存位置
public static final String INTENT_JPG_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-强制横屏 其他-任意

View File

@ -29,7 +29,6 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.core.widget.NestedScrollView;
import com.bumptech.glide.Glide;
import com.github.lazylibrary.util.FileUtils;
import com.github.lazylibrary.util.StringUtils;
import com.github.lazylibrary.util.ZipUtil;
import com.google.gson.Gson;
@ -40,23 +39,17 @@ import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
import com.kongzue.dialog.util.BaseDialog;
import com.kongzue.dialog.util.DialogSettings;
import com.kongzue.dialog.v3.MessageDialog;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.HttpParams;
import com.lzy.okgo.model.Response;
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.Info;
import com.navinfo.outdoor.bean.OtherUploadPicBean;
import com.navinfo.outdoor.bean.PoiSaveBean;
import com.navinfo.outdoor.bean.PoiVideoBean;
import com.navinfo.outdoor.bean.RoadExtend;
import com.navinfo.outdoor.bean.UnPolygonTaskBean;
import com.navinfo.outdoor.http.Callback;
import com.navinfo.outdoor.http.DialogCallback;
import com.navinfo.outdoor.http.HttpInterface;
import com.navinfo.outdoor.http.OkGoBuilder;
import com.navinfo.outdoor.room.ChargingPileEntity;
@ -71,17 +64,13 @@ import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
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 org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.io.File;
import java.io.Serializable;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
/**
@ -92,12 +81,10 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
private TextView tvPictures;
private EditText etRoadName;
private ImageView ivPoiVideoPicture;
private RadioButton rbCar;
private RadioButton rbBicycle;
private RadioButton rbWalking;
private RadioGroup rgType;
private RadioButton rbCar, rbBicycle, rbWalking, rbManual;
private EditText etDesc;
private Button btnRoadSave;
private RadioGroup rgType;
private PoiDatabase poiDatabase;
private PoiDao poiDao;
private Button btnPoiVideoUpload;
@ -107,7 +94,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
private LatLng latLng;
private Marker markerPoiVideo;
private TextView tvPicture;
private int isRequest;
private int isRequest;
public static PoiVideoFragment newInstance(Bundle bundle) {
PoiVideoFragment fragment = new PoiVideoFragment();
@ -178,9 +165,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
}
etRoadName = (EditText) findViewById(R.id.et_poi_video_name);
ivPoiVideoPicture = (ImageView) findViewById(R.id.iv_poi_video_picture);
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);
fmPoiVideoPic = findViewById(R.id.fm_poi_video_picture);
btnRoadSave = (Button) findViewById(R.id.btn_poi_video_save);
@ -188,22 +173,26 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
btnPoiVideoUpload = findViewById(R.id.btn_poi_video_upload);
btnPoiVideoUpload.setOnClickListener(this::onClick);
rgType = (RadioGroup) findViewById(R.id.rg_type);
/* fmPoiVideoPic.setOnClickListener(new View.OnClickListener() {
rbCar =findViewById(R.id.rb_car);
rbBicycle =findViewById(R.id.rb_bicycle);
rbWalking =findViewById(R.id.rb_walking);
rbManual = findViewById(R.id.rb_manual);
rgType.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onClick(View v) {
if (v.getTag() == null || ((List<File>) v.getTag()).size() == 0) {
Toast.makeText(getActivity(), "还没有拍摄视频!", Toast.LENGTH_SHORT).show();
return;
}
public void onCheckedChanged(RadioGroup group, int checkedId) {
File finalFile = AWMp4ParserHelper.getInstance().obtainMp4FilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
Intent intent = new Intent(getContext(), PictureActivity.class);
// intent.putExtra("uuId", showPoiEntity.getId());
intent.putExtra("poiEntity", showPoiEntity);
intent.putExtra(Constant.INTENT_VIDEO_PATH, finalFile.getAbsolutePath());
startActivityForResult(intent, 0x101);
switch (checkedId) {
case R.id.rb_car:
case R.id.rb_bicycle:
case R.id.rb_walking:
tvPicture.setVisibility(View.VISIBLE);
break;
case R.id.rb_manual:
tvPicture.setVisibility(View.GONE);
break;
}
}
});*/
});
fmPoiVideoPic.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
@ -247,6 +236,9 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
}
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 + "");
@ -266,8 +258,8 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
isImageLoad = true;
}
}
fmPoiVideoPic.setTag(videoFileListByUUID);
}
fmPoiVideoPic.setTag(videoFileListByUUID);
}
}
} else if (record_way == 2) {//连拍
@ -276,7 +268,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
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).getPath().contains("0.jpg") && !pictureFileListByUUID.get(i).getPath().contains("paper.txt")) {
if (pictureFileListByUUID.get(i).exists() && !isImageLoad) {
// 使用glide加载视频的第一帧
Glide.with(getActivity()).load(pictureFileListByUUID.get(i)).into(ivPoiVideoPicture);
@ -325,18 +317,15 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
initPoiSaveLocal(false);
break;
case R.id.tv_pictures://拍照
tvPicture.setEnabled(false);
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(Constant.INTENT_JPG_PATH, filePath.getAbsolutePath());
int pictureType = getPictureType();
intents.putExtra("type",pictureType);
intents.putExtra("poiEntity", showPoiEntity);
startActivityForResult(intents, 0x102);
break;
case R.id.tv_picture://录像
tvPictures.setEnabled(false);
// 根据用户点击的时间为视频名称赋值
// 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());
@ -552,6 +541,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
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);
@ -563,11 +553,13 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
}
}
} else if (requestCode == 0x102 && resultCode == 0x102) {
isRequest =0x102;
tvPicture.setEnabled(false);
isRequest = 0x102;
if (data != null && data.hasExtra(Constant.INTENT_PICTURES_PATH)) {
ArrayList<File> serializableExtra = (ArrayList<File>) data.getSerializableExtra(Constant.INTENT_PICTURES_PATH);
if (serializableExtra != null) {
Glide.with(getActivity()).load(serializableExtra.get(0)).into(ivPoiVideoPicture);
String videoPath = data.getStringExtra(Constant.INTENT_PICTURES_PATH);
File pictureFile = new File(videoPath);
if (pictureFile.exists()) {
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(pictureFile).toString(), ivPoiVideoPicture, 500);
List<File> pictureFileListByUUID = AWMp4ParserHelper.getInstance().getJPGFileListByUUID(showPoiEntity.getId());
fmPoiVideoPic.setTag(pictureFileListByUUID);
}
@ -611,6 +603,8 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
return 1;
} else if (rbWalking != null && rbWalking.isChecked()) {
return 2;
} else if (rbManual !=null &&rbManual.isChecked()){
return 3;
}
return -1;
}
@ -626,6 +620,9 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
case 2:
rbWalking.setChecked(true);
break;
case 3:
rbManual.setChecked(true);
break;
}
}
@ -748,7 +745,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
poiEntity.setCreateTime(format);
poiEntity.setType(3);
poiEntity.setTaskStatus(2);
if (isRequest==0x101){
if (isRequest == 0x101) {
if (fmPoiVideoPic.getTag() == null) {
List<File> videoFileListByUUID = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(showPoiEntity.getId());
if (videoFileListByUUID != null) {
@ -766,7 +763,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
}
poiEntity.setRecord_way(1);//录像
}
}else if (isRequest==0x102){
} else if (isRequest == 0x102) {
if (fmPoiVideoPic.getTag() == null) {
List<File> pictureFileListByUUID = AWMp4ParserHelper.getInstance().getJPGFileListByUUID(showPoiEntity.getId());
if (pictureFileListByUUID != null) {

View File

@ -11,8 +11,8 @@
android:layout_height="match_parent">
<com.otaliastudios.cameraview.CameraView
android:id="@+id/camera"
app:cameraVideoSizeMaxWidth="2000"
app:cameraVideoSizeMaxArea="2000000"
app:cameraVideoSizeMaxWidth="2500"
app:cameraVideoSizeMaxArea="2750000"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:keepScreenOn="true"

View File

@ -15,19 +15,21 @@
app:layout_constraintTop_toTopOf="parent">
</include>
<androidx.core.widget.NestedScrollView
android:id="@+id/nested_scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
android:layout_height="match_parent">
<TextView
android:id="@+id/tv_message"
android:layout_width="wrap_content"
@ -38,7 +40,7 @@
android:textColor="@color/black"
android:textSize="16sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="@+id/ll_name"
@ -122,13 +124,14 @@
android:layout_weight="1"
android:text="步行"
android:textColor="@color/test_color_selector" />
<!-- <RadioButton-->
<!-- android:id="@+id/rb_manual"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_weight="1"-->
<!-- android:textColor="@color/test_color_selector"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="手动"/>-->
<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>
@ -160,6 +163,7 @@
android:text="录像"
android:textColor="@color/white"
android:textSize="15sp" />
<TextView
android:id="@+id/tv_pictures"
style="@style/user_style"