查看相册和视频逻辑处理

This commit is contained in:
wangdongsheng 2021-09-03 18:35:02 +08:00
parent f441819c3b
commit a8e8d7b5d0
25 changed files with 767 additions and 315 deletions

View File

@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion '29.0.2'
ndkVersion '23.0.7123448'
// ndkVersion '23.0.7123448'
defaultConfig {
applicationId "com.navinfo.outdoor"
@ -136,4 +136,7 @@ dependencies {
implementation 'com.googlecode.mp4parser:isoparser:1.1.21'
// Android常用库 https://github.com/l123456789jy/Lazy
implementation 'com.github.lazylibrary:lazylibrary:1.0.2'
//
implementation 'cn.jzvd:jiaozivideoplayer:7.4.2'
}

View File

@ -96,6 +96,8 @@
<activity
android:name=".activity.ImageShowActivity"
android:screenOrientation="portrait" />
<activity android:name=".activity.VideoActivity"
android:screenOrientation="portrait"/>
<activity
android:name=".activity.UserActivity"
android:screenOrientation="portrait" />

View File

@ -19,30 +19,24 @@ import java.util.ArrayList;
*/
public class ImageShowActivity extends BaseActivity implements View.OnClickListener {
private ViewPager image_pager;
private TextView page_number;
private ArrayList<String> imgUrl;
private int type;
@Override
protected int getLayout() {
return R.layout.activity_image_show;
}
@SuppressLint("SetTextI18n")
@Override
protected void initData() {
super.initData();
imgUrl = getIntent().getStringArrayListExtra("info");
Log.d("ImageShowActivity", "initData: "+imgUrl);
page_number.setText("1" + "/" + imgUrl.size());
}
@Override
protected void initView() {
super.initView();
image_pager =findViewById(R.id.image_pager);
page_number =findViewById(R.id.page_number);
ImageView download =findViewById(R.id.download);
download.setOnClickListener(this);
imgUrl = getIntent().getStringArrayListExtra("info");
type = getIntent().getIntExtra("type", 0);
Log.d("ImageShowActivity", "initData: " + imgUrl);
image_pager = findViewById(R.id.image_pager);
ImageView imageShow = findViewById(R.id.iv_image_show);
imageShow.setOnClickListener(this);
initViewPager();
}
@ -51,11 +45,14 @@ public class ImageShowActivity extends BaseActivity implements View.OnClickListe
if (imgUrl != null && imgUrl.size() != 0) {
ImagePagerAdapter mAdapter = new ImagePagerAdapter(getApplicationContext(), imgUrl);
image_pager.setAdapter(mAdapter);
image_pager.setCurrentItem(type);
}
}
@Override
public void onClick(View v) {
v.getId();
if (v.getId() == R.id.iv_image_show) {
finish();
}
}
}

View File

@ -237,11 +237,11 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
// });
removables = new ArrayList<>();//存储轨迹的marker
if (poiEntity.getId() != null) {
List<File> videoFileListByUUID = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(poiEntity.getId());
if (videoFileListByUUID != null) {
List<LatLng> lineStringByVideoFileList = AWMp4ParserHelper.getInstance().getLineStringByVideoFileList(videoFileListByUUID);
for (int i = 0; i < lineStringByVideoFileList.size(); i++) {
LatLng latLng = lineStringByVideoFileList.get(i);
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(poiEntity.getId());
if (fileListByUUID != null) {
List<LatLng> lineStringByFileList = AWMp4ParserHelper.getInstance().getLineStringByFileList(fileListByUUID);
for (int i = 0; i < lineStringByFileList.size(); i++) {
LatLng latLng = lineStringByFileList.get(i);
if (latLng != null) {
BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.ic_baseline);
Marker marker = tencentMap.addMarker(new MarkerOptions(latLng).icon(pileDescriptor).alpha(0.9f)

View File

@ -184,11 +184,11 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
setLocMarkerStyle(LOCATION_TYPE_LOCATION_ROTATE);
initLine();
if (poiEntity.getId() != null) {
List<File> videoFileListByUUID = AWMp4ParserHelper.getInstance().getJPGFileListByUUID(poiEntity.getId());
if (videoFileListByUUID != null) {
List<LatLng> lineStringByPictureFileList = AWMp4ParserHelper.getInstance().getLineStringByPictureFileList(videoFileListByUUID);
for (int i = 0; i < lineStringByPictureFileList.size(); i++) {
LatLng latLng = lineStringByPictureFileList.get(i);
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(poiEntity.getId());
if (fileListByUUID != null) {
List<LatLng> lineStringByFileList = AWMp4ParserHelper.getInstance().getLineStringByFileList(fileListByUUID);
for (int i = 0; i < lineStringByFileList.size(); i++) {
LatLng latLng = lineStringByFileList.get(i);
if (latLng != null) {
BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.ic_baseline);
Marker marker = tencentMap.addMarker(new MarkerOptions(latLng).icon(pileDescriptor).alpha(0.9f)

View File

@ -0,0 +1,76 @@
package com.navinfo.outdoor.activity;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.Bitmap;
import android.media.ThumbnailUtils;
import android.os.Message;
import android.provider.MediaStore;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.viewpager.widget.ViewPager;
import com.bumptech.glide.Glide;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.adapter.ImagePagerAdapter;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseActivity;
import org.greenrobot.eventbus.EventBus;
import java.util.ArrayList;
import java.util.Objects;
import cn.jzvd.Jzvd;
import cn.jzvd.JzvdStd;
/**
* 点击查看视频
*/
public class VideoActivity extends BaseActivity implements View.OnClickListener {
private String videoPath;
private JzvdStd jzvdStd;
@Override
protected int getLayout() {
return R.layout.activity_video;
}
@Override
protected void initView() {
super.initView();
videoPath = getIntent().getStringExtra("video");
jzvdStd = findViewById(R.id.jz_video);
ImageView imageVideo = findViewById(R.id.iv_video);
imageVideo.setOnClickListener(this);
jzvdStd.setUp(videoPath,"", Jzvd.SCREEN_NORMAL);
Glide.with(this).asDrawable().load(videoPath).into(jzvdStd.posterImageView); //设置图片
}
@Override
protected void onPause() {
super.onPause();
Jzvd.releaseAllVideos();
}
@Override
public void onBackPressed() {
if (Jzvd.backPress()){
return;
}
super.onBackPressed();
}
@Override
public void onClick(View v) {
if (v.getId() == R.id.iv_video) {
finish();
}
}
}

View File

@ -1,6 +1,7 @@
package com.navinfo.outdoor.adapter;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.view.LayoutInflater;
import android.view.View;
@ -13,11 +14,15 @@ import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.activity.ImageShowActivity;
import com.navinfo.outdoor.activity.VideoActivity;
import com.navinfo.outdoor.bean.FileBean;
import com.navinfo.outdoor.util.AWMp4ParserHelper;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
@ -25,13 +30,31 @@ import java.util.List;
*/
public class PhotoAdapter extends RecyclerView.Adapter<PhotoAdapter.ViewHolder> {
private List<File> files ;
private List<FileBean> fileBeans;
private Context context;
public PhotoAdapter(List<File> files, Context context) {
this.files = files;
public PhotoAdapter(List<FileBean> files, Context context) {
this.fileBeans = files;
this.context = context;
}
public void deleteFile(FileBean fileBeanList) {
for (int i = 0; i < fileBeans.size(); i++) {
String path = fileBeans.get(i).getFile().getPath();
if (fileBeanList.getFile().getPath().equals(path)) {
fileBeans.set(i,fileBeanList);
}
}
for (int i = 0; i < fileBeans.size(); i++) {
boolean check = fileBeans.get(i).isCheck();
if (check){
fileBeans.get(i).getFile().delete();
fileBeans.remove(fileBeans.get(i));
notifyDataSetChanged();
}
}
}
@NotNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
@ -40,23 +63,43 @@ public class PhotoAdapter extends RecyclerView.Adapter<PhotoAdapter.ViewHolder>
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
File file= files.get(position);
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
FileBean fileBean = fileBeans.get(position);
File file = fileBean.getFile();
if (file.exists()) {
AWMp4ParserHelper.getInstance().loadFirstWithGlide(context, Uri.fromFile(file).toString(), holder.ivPhoto, 500);
}
holder.ivPhoto.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ArrayList<String> arrayList = new ArrayList<>();
for (int i = 0; i < fileBeans.size(); i++) {
arrayList.add(fileBeans.get(i).getFile().getPath());
}
Intent intent = new Intent(context, ImageShowActivity.class);
intent.putExtra("info", arrayList);
intent.putExtra("type",position);
context.startActivity(intent);
}
});
holder.cbPhoto.setChecked(fileBean.isCheck());
holder.cbPhoto.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (photoClickItem != null) {
fileBean.setCheck(isChecked);
photoClickItem.item(isChecked, fileBean);
}
}
});
}
@Override
public int getItemCount() {
return files.size();
return fileBeans.size();
}
static class ViewHolder extends RecyclerView.ViewHolder {
@ -77,7 +120,7 @@ public class PhotoAdapter extends RecyclerView.Adapter<PhotoAdapter.ViewHolder>
}
public interface photoClickItem {
void item(int aInt);
void item(boolean isBoolean, FileBean fileBean);
}

View File

@ -1,6 +1,7 @@
package com.navinfo.outdoor.adapter;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.view.LayoutInflater;
import android.view.View;
@ -13,11 +14,14 @@ import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.activity.VideoActivity;
import com.navinfo.outdoor.bean.FileBean;
import com.navinfo.outdoor.util.AWMp4ParserHelper;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
@ -25,14 +29,45 @@ import java.util.List;
*/
public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.ViewHolder> {
private List<File> files ;
private List<FileBean> fileBeans;
private Context context;
private List<File> textFile=new ArrayList<>();
public VideoAdapter(List<File> files, Context context) {
this.files = files;
public VideoAdapter(List<FileBean> files, Context context) {
this.fileBeans = files;
this.context = context;
}
public void setTextFile(List<File> textFile) {
this.textFile.addAll(textFile);
notifyDataSetChanged();
}
public void deleteFile(FileBean fileBeanList) {
for (int i = 0; i < fileBeans.size(); i++) {
String path = fileBeans.get(i).getFile().getPath();
if (fileBeanList.getFile().getPath().equals(path)) {
fileBeans.set(i,fileBeanList);
}
}
for (int i = 0; i < fileBeans.size(); i++) {
boolean check = fileBeans.get(i).isCheck();
if (check){
fileBeans.get(i).getFile().delete();
if (textFile!=null){
for (int i1 = 0; i1 < textFile.size(); i1++) {
if (textFile.get(i).getPath().contains(fileBeans.get(i).getFile().getPath())){
textFile.get(i).delete();
}
}
}
fileBeans.remove(fileBeans.get(i));
notifyDataSetChanged();
}
}
}
@NotNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
@ -42,21 +77,33 @@ public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.ViewHolder>
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
File file= files.get(position);
FileBean fileBean = fileBeans.get(position);
File file = fileBean.getFile();
if (file.exists()) {
AWMp4ParserHelper.getInstance().loadFirstWithGlide(context, Uri.fromFile(file).toString(), holder.ivVideo, 500);
}
holder.ivVideo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, VideoActivity.class);
intent.putExtra("video",fileBean.getFile().getPath());
context.startActivity(intent);
}
});
holder.cbVideo.setChecked(fileBean.isCheck());
holder.cbVideo.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (photoClickItem != null) {
fileBean.setCheck(isChecked);
photoClickItem.item(isChecked, fileBean);
}
}
});
}
@Override
public int getItemCount() {
return files.size();
return fileBeans.size();
}
class ViewHolder extends RecyclerView.ViewHolder {
@ -77,7 +124,7 @@ public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.ViewHolder>
}
public interface photoClickItem {
void item(int aInt);
void item(boolean isBoolean, FileBean fileBean);
}

View File

@ -144,6 +144,10 @@ public class Constant {
public static final int PICTURE_VIDEO_WORD = 48; //视频页面崩溃后发给poi录像和道路
public static final int REGISTER_WORD = 46; //注册的返回
public static final int VIDEO_FINISH_ROAD = 47;//录像视频列表的返回
public static final int PHOTO_FINISH_VIDEO = 49;//拍照列表的返回
public static int NUMBER = 200; //任务个数
public static int LIMIT_TYPE = -1; //权限类型普通任务-0专属任务-1

View File

@ -0,0 +1,38 @@
package com.navinfo.outdoor.bean;
import java.io.File;
public class FileBean {
private File file;
private boolean isCheck;
private File txtFile;
public FileBean(File file, boolean isCheck) {
this.file = file;
this.isCheck = isCheck;
}
public File getTxtFile() {
return txtFile;
}
public void setTxtFile(File txtFile) {
this.txtFile = txtFile;
}
public File getFile() {
return file;
}
public void setFile(File file) {
this.file = file;
}
public boolean isCheck() {
return isCheck;
}
public void setCheck(boolean check) {
isCheck = check;
}
}

View File

@ -1,9 +1,12 @@
package com.navinfo.outdoor.fragment;
import android.os.Bundle;
import android.os.Message;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@ -11,10 +14,15 @@ import androidx.recyclerview.widget.RecyclerView;
import com.jcodecraeer.xrecyclerview.XRecyclerView;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.adapter.PhotoAdapter;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseFragment;
import com.navinfo.outdoor.bean.FileBean;
import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.util.AWMp4ParserHelper;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
@ -26,46 +34,93 @@ import java.util.Objects;
public class PhotoFragment extends BaseFragment implements View.OnClickListener {
private List<File> fileArrayList;
private ArrayList<FileBean> fileBeans;
private ArrayList<FileBean> deleteFiles;
private PhotoAdapter photoAdapter;
public static PhotoFragment newInstance(Bundle bundle) {
PhotoFragment fragment = new PhotoFragment();
fragment.setArguments(bundle);
return fragment;
}
@Override
public void onStart() {
super.onStart();
if (!EventBus.getDefault().isRegistered(this)) {//加上判断
EventBus.getDefault().register(this);
}
}
@Override
protected int getLayout() {
return R.layout.fragment_photo;
}
@Override
public void onResume() {
super.onResume();
getFocus();
}
//主界面获取焦点
private void getFocus() {
Objects.requireNonNull(getView()).setFocusableInTouchMode(true);
getView().requestFocus();
getView().setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
Message message = new Message();
message.what= Constant.PHOTO_FINISH_VIDEO;
EventBus.getDefault().post(message);
Objects.requireNonNull(getActivity()).finish();
return true;
}
return false;
}
});
}
@Override
protected void initView() {
super.initView();
PoiEntity showPoiEntity = (PoiEntity) Objects.requireNonNull(getActivity()).getIntent().getSerializableExtra("showPoiEntity");
deleteFiles = new ArrayList<>();
if (showPoiEntity!=null){
String id = showPoiEntity.getId();
if (showPoiEntity.getRecord_way()==2){//連拍
fileArrayList = new ArrayList<>();
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(id);
fileBeans = new ArrayList<>();
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(id);
for (int i = 0; i < fileListByUUID.size(); i++) {
if (!fileListByUUID.get(i).getPath().contains(".txt")){
fileArrayList.add(fileListByUUID.get(i));
fileBeans.add(new FileBean(fileListByUUID.get(i),false));
}
}
}
}
ImageView ivPhotoFinal = (ImageView) findViewById(R.id.iv_photo_final);
ivPhotoFinal.setOnClickListener(this);
TextView tvPhotoChoose = (TextView) findViewById(R.id.tv_photo_choose);
tvPhotoChoose.setOnClickListener(this);
TextView tvPhotoAlbumDelete = (TextView) findViewById(R.id.tv_photo_album_delete);
tvPhotoAlbumDelete.setOnClickListener(this);
RecyclerView photoRecycler = findViewById(R.id.photo_album_recycler);
photoRecycler.setLayoutManager(new GridLayoutManager(getContext(),2));
PhotoAdapter photoAdapter = new PhotoAdapter(fileArrayList, getContext());
photoAdapter = new PhotoAdapter(fileBeans, getContext());
photoRecycler.setAdapter(photoAdapter);
photoAdapter.setPhotoClickItem(new PhotoAdapter.photoClickItem() {
@Override
public void item(boolean isChecked, FileBean fileBean) {
if (isChecked){
deleteFiles.add(fileBean);
}else {
if (deleteFiles!=null){
for (int i = 0; i < deleteFiles.size(); i++) {
if (fileBean.getFile().getPath().equals(deleteFiles.get(i).getFile().getPath())){
deleteFiles.remove(fileBean);
}
}
}
}
}
});
}
@Override
@ -73,13 +128,39 @@ public class PhotoFragment extends BaseFragment implements View.OnClickListener
super.initData();
}
@Subscribe
public void onEvent(Message data) {
}
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.iv_photo_final:
Message message = new Message();
message.what= Constant.PHOTO_FINISH_VIDEO;
EventBus.getDefault().post(message);
Objects.requireNonNull(getActivity()).finish();
break;
case R.id.tv_photo_album_delete:
if (fileBeans!=null){
for (int i = 0; i < fileBeans.size(); i++) {
photoAdapter.deleteFile(fileBeans.get(i));
}
}else {
Toast.makeText(getContext(), "请选择要删除的数据后才可以删除", Toast.LENGTH_SHORT).show();
}
break;
}
}
@Override
public void onDestroy() {
if (EventBus.getDefault().isRegistered(this))//加上判断
EventBus.getDefault().unregister(this);
super.onDestroy();
}
}

View File

@ -171,7 +171,24 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
rbWalking = findViewById(R.id.rb_walking);
rbManual = findViewById(R.id.rb_manual);
tvPhotoAlbum = findViewById(R.id.tv_photo_album);
tvPhotoAlbum.setOnClickListener(this::onClick);
tvPhotoAlbum.setOnClickListener(this);
/*fmRoadPic.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (v.getTag() == null || ((List<File>) v.getTag()).size() == 0) {
Toast.makeText(getActivity(), "还没有拍摄视频!", Toast.LENGTH_SHORT).show();
return;
}
File finalFile = AWMp4ParserHelper.getInstance().obtainMp4FilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
Intent intent = new Intent(getContext(), PictureActivity.class);
intent.putExtra(Constant.INTENT_VIDEO_PATH, finalFile.getAbsolutePath());
intent.putExtra(Constant.INTENT_VIDEO_OBLATION, 0);
intent.putExtra("poiEntity", showPoiEntity);
startActivityForResult(intent, 0x101);
}
});*/
rgType.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
@ -195,9 +212,9 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getContext()), "提示", "是否删除", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
List<File> videoFileListByUUID = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(showPoiEntity.getId());
for (int i = 0; i < videoFileListByUUID.size(); i++) {
videoFileListByUUID.get(i).delete();
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
for (int i = 0; i < fileListByUUID.size(); i++) {
fileListByUUID.get(i).delete();
}
ivPoiVideoPicture.setImageDrawable(null);
return false;
@ -246,17 +263,16 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
tvPictures.setEnabled(false);
if (!StringUtils.isEmpty(photoList)) {
boolean isImageLoad = false;
List<File> videoFileListByUUID = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(showPoiEntity.getId());
for (int i = 0; i < videoFileListByUUID.size(); i++) {
if (videoFileListByUUID.get(i).getPath().contains("0.mp4") && !videoFileListByUUID.get(i).getPath().contains("0.mp4.txt")) {
if (videoFileListByUUID.get(i).exists() && !isImageLoad) {
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
for (int i = 0; i < fileListByUUID.size(); i++) {
if (fileListByUUID.get(i).getPath().contains(".mp4") && !fileListByUUID.get(i).getPath().contains(".mp4.txt")) {
if (fileListByUUID.get(i).exists() && !isImageLoad) {
// 使用glide加载视频的第一帧
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFileListByUUID.get(i)).toString(), ivPoiVideoPicture, 500);
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(fileListByUUID.get(i)).toString(), ivPoiVideoPicture, 500);
isImageLoad = true;
}
}
fmPoiVideoPic.setTag(videoFileListByUUID);
fmPoiVideoPic.setTag(fileListByUUID);
}
}
} else if (record_way == 2) {//连拍
@ -267,17 +283,17 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
tvPicture.setEnabled(false);
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("paper.txt")) {
if (pictureFileListByUUID.get(i).exists() && !isImageLoad) {
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
for (int i = 0; i < fileListByUUID.size(); i++) {
if (fileListByUUID.get(i).getPath().contains(".jpg") && !fileListByUUID.get(i).getPath().contains("paper.txt")) {
if (fileListByUUID.get(i).exists() && !isImageLoad) {
// 使用glide加载视频的第一帧
Glide.with(Objects.requireNonNull(getActivity())).load(pictureFileListByUUID.get(i)).into(ivPoiVideoPicture);
Glide.with(Objects.requireNonNull(getActivity())).load(fileListByUUID.get(i)).into(ivPoiVideoPicture);
isImageLoad = true;
}
}
}
fmPoiVideoPic.setTag(pictureFileListByUUID);
fmPoiVideoPic.setTag(fileListByUUID);
}
}
}
@ -322,6 +338,8 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
}
private void disables() {
fmPoiVideoPic.setEnabled(false);
tvPhotoAlbum.setEnabled(false);
etRoadName.setEnabled(false);
ivPoiVideoPicture.setEnabled(false);
tvPictures.setEnabled(false);
@ -341,6 +359,46 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
if ((boolean) data.obj) {
initPoiVideoSharePre();
}
} else if (data.what == Constant.VIDEO_FINISH_ROAD) {
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
if (fileListByUUID.size()==0) {
ivPoiVideoPicture.setImageDrawable(null);
} else {
boolean isImageLoad = false;
for (int i = 0; i < fileListByUUID.size(); i++) {
File videoFile = fileListByUUID.get(i);
if (videoFile.getPath().contains(".mp4") && !videoFile.getPath().contains(".mp4.txt")) {
if (videoFile.exists() && !isImageLoad) {
// 使用glide加载视频的第一帧
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivPoiVideoPicture, 500);
isImageLoad = true;
}
}
}
fmPoiVideoPic.setTag(fileListByUUID);
}
}else if (data.what==Constant.PHOTO_FINISH_VIDEO){
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
if (fileListByUUID.size()==1) {
for (int i = 0; i < fileListByUUID.size(); i++) {
fileListByUUID.get(i).delete();
}
ivPoiVideoPicture.setImageDrawable(null);
} else {
boolean isImageLoad = false;
for (int i = 0; i < fileListByUUID.size(); i++) {
File videoFile = fileListByUUID.get(i);
if (videoFile.getPath().contains(".jpg") && !videoFile.getPath().contains("paper.txt")) {
if (videoFile.exists() && !isImageLoad) {
// 使用glide加载视频的第一帧
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivPoiVideoPicture, 500);
isImageLoad = true;
}
}
}
fmPoiVideoPic.setTag(fileListByUUID);
}
}
}
@ -605,8 +663,8 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
File videoFile = new File(videoPath);
if (videoFile.exists()) {
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivPoiVideoPicture, 500);
List<File> videoFileListByUUID = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(showPoiEntity.getId());
fmPoiVideoPic.setTag(videoFileListByUUID);
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
fmPoiVideoPic.setTag(fileListByUUID);
}
}
} else if (requestCode == 0x102 && resultCode == 0x102) {
@ -624,8 +682,8 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
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);
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
fmPoiVideoPic.setTag(fileListByUUID);
}
}
}
@ -767,13 +825,13 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
@Override
protected PoiEntity initPoiEntityByUI(PoiEntity poiEntity) {
String roadName = etRoadName.getText().toString().trim();
if (roadName != null && !roadName.equals("")) {
if (!roadName.equals("")) {
poiEntity.setName(roadName + "");
} else {
DateFormat formatters = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
Calendar calendars = Calendar.getInstance();
calendars.setTimeInMillis(System.currentTimeMillis());
String formats = formatters.format(calendars.getTime());
String formats = formatter.format(calendars.getTime());
String city = Constant.currentLocation.getCity();//返回当前位置的城市.
String district = Constant.currentLocation.getDistrict();//返回当前位置的区县.
StringBuilder sb = new StringBuilder("poi录像上报");
@ -811,14 +869,14 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
poiEntity.setTaskStatus(2);
if (isRequest == 0x101) {
if (fmPoiVideoPic.getTag() == null) {
List<File> videoFileListByUUID = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(showPoiEntity.getId());
if (videoFileListByUUID != null) {
fmPoiVideoPic.setTag(videoFileListByUUID);
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
if (fileListByUUID != null) {
fmPoiVideoPic.setTag(fileListByUUID);
}
}
if (fmPoiVideoPic.getTag() != null && !((List<File>) fmPoiVideoPic.getTag()).isEmpty()) {
List<LatLng> lineStringByVideoFileList = AWMp4ParserHelper.getInstance().getLineStringByVideoFileList((List<File>) fmPoiVideoPic.getTag());
String lineString = GeometryTools.getLineString(lineStringByVideoFileList);
List<LatLng> lineStringByFileList = AWMp4ParserHelper.getInstance().getLineStringByFileList((List<File>) fmPoiVideoPic.getTag());
String lineString = GeometryTools.getLineString(lineStringByFileList);
Log.d("TAG", "onGranted: " + lineString);
String photoStr = AWMp4ParserHelper.getInstance().getVideoFileListStr((List<File>) fmPoiVideoPic.getTag());
poiEntity.setPhoto(photoStr);
@ -829,14 +887,14 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
}
} else if (isRequest == 0x102) {
if (fmPoiVideoPic.getTag() == null) {
List<File> pictureFileListByUUID = AWMp4ParserHelper.getInstance().getJPGFileListByUUID(showPoiEntity.getId());
if (pictureFileListByUUID != null) {
fmPoiVideoPic.setTag(pictureFileListByUUID);
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
if (fileListByUUID != null) {
fmPoiVideoPic.setTag(fileListByUUID);
}
}
if (fmPoiVideoPic.getTag() != null && !((List<File>) fmPoiVideoPic.getTag()).isEmpty()) {
List<LatLng> lineStringByVideoFileList = AWMp4ParserHelper.getInstance().getLineStringByVideoFileList((List<File>) fmPoiVideoPic.getTag());
String lineString = GeometryTools.getLineString(lineStringByVideoFileList);
List<LatLng> lineStringByFileList = AWMp4ParserHelper.getInstance().getLineStringByFileList((List<File>) fmPoiVideoPic.getTag());
String lineString = GeometryTools.getLineString(lineStringByFileList);
Log.d("TAG", "onGranted: " + lineString);
String photoStr = AWMp4ParserHelper.getInstance().getVideoFileListStr((List<File>) fmPoiVideoPic.getTag());
poiEntity.setPhoto(photoStr);

View File

@ -66,6 +66,7 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Objects;
/**
* 寻宝-点击上传弹窗-道路
@ -81,14 +82,12 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
private EditText etDesc;
private Button btnRoadSave;
private RadioGroup rgType;
private PoiDatabase poiDatabase;
private PoiDao poiDao;
private Button roadUpload;
private File fileZip;
private FrameLayout fmRoadPic;
private NestedScrollView nestedScrollView;
private Marker markerRoad;
private LatLng latLng;
private TextView tvVideoAlbum;
public static RoadFragment newInstance(Bundle bundle) {
RoadFragment fragment = new RoadFragment();
@ -145,12 +144,14 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
@Override
protected void initView() {
super.initView();
poiDatabase = PoiDatabase.getInstance(getContext());
PoiDatabase poiDatabase = PoiDatabase.getInstance(getContext());
poiDao = poiDatabase.getPoiDao();
tvPictures = (TextView) findViewById(R.id.tv_pictures);
tvPictures.setOnClickListener(this::onClick);
tvPictures.setOnClickListener(this);
tvVideoAlbum = findViewById(R.id.tv_video_album);
tvVideoAlbum.setOnClickListener(this);
setSlidingUpPanelLayout(Constant.SLIDING_LAYOUT);
nestedScrollView = findViewById(R.id.nested_scroll_view);
NestedScrollView nestedScrollView = findViewById(R.id.nested_scroll_view);
if (slidingPaneLayout != null) {
slidingPaneLayout.setScrollableView(nestedScrollView);
}
@ -165,10 +166,10 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
btnRoadSave = (Button) findViewById(R.id.btn_road_save);
btnRoadSave.setOnClickListener(this::onClick);
rgType = (RadioGroup) findViewById(R.id.rg_type);
roadUpload = findViewById(R.id.road_upload);
Button roadUpload = findViewById(R.id.road_upload);
roadUpload.setOnClickListener(this::onClick);
showPictureType(1);
fmRoadPic.setOnClickListener(new View.OnClickListener() {
/*fmRoadPic.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (v.getTag() == null || ((List<File>) v.getTag()).size() == 0) {
@ -183,7 +184,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
intent.putExtra("poiEntity", showPoiEntity);
startActivityForResult(intent, 0x101);
}
});
});*/
fmRoadPic.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
@ -191,9 +192,9 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
MessageDialog.show((AppCompatActivity) getContext(), "提示", "是否删除", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
List<File> videoFileListByUUID = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(showPoiEntity.getId());
for (int i = 0; i < videoFileListByUUID.size(); i++) {
videoFileListByUUID.get(i).delete();
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
for (int i = 0; i < fileListByUUID.size(); i++) {
fileListByUUID.get(i).delete();
}
ivRoadPicture.setImageDrawable(null);
return false;
@ -211,11 +212,12 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
private void initShowPoi() {
// 添加信息
assert getArguments() != null;
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
if (showPoiEntity != null) {
String name = showPoiEntity.getName();//名称
if (name != null && !name.equals("")) {
etRoadName.setText(name + "");
etRoadName.setText(name);
}
String x = showPoiEntity.getX();
String y = showPoiEntity.getY();
@ -234,18 +236,17 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
if (describe != null && !describe.equals("")) {
etDesc.setText(describe);
}
String photoList = showPoiEntity.getPhoto();
String photoList = showPoiEntity.getPhoto();//存儲在數據庫中的數據
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 (photos.length > 0) {
for (String photo : photos) {
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.getPath().contains(".mp4") && !videoFile.getPath().contains(".mp4.txt")) {
if (videoFile.exists() && !isImageLoad) {
// 使用glide加载视频的第一帧
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivRoadPicture, 500);
@ -254,20 +255,20 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
}
}
}
fmRoadPic.setTag(videoFileList);
}
}
}
assert showPoiEntity != null;
if (showPoiEntity.getTaskStatus() == 3) {
disables();
}
}
//禁用控件
private void disables() {
fmRoadPic.setEnabled(false);
tvVideoAlbum.setEnabled(false);
etRoadName.setEnabled(false);
rgType.setEnabled(false);
ivRoadPicture.setEnabled(false);
@ -285,6 +286,24 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
if ((boolean) data.obj) {
initRoadSharePre();
}
} else if (data.what == Constant.VIDEO_FINISH_ROAD) {
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
if (fileListByUUID.size()==0) {
ivRoadPicture.setImageDrawable(null);
} else {
boolean isImageLoad = false;
for (int i = 0; i < fileListByUUID.size(); i++) {
File videoFile = fileListByUUID.get(i);
if (videoFile.getPath().contains(".mp4") && !videoFile.getPath().contains(".mp4.txt")) {
if (videoFile.exists() && !isImageLoad) {
// 使用glide加载视频的第一帧
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivRoadPicture, 500);
isImageLoad = true;
}
}
}
fmRoadPic.setTag(fileListByUUID);
}
}
}
@ -294,6 +313,19 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
case R.id.btn_road_save:
initPoiSaveLocal(false);
break;
case R.id.tv_video_album:
if (fmRoadPic.getTag() == null) {
Toast.makeText(getContext(), "请录像后才可以查看", Toast.LENGTH_SHORT).show();
return;
}
if (tvPictures.isEnabled()) {
showPoiEntity.setRecord_way(1);
Intent photoAlbumIntent = new Intent(getActivity(), FragmentManagement.class);
photoAlbumIntent.putExtra("tag", 37);
photoAlbumIntent.putExtra("showPoiEntity", showPoiEntity);
startActivity(photoAlbumIntent);
}
break;
case R.id.tv_pictures:
// 根据用户点击的时间为视频名称赋值
@ -318,7 +350,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
ZipUtil.zipFiles(videoFileList, fileZip, null);//压缩
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
if (poiDaoPoiEntity == null || poiDaoPoiEntity.getTaskStatus() == 1 || poiDaoPoiEntity.getTaskStatus() == 2 || poiDaoPoiEntity.getTaskStatus() == 0 || poiDaoPoiEntity.getTaskStatus() == 5) {
getActivity().runOnUiThread(new Runnable() {
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
@Override
public void run() {
dismissLoadingDialog();
@ -327,7 +359,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
});
} else {
getActivity().runOnUiThread(new Runnable() {
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
@Override
public void run() {
dismissLoadingDialog();
@ -365,7 +397,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
@Override
public void run() {
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
getActivity().runOnUiThread(new Runnable() {
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
@Override
public void run() {
roadSaveBetWork(poiEntity, isLocal);
@ -384,7 +416,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
if (never) {
Toast.makeText(getActivity(), "被永久拒绝授权,请手动授予权限", Toast.LENGTH_SHORT).show();
// 如果是被永久拒绝就跳转到应用权限系统设置页面
XXPermissions.startPermissionActivity(getActivity(), permissions);
XXPermissions.startPermissionActivity(Objects.requireNonNull(getActivity()), permissions);
}
}
@ -424,7 +456,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
poiDao.deletePoiEntity(poiDaoPoiEntity);
getActivity().runOnUiThread(new Runnable() {
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
@ -478,7 +510,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
@Override
public void run() {
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
getActivity().runOnUiThread(new Runnable() {
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
@Override
public void run() {
if (isLocal) {
@ -521,8 +553,8 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
if (resultCode == 0x101) {
if (data != null && data.hasExtra(Constant.INTENT_VIDEO_PATH)) {
// 扫描照片目录中当前视频的所有视频文件
String videoPath = data.getStringExtra(Constant.INTENT_VIDEO_PATH);
assert videoPath != null;
File videoFile = new File(videoPath);
if (videoFile.exists()) {
Bitmap bitmap = AWMp4ParserHelper.getInstance().getLocalVideoBitmap(videoPath);
@ -530,7 +562,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
int width = bitmap.getWidth();
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
MessageDialog.show((AppCompatActivity) getContext(), "提示", "请重新录像,要求横屏录像", "确定").setOkButton(new OnDialogButtonClickListener() {
MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getContext()), "提示", "请重新录像,要求横屏录像", "确定").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
Intent intentPanorama = new Intent(getActivity(), PictureActivity.class);
@ -541,12 +573,11 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
return false;
}
});
return;
} else {
if (videoFile.exists()) {
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivRoadPicture, 500);
List<File> videoFileListByUUID = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(showPoiEntity.getId());
fmRoadPic.setTag(videoFileListByUUID);
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
fmRoadPic.setTag(fileListByUUID);
}
}
@ -571,7 +602,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
//表示文件名系统将会在/dada/dada/包名/shared_prefs目录下生成
//一个以该参数命名的.xml文件第二个mode表示创建的模式通过查看
//方法注释得知建议以0或者MODE_PRIVATE为默认值
SharedPreferences poi = getActivity().getSharedPreferences(Constant.DATA_FILE, 0);
SharedPreferences poi = Objects.requireNonNull(getActivity()).getSharedPreferences(Constant.DATA_FILE, 0);
//获取Editor对象
SharedPreferences.Editor edit = poi.edit();
//根据要保存的数据的类型调用对应的put方法,
@ -580,7 +611,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
//以键值对的形式添加新值
edit.putString("poiEntity", newPoiEntity);
//提交新值必须执行否则前面的操作都无效
edit.commit();
edit.apply();
Log.d("TAG", "initRoadSharePre: " + newPoiEntity);
}
@ -617,7 +648,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
if (showPoiEntity != null) {
if (showPoiEntity.getTaskStatus() == 5) {
initEndReceiveTask(HttpInterface.UNRECEIVED_POLYGON_TASK, showPoiEntity);
}else {
} else {
Message obtain = Message.obtain();
obtain.what = Constant.JOB_WORD_MONITOR;
obtain.obj = true;
@ -627,6 +658,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
}
}
@Override
public void onDestroy() {
if (EventBus.getDefault().isRegistered(this))//加上判断
@ -683,7 +715,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
@Override
protected PoiEntity initPoiEntityByUI(PoiEntity poiEntity) {
String roadName = etRoadName.getText().toString().trim();
if (roadName != null && !roadName.equals("")) {
if (!roadName.equals("")) {
poiEntity.setName(roadName);
} else {
DateFormat formatters = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
@ -702,7 +734,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
}
sb.append("-").append(formats);
poiEntity.setName(sb.toString());
getActivity().runOnUiThread(new Runnable() {
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
@Override
public void run() {
etRoadName.setText(sb);
@ -715,7 +747,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
poiEntity.setWork_type(pictureType);
}
String desc = etDesc.getText().toString().trim();
if (desc != null && !desc.equals("")) {
if (!desc.equals("")) {
poiEntity.setMemo(desc);
}
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -726,14 +758,14 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
poiEntity.setType(4);
poiEntity.setTaskStatus(2);
if (fmRoadPic.getTag() == null) {
List<File> videoFileListByUUID = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(showPoiEntity.getId());
if (videoFileListByUUID != null) {
fmRoadPic.setTag(videoFileListByUUID);
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
if (fileListByUUID != null) {
fmRoadPic.setTag(fileListByUUID);
}
}
if (fmRoadPic.getTag() != null && !((List<File>) fmRoadPic.getTag()).isEmpty()) {
List<LatLng> lineStringByVideoFileList = AWMp4ParserHelper.getInstance().getLineStringByVideoFileList((List<File>) fmRoadPic.getTag());
String lineString = GeometryTools.getLineString(lineStringByVideoFileList);
List<LatLng> lineStringByFileList = AWMp4ParserHelper.getInstance().getLineStringByFileList((List<File>) fmRoadPic.getTag());
String lineString = GeometryTools.getLineString(lineStringByFileList);
Log.d("TAG", "onGranted: " + lineString);
String photoStr = AWMp4ParserHelper.getInstance().getVideoFileListStr((List<File>) fmRoadPic.getTag());
poiEntity.setPhoto(photoStr);

View File

@ -1,20 +1,29 @@
package com.navinfo.outdoor.fragment;
import android.os.Bundle;
import android.os.Message;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.adapter.PhotoAdapter;
import com.navinfo.outdoor.adapter.VideoAdapter;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseFragment;
import com.navinfo.outdoor.bean.FileBean;
import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.util.AWMp4ParserHelper;
import org.greenrobot.eventbus.EventBus;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@ -23,7 +32,10 @@ import java.util.Objects;
*/
public class VideoFragment extends BaseFragment implements View.OnClickListener {
private List<File> fileListByUUID;
private ArrayList<FileBean> fileBeans;
private ArrayList<FileBean> deleteFiles;
private VideoAdapter videoAdapter;
public static VideoFragment newInstance(Bundle bundle) {
VideoFragment fragment = new VideoFragment();
@ -35,28 +47,77 @@ public class VideoFragment extends BaseFragment implements View.OnClickListener
protected int getLayout() {
return R.layout.fragment_video;
}
@Override
public void onResume() {
super.onResume();
getFocus();
}
//主界面获取焦点
private void getFocus() {
Objects.requireNonNull(getView()).setFocusableInTouchMode(true);
getView().requestFocus();
getView().setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
Message message = new Message();
message.what= Constant.VIDEO_FINISH_ROAD;
EventBus.getDefault().post(message);
Objects.requireNonNull(getActivity()).finish();
return true;
}
return false;
}
});
}
@Override
protected void initView() {
super.initView();
PoiEntity showPoiEntity = (PoiEntity) Objects.requireNonNull(getActivity()).getIntent().getSerializableExtra("showPoiEntity");
deleteFiles = new ArrayList<>();
ArrayList<File> textFile = new ArrayList<>();
if (showPoiEntity != null) {
String id = showPoiEntity.getId();
if (showPoiEntity.getRecord_way() == 2) {
fileListByUUID = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(id);
if (showPoiEntity.getRecord_way() == 1) {
fileBeans = new ArrayList<>();
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(id);
for (int i = 0; i < fileListByUUID.size(); i++) {
if (!fileListByUUID.get(i).getPath().contains(".txt")) {
FileBean fileBean = new FileBean(fileListByUUID.get(i), false);
fileBeans.add(fileBean);
}else {
textFile.add(fileListByUUID.get(i));
}
}
}
}
ImageView ivPhotoFinal =(ImageView) findViewById(R.id.iv_video_final);
ImageView ivPhotoFinal = (ImageView) findViewById(R.id.iv_video_final);
ivPhotoFinal.setOnClickListener(this);
TextView tvPhotoChoose =(TextView) findViewById(R.id.tv_video_choose);
tvPhotoChoose.setOnClickListener(this);
TextView tvPhotoAlbumDelete =(TextView) findViewById(R.id.tv_video_album_delete);
TextView tvPhotoAlbumDelete = (TextView) findViewById(R.id.tv_video_album_delete);
tvPhotoAlbumDelete.setOnClickListener(this);
RecyclerView videoRecycler = findViewById(R.id.video_album_recycler);
videoRecycler.setLayoutManager(new GridLayoutManager(getContext(), 2));
VideoAdapter videoAdapter = new VideoAdapter(fileListByUUID, getContext());
videoAdapter = new VideoAdapter(fileBeans, getContext());
videoAdapter.setTextFile(textFile);
videoRecycler.setAdapter(videoAdapter);
videoAdapter.setPhotoClickItem(new VideoAdapter.photoClickItem() {
@Override
public void item(boolean isBoolean, FileBean fileBean) {
if (isBoolean) {
deleteFiles.add(fileBean);
} else {
if (deleteFiles != null) {
for (int i = 0; i < deleteFiles.size(); i++) {
if (fileBean.getFile().getPath().equals(deleteFiles.get(i).getFile().getPath())) {
deleteFiles.remove(fileBean);
}
}
}
}
}
});
}
@Override
@ -68,8 +129,21 @@ public class VideoFragment extends BaseFragment implements View.OnClickListener
public void onClick(View v) {
switch (v.getId()) {
case R.id.iv_video_final:
Message message = new Message();
message.what= Constant.VIDEO_FINISH_ROAD;
EventBus.getDefault().post(message);
Objects.requireNonNull(getActivity()).finish();
break;
case R.id.tv_video_album_delete:
if (fileBeans != null) {
for (int i = 0; i < fileBeans.size(); i++) {
videoAdapter.deleteFile(fileBeans.get(i));
}
} else {
Toast.makeText(getContext(), "请选择要删除的数据后才可以删除", Toast.LENGTH_SHORT).show();
}
break;
}
}

View File

@ -295,39 +295,22 @@ public class AWMp4ParserHelper {
/**
* 根据提供的uuid获取指定目录下所有的视频文件
* */
public List<File> getVideoFileListByUUID(String uuid) {
List<File> videoFileList = new ArrayList<>();
public List<File> getFileListByUUID(String uuid) {
List<File> fileList = new ArrayList<>();
if (StringUtils.isEmpty(uuid)) {
return videoFileList;
return fileList;
}
File folderFile = new File(Constant.PICTURE_FOLDER+"/"+uuid+"/");
if (!folderFile.exists()) {
folderFile.mkdirs();
return videoFileList;
return fileList;
}
for (File videoFile: folderFile.listFiles()) {
videoFileList.add(videoFile);
fileList.add(videoFile);
}
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;
return fileList;
}
public String getVideoFileListStr(List<File> videoFileList) {
StringBuilder resultStrBuilder = new StringBuilder("");
if (videoFileList == null || videoFileList.size()<=0){
@ -347,37 +330,7 @@ public class AWMp4ParserHelper {
/**
* 根据视频文件列表获取到对应的轨迹数据
* */
public List<LatLng> getLineStringByVideoFileList(List<File> videoFileList) {
List<LatLng> latLngs = new ArrayList<>();
if (videoFileList == null || videoFileList.isEmpty()) {
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) {
public List<LatLng> getLineStringByFileList(List<File> videoFileList) {
List<LatLng> latLngs = new ArrayList<>();
if (videoFileList == null || videoFileList.isEmpty()) {
return latLngs;

View File

@ -75,7 +75,7 @@ public class PoiSaveUtils {
}
}
}
}else {//其他类型
} else {//其他类型
if (savePoiNet(poiEntity) == 200) { // 网络保存成功
//走上传流程
uploadPoiNet(poiEntity);
@ -257,13 +257,7 @@ public class PoiSaveUtils {
}
}
}
List<File> videoFileList=null;
if (poiEntity.getRecord_way()==1){
videoFileList = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(poiEntity.getId());
}else if (poiEntity.getRecord_way()==2){
videoFileList = AWMp4ParserHelper.getInstance().getJPGFileListByUUID(poiEntity.getId());
}
List<File> videoFileList = AWMp4ParserHelper.getInstance().getFileListByUUID(poiEntity.getId());
if (videoFileList != null && !videoFileList.isEmpty()) {
List<File> txtFileList = new ArrayList<>();
for (File videoFile : videoFileList) {
@ -273,7 +267,7 @@ public class PoiSaveUtils {
videoFileList.addAll(txtFileList);
File fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
ZipUtil.zipFiles(videoFileList, fileZip, null);
if (fileZip!=null){
if (fileZip != null) {
photoFile.add(fileZip);
}
}
@ -313,11 +307,11 @@ public class PoiSaveUtils {
OtherUploadPicBean otherUploadPicBean = gson.fromJson(bodyStr, OtherUploadPicBean.class);
if (otherUploadPicBean.getCode() == 200) {
PoiDatabase.getInstance(mContext).getPoiDao().deletePoiEntity(poiEntity);
Log.d("TAGss", "uploadPoiNet: 成功"+anInt);
Log.d("TAGss", "uploadPoiNet: 成功" + anInt);
anInt++;
return;
} else {
Log.d("TAGss", "uploadPoiNet: 失败"+bInt);
Log.d("TAGss", "uploadPoiNet: 失败" + bInt);
bInt++;
return;
}
@ -360,7 +354,7 @@ public class PoiSaveUtils {
// 依次上传充电桩数据如果有一条数据未上传成功则返回false
for (ChargingPileEntity pileEntity : chargingPileEntityList) {
if (pileEntity.getBodyId() == 0) {
int saveResult = saveChargingPile2NetWork(pileEntity,poiEntity.getBodyId());
int saveResult = saveChargingPile2NetWork(pileEntity, poiEntity.getBodyId());
if (saveResult == 200) {
result = result & true;
} else {
@ -398,7 +392,7 @@ public class PoiSaveUtils {
.url(HttpInterface.SUBMIT_CSTASK)
.token(Constant.ACCESS_TOKEN)
.params(httpParams).getSynchronization();
if (execute==null){
if (execute == null) {
return -1;
}
if (execute.code() != 200) {
@ -472,15 +466,15 @@ public class PoiSaveUtils {
}
try {
HttpParams httpParams=new HttpParams();
httpParams.put("auditId",chargingPileEntity.getBodyId());
HttpParams httpParams = new HttpParams();
httpParams.put("auditId", chargingPileEntity.getBodyId());
Response execute = OkGoBuilder.getInstance()
.Builder(mContext)
.url(HttpInterface.CS_TASK_UP_LOAD_PIC)
.token(Constant.ACCESS_TOKEN)
.params(httpParams)
.fileList(chargingPileFileList).postFileSynchronization();
if (execute==null){
if (execute == null) {
return -1;
}
if (execute.code() != 200) {

View File

@ -2,8 +2,7 @@
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M11.67,3.87L9.9,2.1 0,12l9.9,9.9 1.77,-1.77L3.54,12z"/>

View File

@ -0,0 +1,5 @@
<vector android:alpha="1" android:height="40dp"
android:tint="#ffff" android:viewportHeight="40"
android:viewportWidth="40" android:width="40dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M10,16.5l6,-4.5 -6,-4.5v9zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8z"/>
</vector>

View File

@ -1,32 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/full_image_root"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#F4EEEE" >
android:background="#F4EEEE">
<LinearLayout
android:id="@+id/rl_image_show"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#1BA5F1"
android:paddingTop="@dimen/top_pind_sp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/iv_image_show"
android:layout_width="wrap_content"
android:layout_height="45dp"
android:layout_marginStart="15dp"
android:src="@drawable/icon_arrow"
/>
<TextView
android:id="@+id/tv_image_show"
android:layout_width="wrap_content"
style="@style/text_style_toolbar_title"
android:text="图片详情" />
</LinearLayout>
<androidx.viewpager.widget.ViewPager
android:id="@+id/image_pager"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/rl_image_show" />
<ImageView
android:id="@+id/download"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="15.0dip"
android:layout_marginRight="15.0dip"
android:src="@drawable/ic_baseline_arrow_back" />
<TextView
android:id="@+id/page_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@id/download"
android:layout_marginLeft="15.0dip"
android:textColor="#ffeeeeee"
android:textSize="12.0sp" />
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/rl_video"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#1BA5F1"
android:paddingTop="@dimen/top_pind_sp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/iv_video"
android:layout_width="wrap_content"
android:layout_height="45dp"
android:layout_marginStart="15dp"
android:src="@drawable/icon_arrow"
/>
<TextView
android:id="@+id/tv_video"
android:layout_width="wrap_content"
style="@style/text_style_toolbar_title"
android:text="查看视频" />
</LinearLayout>
<cn.jzvd.JzvdStd
android:id="@+id/jz_video"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/rl_user" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
<RelativeLayout
android:id="@+id/rl_photo_album"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -25,32 +25,20 @@
<TextView
android:id="@+id/tv_event"
android:layout_toEndOf="@id/iv_photo_final"
style="@style/text_style_toolbar_title"
android:layout_width="wrap_content"
android:text="查看图片" />
</LinearLayout>
<TextView
android:id="@+id/tv_photo_album_delete"
android:layout_width="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
style="@style/text_style_toolbar_title"
android:text="删除" />
<TextView
android:id="@+id/tv_photo_choose"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="选择"
android:textColor="@color/black"
android:textSize="16sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/rl_photo_album"/>
</RelativeLayout>
<TextView
android:id="@+id/tv_photo_album_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="删除"
android:textColor="@color/black"
android:textSize="16sp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/rl_photo_album"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/photo_album_recycler"
@ -59,5 +47,5 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_photo_album_delete" />
app:layout_constraintTop_toBottomOf="@+id/rl_photo_album" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -157,6 +157,16 @@
android:text="点击录像"
android:textColor="@color/white"
android:textSize="15sp" />
<TextView
android:id="@+id/tv_video_album"
style="@style/user_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="center"
android:text="点击查看成果"
android:textColor="@color/white"
android:textSize="15sp" />
</LinearLayout>

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
<RelativeLayout
android:id="@+id/rl_video_album"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -25,32 +25,19 @@
<TextView
android:id="@+id/tv_event"
android:layout_toEndOf="@id/iv_video_final"
style="@style/text_style_toolbar_title"
android:layout_width="wrap_content"
android:text="查看視頻" />
</LinearLayout>
<TextView
android:id="@+id/tv_video_album_delete"
android:layout_width="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
style="@style/text_style_toolbar_title"
android:text="删除" />
<TextView
android:id="@+id/tv_video_choose"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="选择"
android:textColor="@color/black"
android:textSize="16sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/rl_video_album"/>
<TextView
android:id="@+id/tv_video_album_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="删除"
android:textColor="@color/black"
android:textSize="16sp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/rl_video_album"/>
</RelativeLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/video_album_recycler"
@ -59,5 +46,5 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_video_album_delete" />
app:layout_constraintTop_toBottomOf="@+id/rl_video_album" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -2,27 +2,27 @@
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/iv_photo"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_margin="5dp"
android:scaleType="fitXY"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<CheckBox
android:id="@+id/check_photo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_photo"
android:layout_width="0dp"
android:layout_height="150dp"
android:layout_margin="5dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="@+id/check_photo"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
android:layout_margin="2dp"
android:buttonTint="@color/white"
app:layout_constraintBottom_toBottomOf="@+id/iv_photo"
app:layout_constraintEnd_toEndOf="@+id/iv_photo" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -4,25 +4,34 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/iv_video"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_margin="5dp"
android:scaleType="fitXY"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@drawable/ic_baseline_play"
app:layout_constraintBottom_toBottomOf="@+id/iv_video"
app:layout_constraintEnd_toEndOf="@+id/iv_video"
app:layout_constraintStart_toStartOf="@+id/iv_video"
app:layout_constraintTop_toTopOf="@+id/iv_video" />
<CheckBox
android:id="@+id/check_video"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_video"
android:layout_width="0dp"
android:layout_height="150dp"
android:layout_margin="5dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="@+id/check_video"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
android:layout_margin="2dp"
android:buttonTint="@color/white"
app:layout_constraintBottom_toBottomOf="@id/iv_video"
app:layout_constraintEnd_toEndOf="@id/iv_video" />
</androidx.constraintlayout.widget.ConstraintLayout>