修改1、2、3级bug(部分)

This commit is contained in:
md 2021-08-03 16:54:33 +08:00
parent eccc2fdadb
commit 839c96e638
12 changed files with 601 additions and 374 deletions

View File

@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
android { android {
compileSdkVersion 29 compileSdkVersion 29
buildToolsVersion '29.0.2' buildToolsVersion '29.0.2'
// ndkVersion '23.0.7123448' ndkVersion '23.0.7123448'
defaultConfig { defaultConfig {
applicationId "com.navinfo.outdoor" applicationId "com.navinfo.outdoor"

View File

@ -43,8 +43,6 @@
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.WhiteScreen"> android:theme="@style/Theme.WhiteScreen">
<activity android:name=".activity.PicturesActivity" <activity android:name=".activity.PicturesActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|navigation"
android:screenOrientation="portrait"
> >
</activity> </activity>

View File

@ -96,7 +96,7 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
private TextureMapView ivMap; private TextureMapView ivMap;
private CheckBox captureVideo; // 拍摄视频 private CheckBox captureVideo; // 拍摄视频
private Button btnVideo, stopVideo; private Button btnVideo, stopVideo;
private ImageView ivPic;
private String finalVideoPath; // 摄像后最终保存的文件名 private String finalVideoPath; // 摄像后最终保存的文件名
private File tmpFile; // 合并文件的临时文件路径 private File tmpFile; // 合并文件的临时文件路径
private Timer timer; private Timer timer;
@ -131,7 +131,6 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
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);
ivPic = findViewById(R.id.iv_pic);
btnVideo = findViewById(R.id.btn_video); btnVideo = findViewById(R.id.btn_video);
btnVideo.setOnClickListener(this::onClick); btnVideo.setOnClickListener(this::onClick);
btnSwitch = (Button) findViewById(R.id.btn_switch); btnSwitch = (Button) findViewById(R.id.btn_switch);
@ -443,7 +442,6 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
} }
public void btnSwich() { public void btnSwich() {
DisplayMetrics dm = new DisplayMetrics(); DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm); getWindowManager().getDefaultDisplay().getMetrics(dm);
System.out.println("width-display :" + dm.widthPixels); System.out.println("width-display :" + dm.widthPixels);
@ -457,7 +455,7 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
layerChange.removeAllViews(); layerChange.removeAllViews();
if (widthMap > widthCamera) { if (widthMap > widthCamera) {
ivPic.setVisibility(View.VISIBLE);
layoutParamsCamera.width = dm.widthPixels; layoutParamsCamera.width = dm.widthPixels;
layoutParamsCamera.height = dm.heightPixels; layoutParamsCamera.height = dm.heightPixels;
layoutParamsMap.height = heightCamera; layoutParamsMap.height = heightCamera;
@ -467,7 +465,7 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
layerChange.addView(camera); layerChange.addView(camera);
layerChange.addView(ivMap); layerChange.addView(ivMap);
} else { } else {
ivPic.setVisibility(View.GONE);
layoutParamsMap.height = dm.heightPixels; layoutParamsMap.height = dm.heightPixels;
layoutParamsMap.width = dm.widthPixels; layoutParamsMap.width = dm.widthPixels;
layoutParamsCamera.height = heightMap; layoutParamsCamera.height = heightMap;

View File

@ -5,116 +5,543 @@ import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import android.app.Activity; import android.app.Activity;
import android.content.Intent;
import android.content.pm.ActivityInfo; import android.content.pm.ActivityInfo;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.os.Bundle; import android.os.Bundle;
import android.os.Message;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.FrameLayout;
import android.widget.Toast; import android.widget.Toast;
import com.github.lazylibrary.util.DensityUtil;
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.util.AWMp4ParserHelper;
import com.navinfo.outdoor.util.MyTecentLocationSource;
import com.otaliastudios.cameraview.CameraException;
import com.otaliastudios.cameraview.CameraListener; import com.otaliastudios.cameraview.CameraListener;
import com.otaliastudios.cameraview.CameraLogger; import com.otaliastudios.cameraview.CameraLogger;
import com.otaliastudios.cameraview.CameraView; import com.otaliastudios.cameraview.CameraView;
import com.otaliastudios.cameraview.FileCallback;
import com.otaliastudios.cameraview.PictureResult;
import com.otaliastudios.cameraview.VideoResult; import com.otaliastudios.cameraview.VideoResult;
import com.otaliastudios.cameraview.controls.Engine; import com.otaliastudios.cameraview.controls.Engine;
import com.otaliastudios.cameraview.controls.Mode; import com.otaliastudios.cameraview.controls.Mode;
import com.otaliastudios.cameraview.size.AspectRatio;
import com.otaliastudios.cameraview.size.SizeSelector;
import com.otaliastudios.cameraview.size.SizeSelectors;
import com.tencent.tencentmap.mapsdk.maps.CameraUpdate;
import com.tencent.tencentmap.mapsdk.maps.CameraUpdateFactory;
import com.tencent.tencentmap.mapsdk.maps.MapView; 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.UiSettings; import com.tencent.tencentmap.mapsdk.maps.UiSettings;
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
import com.tencent.tencentmap.mapsdk.maps.model.CameraPosition;
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
import com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.io.File; import java.io.File;
import java.io.FileDescriptor;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import static com.navinfo.outdoor.R.drawable.location;
import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE;
public class PicturesActivity extends BaseActivity implements View.OnClickListener { public class PicturesActivity extends BaseActivity implements View.OnClickListener {
private static final CameraLogger LOG = CameraLogger.create("Picture"); private static final CameraLogger LOG = CameraLogger.create("Picture");
private com.otaliastudios.cameraview.CameraView cameraView; private CameraView camera;
private android.widget.Button capuretVideo; private long captureTime = 0;
private android.widget.Button btnStopVideo; private android.widget.Button btnSwitch;
// private MapView ivMap; private TencentMap tencentMap;
// private TencentMap tencentMap; private MyLocationStyle locationStyle;
private TextureMapView ivMap;
private CheckBox captureVideo; // 拍摄视频
private Button btnVideo, stopVideo;
private String finalVideoPath; // 摄像后最终保存的文件名
private File tmpFile; // 合并文件的临时文件路径
private Timer timer;
private CsvTimerTask timerTask; // 执行定时写入csv文件的task
private DateFormat formatter;
private final long period = 1; // 记录csv文件的间隔时间单位为秒
private ViewGroup layerChange; // 切换地图和相机的父控件
private boolean isFinishActivity = false; // 是否需要关闭当前activity
@Override @Override
protected int getLayout() { protected int getLayout() {
EventBus.getDefault().register(this);
tmpFile = new File(Constant.PICTURE_FOLDER, "temp.mp4");
formatter = new SimpleDateFormat("yyyyMMdd HHmmss");
return R.layout.activity_pictures; return R.layout.activity_pictures;
} }
//
@Override @Override
protected void initView() { protected void initView() {
super.initView(); super.initView();
cameraView = (CameraView) findViewById(R.id.cameraView);
capuretVideo = (Button) findViewById(R.id.capuretVideo); if (getIntent()!=null) {
capuretVideo.setOnClickListener(this::onClick); finalVideoPath = getIntent().getStringExtra(Constant.INTENT_VIDEO_PATH);
btnStopVideo = (Button) findViewById(R.id.btn_stop_video); }
btnStopVideo.setOnClickListener(this::onClick); if (finalVideoPath == null) {
// ivMap = findViewById(R.id.iv_map); finalVideoPath = Constant.PICTURE_FOLDER+"/final.mp4";
cameraView.setLifecycleOwner(this); }
cameraView.setEngine(Engine.CAMERA1);
cameraView.setMode(Mode.VIDEO); layerChange = findViewById(R.id.layer_change);
cameraView.addCameraListener(new CameraListener() {
timer = new Timer();
// this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
ivMap = (TextureMapView) findViewById(R.id.iv_map);
btnVideo = findViewById(R.id.btn_video);
btnVideo.setOnClickListener(this::onClick);
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);
camera.setOnClickListener(this::onClick);
captureVideo = findViewById(R.id.capuretVideo);
captureVideo.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) { // 开始采集设置按钮文字内容为结束采集
captureVideo.setText("暂停采集");
// stopVideo.setEnabled(false);// 开始采集视频后禁用停止采集的按钮必须暂停采集后才可点击停止采集
startTakenVideo(); // 开始采集视频
} else {
stopTakenVideo();
captureVideo.setText("开始采集");
}
}
});
stopVideo = findViewById(R.id.btn_stop_video);
stopVideo.setOnClickListener(this::onClick);
//拍照权限
camera.setLifecycleOwner(this);
camera.setEngine(Engine.CAMERA1);
// camera.setVideoBitRate(5);
camera.setPreviewFrameRate(5); // 设置预览视频的帧率
// 设置视频可用的宽高size
SizeSelector width = SizeSelectors.maxWidth(1920);
SizeSelector height = SizeSelectors.maxHeight(1440);
SizeSelector dimensions = SizeSelectors.and(width, height); // Matches sizes bigger than 1000x2000.
// 获取屏幕信息
int[] density = DensityUtil.getDeviceInfo(this);
int x=1920, y=1440;
if (density!=null&&density.length>1) {
x = (density[0]>=density[1]?density[0]:density[1]);
y = (density[0]>=density[1]?density[1]:density[0]);
}
SizeSelector ratio = SizeSelectors.aspectRatio(AspectRatio.of(x, y), 0); // Matches 1:1 sizes.
SizeSelector result = SizeSelectors.or(
SizeSelectors.and(ratio, dimensions), // Try to match both constraints
ratio, // If none is found, at least try to match the aspect ratio
SizeSelectors.biggest() // If none is found, take the biggest
);
camera.setVideoSize(result);
camera.setVideoBitRate(1920*1440);
// camera.setAudioBitRate();
//获取地图
tencentMap = ivMap.getMap();
//获取地图UI 设置对象
UiSettings uiSettings = tencentMap.getUiSettings();
//设置logo的大小
uiSettings.setLogoScale(0.7f);
// uiSettings.setAllGesturesEnabled(false);
setLocMarkerStyle(); // 设置当前位置显示样式
// 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);
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
String format = formatter.format(calendar.getTime());
//文件
File file = new File(Constant.PICTURE_FOLDER, format + ".jpg");
result.toFile(file, new FileCallback() {
@Override
public void onFileReady(@Nullable @org.jetbrains.annotations.Nullable File file) {
Toast.makeText(PicturesActivity.this, "保存成功:" + file.getPath(), Toast.LENGTH_SHORT).show();
}
});
if (camera.isTakingVideo()) {
message("Captured while taking video. Size=" + result.getSize(), false);
}
long callbackTime = System.currentTimeMillis();
captureTime = callbackTime - 300;
Log.d("captureTime", captureTime + "");
}
//录像监听
@Override @Override
public void onVideoTaken(@NonNull @NotNull VideoResult result) { public void onVideoTaken(@NonNull @NotNull VideoResult result) {
super.onVideoTaken(result); super.onVideoTaken(result);
Toast.makeText(PicturesActivity.this, "停止摄像", Toast.LENGTH_SHORT).show(); Toast.makeText(PicturesActivity.this, "暂停摄像", Toast.LENGTH_SHORT).show();
finish(); 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
public void onCameraError(@NonNull @NotNull CameraException exception) {
super.onCameraError(exception);
Toast.makeText(PicturesActivity.this, exception.toString(), Toast.LENGTH_SHORT).show();
}
@Override
public void onVideoRecordingStart() {
super.onVideoRecordingStart();
/**
* 获取当前视频的时间记录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();
}
} }
}); });
// tencentMap = ivMap.getMap();
//获取地图UI 设置对象
// UiSettings uiSettings = tencentMap.getUiSettings();
// //设置logo的大小
// uiSettings.setLogoScale(0.7f);
// 修改相机的宽高为屏幕宽高的1/3
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
FrameLayout.LayoutParams layoutParamsMap = (FrameLayout.LayoutParams) ivMap.getLayoutParams();//相机的宽高
layoutParamsMap.height = dm.widthPixels/3;
layoutParamsMap.width = dm.heightPixels/3;
ivMap.setLayoutParams(layoutParamsMap);
} }
private void message(String content, Boolean important) {
if (important) {
LOG.w(content);
Toast.makeText(this, content, Toast.LENGTH_SHORT).show();
} else {
LOG.i(content);
Toast.makeText(this, content, Toast.LENGTH_SHORT).show();
}
}
@Override @Override
protected void initData() { protected void initData() {
super.initData(); super.initData();
camera.setMode(Mode.VIDEO);
} }
@Override @Override
public void onClick(View v) { public void onClick(View v) {
switch (v.getId()) { switch (v.getId()) {
case R.id.capuretVideo: // case R.id.capuretVideo:
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar calendar = Calendar.getInstance(); // Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis()); // calendar.setTimeInMillis(System.currentTimeMillis());
String format = formatter.format(calendar.getTime()); // String format = formatter.format(calendar.getTime());
//文件 // //文件
File file = new File(Constant.PICTURE_FOLDER, format + ".mp4"); // File file = new File(Constant.PICTURE_FOLDER, format + ".mp4");
cameraView.takeVideo(file, 15000); // cameraView.takeVideo(file, 15000);
// break;
case R.id.btn_stop_video:
if (timerTask!=null){
timerTask.cancel();
Intent intent = new Intent();
intent.putExtra(Constant.INTENT_VIDEO_PATH, finalVideoPath);
setResult(0x101, intent);
}else {
Toast.makeText(this, "本段视频没有计时!", Toast.LENGTH_SHORT).show();
}
if (camera.isTakingVideo()) {
isFinishActivity = true;
camera.stopVideo();
} else {
finish();
}
break;
case R.id.btn_switch:
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) {
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), resourceId);
int width = bitmap.getWidth();
int height = bitmap.getHeight();
int newWidth = 55;
int newHeight = 55;
float widthScale = ((float) newWidth) / width;
float heightScale = ((float) newHeight) / height;
Matrix matrix = new Matrix();
matrix.postScale(widthScale, heightScale);
bitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true);
return bitmap;
}
/**
* 设置定位图标样式
*/
private void setLocMarkerStyle() {
tencentMap.setLocationSource(new MyTecentLocationSource(this));
tencentMap.setMyLocationEnabled(true);
locationStyle = new MyLocationStyle();
locationStyle = locationStyle.myLocationType(LOCATION_TYPE_LOCATION_ROTATE);
//创建图标
BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromBitmap(getBitMap(location));
locationStyle.icon(bitmapDescriptor);
//设置定位圆形区域的边框宽度;
locationStyle.fillColor(getResources().getColor(android.R.color.transparent));
locationStyle.strokeWidth(1);
tencentMap.setMyLocationStyle(locationStyle);
}
public void btnSwich() {
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
System.out.println("width-display :" + dm.widthPixels);
System.out.println("heigth-display :" + dm.heightPixels);
FrameLayout.LayoutParams layoutParamsMap = (FrameLayout.LayoutParams) ivMap.getLayoutParams();//地图的宽高
int heightMap = ivMap.getMeasuredHeight();
int widthMap = ivMap.getMeasuredWidth();
FrameLayout.LayoutParams layoutParamsCamera = (FrameLayout.LayoutParams) camera.getLayoutParams();//相机的宽高
int heightCamera = camera.getMeasuredHeight();
int widthCamera = camera.getMeasuredWidth();
layerChange.removeAllViews();
if (widthMap > widthCamera) {
layoutParamsCamera.width = dm.widthPixels;
layoutParamsCamera.height = dm.heightPixels;
layoutParamsMap.height = heightCamera;
layoutParamsMap.width = widthCamera;
camera.setLayoutParams(layoutParamsCamera);
ivMap.setLayoutParams(layoutParamsMap);
layerChange.addView(camera);
layerChange.addView(ivMap);
} else {
layoutParamsMap.height = dm.heightPixels;
layoutParamsMap.width = dm.widthPixels;
layoutParamsCamera.height = heightMap;
layoutParamsCamera.width = widthMap;
camera.setLayoutParams(layoutParamsCamera);
ivMap.setLayoutParams(layoutParamsMap);
layerChange.addView(ivMap);
layerChange.addView(camera);
}
}
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
cameraView.open(); camera.open();
// ivMap.onResume();
} }
@Override @Override
protected void onPause() { protected void onPause() {
super.onPause(); super.onPause();
cameraView.close(); camera.close();
// ivMap.onPause();
} }
@Override @Override
protected void onDestroy() { protected void onDestroy() {
super.onDestroy(); super.onDestroy();
cameraView.destroy(); stopTakenVideo();
// ivMap.onDestroy(); camera.destroy();
timer.cancel();
if (EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().unregister(this);
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMessageMainThread(Message msg) {
switch (msg.what) {
case Constant.EVENT_WHAT_LOCATION_CHANGE: // 用户位置更新
if (tencentMap!=null) {
CameraUpdate cameraSigma =
CameraUpdateFactory.newCameraPosition(new CameraPosition(
new LatLng(Constant.currentLocation.getLatitude(),Constant.currentLocation.getLongitude()), //中心点坐标地图目标经纬度
16, //目标缩放级别
0, //目标倾斜角
0)); //目标旋转角 0~360° (正北方为0)
tencentMap.animateCamera(cameraSigma);
}
break;
}
}
/**
* 记录视频拍摄的时间及经纬度
*/
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");
FileUtils.writeFile(csvFile.getAbsolutePath(), sb.toString(), true);
currentVideoTime = currentVideoTime+period; //
}
} }
} }

View File

@ -78,7 +78,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
private CheckBox checkBoxLife, checkBoxRight; private CheckBox checkBoxLife, checkBoxRight;
private Spinner spinnerType, spinnerScutcheon, spinnerStake; private Spinner spinnerType, spinnerScutcheon, spinnerStake;
String[] type = new String[]{"地上五层", "地上四层", "地上三层", "地上二层", "地上一层", "地下一层", "地下二层", "地下三层", "地下四层", "地下五层"}; String[] type = new String[]{"地上五层", "地上四层", "地上三层", "地上二层", "地上一层", "地下一层", "地下二层", "地下三层", "地下四层", "地下五层"};
String[] scutcheon = new String[]{"存在","不存在"}; String[] scutcheon = new String[]{"存在", "不存在"};
String[] stake = new String[]{"可以使用", "不可使用", "维修中", "建设中", "规划中"}; String[] stake = new String[]{"可以使用", "不可使用", "维修中", "建设中", "规划中"};
private ArrayAdapter<String> adapterType, adapterScutcheon, adapterStake; private ArrayAdapter<String> adapterType, adapterScutcheon, adapterStake;
private RelativeLayout rlPanorama, rlCoding, rlEquipment, rlFacility, rlUsable, rlAvailable, rlParking, rlNumber, rlScutcheon, rlDevice; private RelativeLayout rlPanorama, rlCoding, rlEquipment, rlFacility, rlUsable, rlAvailable, rlParking, rlNumber, rlScutcheon, rlDevice;
@ -87,7 +87,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
private int cp_floor = 1; private int cp_floor = 1;
private int sign_exist = 0; private int sign_exist = 0;
private int cp_availableState = 0; private int cp_availableState = 0;
private String buffer1="",buffer2="",buffer3="",buffer4="",buffer5=""; private String buffer1 = "", buffer2 = "", buffer3 = "", buffer4 = "", buffer5 = "";
private StringBuffer openType = new StringBuffer(); private StringBuffer openType = new StringBuffer();
private CheckBox checkButton1, checkButton2, checkButton3, checkButton4, checkButton5; private CheckBox checkButton1, checkButton2, checkButton3, checkButton4, checkButton5;
private String pid; private String pid;
@ -171,14 +171,14 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
checkBoxLife.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { checkBoxLife.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked){ if (isChecked) {
checkBoxLife.setText("保存"); checkBoxLife.setText("保存");
checkBoxLife.setTextColor(Color.WHITE); checkBoxLife.setTextColor(Color.WHITE);
Message obtain = Message.obtain(); Message obtain = Message.obtain();
obtain.what = Constant.MAIN_CHARGING_PILE; obtain.what = Constant.MAIN_CHARGING_PILE;
obtain.obj = latLng; obtain.obj = latLng;
EventBus.getDefault().post(obtain); EventBus.getDefault().post(obtain);
}else { } else {
checkBoxLife.setText("编辑"); checkBoxLife.setText("编辑");
checkBoxLife.setTextColor(Color.BLACK); checkBoxLife.setTextColor(Color.BLACK);
Message obtain = Message.obtain(); Message obtain = Message.obtain();
@ -195,11 +195,11 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) { if (isChecked) {
buffer1="1,"; buffer1 = "1,";
buffer2=""; buffer2 = "";
buffer3=""; buffer3 = "";
buffer4=""; buffer4 = "";
buffer5=""; buffer5 = "";
checkButton2.setChecked(false); checkButton2.setChecked(false);
checkButton3.setChecked(false); checkButton3.setChecked(false);
checkButton4.setChecked(false); checkButton4.setChecked(false);
@ -212,10 +212,10 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) { if (isChecked) {
buffer2="2,"; buffer2 = "2,";
checkButton1.setChecked(false); checkButton1.setChecked(false);
}else { } else {
buffer2=""; buffer2 = "";
} }
} }
}); });
@ -224,10 +224,10 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) { if (isChecked) {
buffer3="3,"; buffer3 = "3,";
checkButton1.setChecked(false); checkButton1.setChecked(false);
}else { } else {
buffer3=""; buffer3 = "";
} }
} }
}); });
@ -236,10 +236,10 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) { if (isChecked) {
buffer4="4,"; buffer4 = "4,";
checkButton1.setChecked(false); checkButton1.setChecked(false);
}else { } else {
buffer4=""; buffer4 = "";
} }
} }
}); });
@ -248,10 +248,10 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) { if (isChecked) {
buffer5="5,"; buffer5 = "5,";
checkButton1.setChecked(false); checkButton1.setChecked(false);
}else { } else {
buffer5=""; buffer5 = "";
} }
} }
}); });
@ -398,9 +398,9 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
btnSaveLocal = findViewById(R.id.btn_save_local); btnSaveLocal = findViewById(R.id.btn_save_local);
btnSaveLocal.setOnClickListener(this::onClick); btnSaveLocal.setOnClickListener(this::onClick);
//展示数据 //展示数据
initShowPileSharePre(); initShowPileSharePre();
onLongDelPic(); onLongDelPic();
} }
@ -549,17 +549,13 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
private void initShowPileSharePre() { private void initShowPileSharePre() {
station = getArguments().getString("station"); station = getArguments().getString("station");
if (station!=null){ if (station != null) {
poiEntity = new Gson().fromJson(station, PoiEntity.class); poiEntity = new Gson().fromJson(station, PoiEntity.class);
pid = poiEntity.getId(); pid = poiEntity.getId();
taskId = poiEntity.getTaskId(); taskId = poiEntity.getTaskId();
String x = poiEntity.getX(); latLng = new LatLng();
String y = poiEntity.getY(); latLng.setLatitude(Constant.currentLocation.getLatitude());
if (x != null && y != null) { latLng.setLongitude(Constant.currentLocation.getLongitude());
latLng = new LatLng();
latLng.setLatitude(Double.parseDouble(y));
latLng.setLongitude(Double.parseDouble(x));
}
} }
// 添加信息 // 添加信息
ChargingPileEntity chargingPileEntity = (ChargingPileEntity) getArguments().getSerializable("chargingPileEntity"); ChargingPileEntity chargingPileEntity = (ChargingPileEntity) getArguments().getSerializable("chargingPileEntity");
@ -573,7 +569,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
latLng = GeometryTools.createLatLng(p); latLng = GeometryTools.createLatLng(p);
} }
String memo = chargingPileEntity.getMemo(); String memo = chargingPileEntity.getMemo();
if (memo != null&&!memo.equals("")) { if (memo != null && !memo.equals("")) {
editDescribe.setText(memo); editDescribe.setText(memo);
} }
String fid = chargingPileEntity.getFid(); String fid = chargingPileEntity.getFid();
@ -685,7 +681,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
spinnerScutcheon.setEnabled(false);//设备标牌下拉框 spinnerScutcheon.setEnabled(false);//设备标牌下拉框
rlEquipment.setEnabled(false);//(蓝色色)设备标牌 rlEquipment.setEnabled(false);//(蓝色色)设备标牌
rlFacility.setEnabled(false);//(白色)设备标牌 rlFacility.setEnabled(false);//(白色)设备标牌
spinnerStake.setEnabled(false);//桩可用状态 spinnerStake.setEnabled(false);//桩可用状态
rlUsable.setEnabled(false);//(蓝色)可用状态 rlUsable.setEnabled(false);//(蓝色)可用状态
rlAvailable.setEnabled(false);//(白色)可用状态 rlAvailable.setEnabled(false);//(白色)可用状态
rlParking.setEnabled(false);//(蓝色)停车位编号 rlParking.setEnabled(false);//(蓝色)停车位编号
@ -720,12 +716,12 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
if (all) { if (all) {
//保存数据库 //保存数据库
ChargingPileEntity chargingPileEntity = new ChargingPileEntity(); ChargingPileEntity chargingPileEntity = new ChargingPileEntity();
ArrayList<String> photoBean = new ArrayList<>(); ArrayList<String> photoBean = new ArrayList<>();
if (latLng == null || latLng.equals("")) { if (latLng == null || latLng.equals("")) {
Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show();
return; return;
} else { } else {
String encode = Geohash.getInstance().encode(latLng.latitude,latLng.longitude); String encode = Geohash.getInstance().encode(latLng.latitude, latLng.longitude);
chargingPileEntity.setP(encode); chargingPileEntity.setP(encode);
// poiEntity.setX(String.valueOf(latLng.longitude)); // poiEntity.setX(String.valueOf(latLng.longitude));
// poiEntity.setY(String.valueOf(latLng.latitude)); // poiEntity.setY(String.valueOf(latLng.latitude));
@ -753,7 +749,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
photoBean.add(tagCoding); photoBean.add(tagCoding);
} }
String tagEquipment = (String) ivEquipment.getTag(); String tagEquipment = (String) ivEquipment.getTag();
if (tagEquipment == null ) { if (tagEquipment == null) {
Toast.makeText(getActivity(), "请拍照 设备标牌", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "请拍照 设备标牌", Toast.LENGTH_SHORT).show();
return; return;
} else { } else {
@ -768,14 +764,14 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
photoBean.add(tagFacility); photoBean.add(tagFacility);
} }
} else { } else {
if (tagFacility != null ) { if (tagFacility != null) {
photoBean.add(tagFacility); photoBean.add(tagFacility);
} }
} }
String tagScutcheon = (String) ivScutcheon.getTag(); String tagScutcheon = (String) ivScutcheon.getTag();
if (sign_exist == 1) { if (sign_exist == 1) {
if (tagScutcheon == null ) { if (tagScutcheon == null) {
Toast.makeText(getActivity(), "请拍照 设备编码", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "请拍照 设备编码", Toast.LENGTH_SHORT).show();
return; return;
} else { } else {
@ -805,29 +801,29 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
photoBean.add(tagAvailable); photoBean.add(tagAvailable);
} }
String tagParking = (String) ivParking.getTag(); String tagParking = (String) ivParking.getTag();
if (tagParking == null ) { if (tagParking == null) {
Toast.makeText(getActivity(), "请拍照 停车位编号", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "请拍照 停车位编号", Toast.LENGTH_SHORT).show();
return; return;
} else { } else {
photoBean.add(tagPanorama); photoBean.add(tagPanorama);
} }
String tagNumber = (String) ivNumber.getTag(); String tagNumber = (String) ivNumber.getTag();
if (tagNumber != null ) { if (tagNumber != null) {
photoBean.add(tagNumber); photoBean.add(tagNumber);
} }
chargingPileEntity.setPhotos(photoBean); chargingPileEntity.setPhotos(photoBean);
if ("".equals(buffer1)&&"".equals(buffer2)&&"".equals(buffer3)&&"".equals(buffer4)&&"".equals(buffer5)) { if ("".equals(buffer1) && "".equals(buffer2) && "".equals(buffer3) && "".equals(buffer4) && "".equals(buffer5)) {
Toast.makeText(getActivity(), "开放状态未勾选", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "开放状态未勾选", Toast.LENGTH_SHORT).show();
return; return;
} }
if (buffer1!=null&&!buffer1.equals("")&&buffer1.length()>0){ if (buffer1 != null && !buffer1.equals("") && buffer1.length() > 0) {
openType.delete(0,openType.length()); openType.delete(0, openType.length());
openType.append(buffer1); openType.append(buffer1);
String charAt = openType.deleteCharAt(openType.length() - 1).toString(); String charAt = openType.deleteCharAt(openType.length() - 1).toString();
chargingPileEntity.setCp_openType(charAt); chargingPileEntity.setCp_openType(charAt);
}else { } else {
openType.delete(0,openType.length()); openType.delete(0, openType.length());
openType.append(buffer2); openType.append(buffer2);
openType.append(buffer3); openType.append(buffer3);
openType.append(buffer4); openType.append(buffer4);
@ -858,7 +854,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
getActivity().runOnUiThread(new Runnable() { getActivity().runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
if (result[0]!=0) { if (result[0] != 0) {
ToastUtil.showShort(getActivity(), "充电桩保存成功"); ToastUtil.showShort(getActivity(), "充电桩保存成功");
Message obtain = Message.obtain(); Message obtain = Message.obtain();
@ -992,43 +988,43 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
private void phoneList() { private void phoneList() {
phoneLists = new ArrayList<>(); phoneLists = new ArrayList<>();
String ivPanoramaTag = (String) ivPanorama.getTag(); String ivPanoramaTag = (String) ivPanorama.getTag();
if (ivPanoramaTag!=null){ if (ivPanoramaTag != null) {
phoneLists.add(new File(ivPanoramaTag)); phoneLists.add(new File(ivPanoramaTag));
} }
String ivCodingTag = (String) ivCoding.getTag(); String ivCodingTag = (String) ivCoding.getTag();
if (ivCodingTag!=null){ if (ivCodingTag != null) {
phoneLists.add(new File(ivCodingTag)); phoneLists.add(new File(ivCodingTag));
} }
String ivEquipmentTag = (String) ivEquipment.getTag(); String ivEquipmentTag = (String) ivEquipment.getTag();
if (ivEquipmentTag!=null){ if (ivEquipmentTag != null) {
phoneLists.add(new File(ivEquipmentTag)); phoneLists.add(new File(ivEquipmentTag));
} }
String ivFacilityTag = (String) ivFacility.getTag(); String ivFacilityTag = (String) ivFacility.getTag();
if (ivFacilityTag!=null){ if (ivFacilityTag != null) {
phoneLists.add(new File(ivFacilityTag)); phoneLists.add(new File(ivFacilityTag));
} }
String ivUsableTag = (String) ivUsable.getTag(); String ivUsableTag = (String) ivUsable.getTag();
if (ivUsableTag!=null){ if (ivUsableTag != null) {
phoneLists.add(new File(ivUsableTag)); phoneLists.add(new File(ivUsableTag));
} }
String ivAvailableTag = (String) ivAvailable.getTag(); String ivAvailableTag = (String) ivAvailable.getTag();
if (ivAvailableTag!=null){ if (ivAvailableTag != null) {
phoneLists.add(new File(ivAvailableTag)); phoneLists.add(new File(ivAvailableTag));
} }
String ivParkingTag = (String) ivParking.getTag(); String ivParkingTag = (String) ivParking.getTag();
if (ivParkingTag!=null){ if (ivParkingTag != null) {
phoneLists.add(new File(ivParkingTag)); phoneLists.add(new File(ivParkingTag));
} }
String ivNumberTag = (String) ivNumber.getTag(); String ivNumberTag = (String) ivNumber.getTag();
if (ivNumberTag!=null){ if (ivNumberTag != null) {
phoneLists.add(new File(ivNumberTag)); phoneLists.add(new File(ivNumberTag));
} }
String ivDeviceTag = (String) ivDevice.getTag(); String ivDeviceTag = (String) ivDevice.getTag();
if (ivDeviceTag!=null){ if (ivDeviceTag != null) {
phoneLists.add(new File(ivDeviceTag)); phoneLists.add(new File(ivDeviceTag));
} }
String ivScutcheonTag = (String) ivScutcheon.getTag(); String ivScutcheonTag = (String) ivScutcheon.getTag();
if (ivScutcheonTag!=null){ if (ivScutcheonTag != null) {
phoneLists.add(new File(ivScutcheonTag)); phoneLists.add(new File(ivScutcheonTag));
} }
} }
@ -1055,53 +1051,53 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
ChargingPileEntity chargingPileEntity = new ChargingPileEntity(); ChargingPileEntity chargingPileEntity = new ChargingPileEntity();
ArrayList<String> photo = new ArrayList<>(); ArrayList<String> photo = new ArrayList<>();
if (latLng != null) { if (latLng != null) {
chargingPileEntity.setP(latLng.latitude+","+latLng.longitude); chargingPileEntity.setP(latLng.latitude + "," + latLng.longitude);
} }
String name = tvNameContent.getText().toString().trim();//名称 String name = tvNameContent.getText().toString().trim();//名称
if (name != null &&!name.equals("")) { if (name != null && !name.equals("")) {
chargingPileEntity.setName(name); chargingPileEntity.setName(name);
} }
if (cp_floor != 0) { if (cp_floor != 0) {
chargingPileEntity.setCp_floor(cp_floor); chargingPileEntity.setCp_floor(cp_floor);
} }
String tagPanorama = (String) ivPanorama.getTag(); String tagPanorama = (String) ivPanorama.getTag();
if (tagPanorama != null &&!tagPanorama.equals("")) { if (tagPanorama != null && !tagPanorama.equals("")) {
photo.add(tagPanorama); photo.add(tagPanorama);
} }
String tagCoding = (String) ivCoding.getTag(); String tagCoding = (String) ivCoding.getTag();
if (tagCoding != null&&!tagCoding.equals("")) { if (tagCoding != null && !tagCoding.equals("")) {
photo.add(tagCoding); photo.add(tagCoding);
} }
String tagEquipment = (String) ivEquipment.getTag(); String tagEquipment = (String) ivEquipment.getTag();
if (tagEquipment != null&&!tagEquipment.equals("")) { if (tagEquipment != null && !tagEquipment.equals("")) {
photo.add(tagEquipment); photo.add(tagEquipment);
} }
String tagFacility = (String) ivFacility.getTag(); String tagFacility = (String) ivFacility.getTag();
if (tagFacility != null&&!tagFacility.equals("")) { if (tagFacility != null && !tagFacility.equals("")) {
photo.add(tagFacility); photo.add(tagFacility);
} }
String tagScutcheon = (String) ivScutcheon.getTag(); String tagScutcheon = (String) ivScutcheon.getTag();
if (tagScutcheon != null&&!tagScutcheon.equals("")) { if (tagScutcheon != null && !tagScutcheon.equals("")) {
photo.add(tagScutcheon); photo.add(tagScutcheon);
} }
String tagDevice = (String) ivDevice.getTag(); String tagDevice = (String) ivDevice.getTag();
if (tagDevice != null&&!tagDevice.equals("")) { if (tagDevice != null && !tagDevice.equals("")) {
photo.add(tagDevice); photo.add(tagDevice);
} }
String tagUsable = (String) ivUsable.getTag(); String tagUsable = (String) ivUsable.getTag();
if (tagUsable != null &&!tagUsable.equals("")) { if (tagUsable != null && !tagUsable.equals("")) {
photo.add(tagUsable); photo.add(tagUsable);
} }
String tagAvailable = (String) ivAvailable.getTag(); String tagAvailable = (String) ivAvailable.getTag();
if (tagAvailable != null&&!tagAvailable.equals("")) { if (tagAvailable != null && !tagAvailable.equals("")) {
photo.add(tagAvailable); photo.add(tagAvailable);
} }
String tagParking = (String) ivParking.getTag(); String tagParking = (String) ivParking.getTag();
if (tagParking != null&&!tagParking.equals("")) { if (tagParking != null && !tagParking.equals("")) {
photo.add(tagPanorama); photo.add(tagPanorama);
} }
String tagNumber = (String) ivNumber.getTag(); String tagNumber = (String) ivNumber.getTag();
if (tagNumber != null&&!tagNumber.equals("")) { if (tagNumber != null && !tagNumber.equals("")) {
photo.add(tagNumber); photo.add(tagNumber);
} }
chargingPileEntity.setPhotos(photo); chargingPileEntity.setPhotos(photo);
@ -1114,15 +1110,15 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
if (pid != null) { if (pid != null) {
chargingPileEntity.setFid(pid); chargingPileEntity.setFid(pid);
} }
if (buffer1!=null&&!buffer1.equals("")){ if (buffer1 != null && !buffer1.equals("")) {
chargingPileEntity.setCp_openType(buffer1); chargingPileEntity.setCp_openType(buffer1);
}else { } else {
openType.reverse(); openType.reverse();
openType.append(buffer2); openType.append(buffer2);
openType.append(buffer3); openType.append(buffer3);
openType.append(buffer4); openType.append(buffer4);
openType.append(buffer5); openType.append(buffer5);
if (openType!=null&&!"".equals(openType)&&openType.length()>0) { if (openType != null && !"".equals(openType) && openType.length() > 0) {
String charAt = openType.deleteCharAt(openType.length() - 1).toString(); String charAt = openType.deleteCharAt(openType.length() - 1).toString();
chargingPileEntity.setCp_openType(charAt); chargingPileEntity.setCp_openType(charAt);
} else { } else {
@ -1132,7 +1128,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
String newChargingPileEntity = new Gson().toJson(chargingPileEntity); String newChargingPileEntity = new Gson().toJson(chargingPileEntity);
//以键值对的形式添加新值 //以键值对的形式添加新值
edit.putString("chargingPileEntity", newChargingPileEntity); edit.putString("chargingPileEntity", newChargingPileEntity);
if (station!=null){ if (station != null) {
edit.putString("poiEntity", station); edit.putString("poiEntity", station);
} }
//提交新值必须执行否则前面的操作都无效 //提交新值必须执行否则前面的操作都无效
@ -1146,7 +1142,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
if (requestCode == 101 && resultCode == RESULT_OK) { if (requestCode == 101 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值 Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像 Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
takePhotoPath1 = PhotoPathUtil.getTakePhotoPath(data, "a",Geohash.getInstance().encode(latLng.latitude,latLng.longitude)); takePhotoPath1 = PhotoPathUtil.getTakePhotoPath(data, "a", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivPanorama.setTag(takePhotoPath1); ivPanorama.setTag(takePhotoPath1);
ivPanorama.setImageBitmap(bitmap);//显示图像 ivPanorama.setImageBitmap(bitmap);//显示图像
/* int height = bitmap.getHeight(); /* int height = bitmap.getHeight();
@ -1167,7 +1163,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
} else if (requestCode == 102 && resultCode == RESULT_OK) { } else if (requestCode == 102 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值 Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像 Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b",Geohash.getInstance().encode(latLng.latitude,latLng.longitude)); takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivCoding.setTag(takePhotoPath2); ivCoding.setTag(takePhotoPath2);
ivCoding.setImageBitmap(bitmap);//显示图像 ivCoding.setImageBitmap(bitmap);//显示图像
/* int height = bitmap.getHeight(); /* int height = bitmap.getHeight();
@ -1188,7 +1184,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
} else if (requestCode == 103 && resultCode == RESULT_OK) { } else if (requestCode == 103 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值 Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像 Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
takePhotoPath3 = PhotoPathUtil.getTakePhotoPath(data, "c",Geohash.getInstance().encode(latLng.latitude,latLng.longitude)); takePhotoPath3 = PhotoPathUtil.getTakePhotoPath(data, "c", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivEquipment.setImageBitmap(bitmap);//显示图像 ivEquipment.setImageBitmap(bitmap);//显示图像
ivEquipment.setTag(takePhotoPath3); ivEquipment.setTag(takePhotoPath3);
/* int height = bitmap.getHeight(); /* int height = bitmap.getHeight();
@ -1209,7 +1205,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
} else if (requestCode == 104 && resultCode == RESULT_OK) { } else if (requestCode == 104 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值 Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像 Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
takePhotoPath4 = PhotoPathUtil.getTakePhotoPath(data, "c",Geohash.getInstance().encode(latLng.latitude,latLng.longitude)); takePhotoPath4 = PhotoPathUtil.getTakePhotoPath(data, "c", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivFacility.setTag(takePhotoPath4); ivFacility.setTag(takePhotoPath4);
ivFacility.setImageBitmap(bitmap);//显示图像 ivFacility.setImageBitmap(bitmap);//显示图像
/* int height = bitmap.getHeight(); /* int height = bitmap.getHeight();
@ -1230,7 +1226,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
} else if (requestCode == 105 && resultCode == RESULT_OK) { } else if (requestCode == 105 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值 Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像 Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
takePhotoPath5 = PhotoPathUtil.getTakePhotoPath(data, "c",Geohash.getInstance().encode(latLng.latitude,latLng.longitude)); takePhotoPath5 = PhotoPathUtil.getTakePhotoPath(data, "c", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivScutcheon.setTag(takePhotoPath5); ivScutcheon.setTag(takePhotoPath5);
ivScutcheon.setImageBitmap(bitmap);//显示图像 ivScutcheon.setImageBitmap(bitmap);//显示图像
/* int height = bitmap.getHeight(); /* int height = bitmap.getHeight();
@ -1251,7 +1247,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
} else if (requestCode == 106 && resultCode == RESULT_OK) { } else if (requestCode == 106 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值 Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像 Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
takePhotoPath6 = PhotoPathUtil.getTakePhotoPath(data, "c",Geohash.getInstance().encode(latLng.latitude,latLng.longitude)); takePhotoPath6 = PhotoPathUtil.getTakePhotoPath(data, "c", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivDevice.setTag(takePhotoPath6); ivDevice.setTag(takePhotoPath6);
ivDevice.setImageBitmap(bitmap);//显示图像 ivDevice.setImageBitmap(bitmap);//显示图像
/* int height = bitmap.getHeight(); /* int height = bitmap.getHeight();
@ -1272,7 +1268,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
} else if (requestCode == 107 && resultCode == RESULT_OK) { } else if (requestCode == 107 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值 Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像 Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
takePhotoPath7 = PhotoPathUtil.getTakePhotoPath(data, "d",Geohash.getInstance().encode(latLng.latitude,latLng.longitude)); takePhotoPath7 = PhotoPathUtil.getTakePhotoPath(data, "d", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivUsable.setTag(takePhotoPath7); ivUsable.setTag(takePhotoPath7);
ivUsable.setImageBitmap(bitmap);//显示图像 ivUsable.setImageBitmap(bitmap);//显示图像
/* int height = bitmap.getHeight(); /* int height = bitmap.getHeight();
@ -1293,7 +1289,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
} else if (requestCode == 108 && resultCode == RESULT_OK) { } else if (requestCode == 108 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值 Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像 Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
takePhotoPath8 = PhotoPathUtil.getTakePhotoPath(data, "d",Geohash.getInstance().encode(latLng.latitude,latLng.longitude)); takePhotoPath8 = PhotoPathUtil.getTakePhotoPath(data, "d", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivAvailable.setTag(takePhotoPath8); ivAvailable.setTag(takePhotoPath8);
ivAvailable.setImageBitmap(bitmap);//显示图像 ivAvailable.setImageBitmap(bitmap);//显示图像
/* int height = bitmap.getHeight(); /* int height = bitmap.getHeight();
@ -1314,7 +1310,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
} else if (requestCode == 109 && resultCode == RESULT_OK) { } else if (requestCode == 109 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值 Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像 Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
takePhotoPath9 = PhotoPathUtil.getTakePhotoPath(data, "e",Geohash.getInstance().encode(latLng.latitude,latLng.longitude)); takePhotoPath9 = PhotoPathUtil.getTakePhotoPath(data, "e", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivParking.setImageBitmap(bitmap);//显示图像 ivParking.setImageBitmap(bitmap);//显示图像
ivParking.setTag(takePhotoPath9); ivParking.setTag(takePhotoPath9);
/* int height = bitmap.getHeight(); /* int height = bitmap.getHeight();
@ -1335,7 +1331,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
} else if (requestCode == 110 && resultCode == RESULT_OK) { } else if (requestCode == 110 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值 Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像 Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
takePhotoPath10 = PhotoPathUtil.getTakePhotoPath(data, "e",Geohash.getInstance().encode(latLng.latitude,latLng.longitude)); takePhotoPath10 = PhotoPathUtil.getTakePhotoPath(data, "e", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivNumber.setImageBitmap(bitmap);//显示图像 ivNumber.setImageBitmap(bitmap);//显示图像
ivNumber.setTag(takePhotoPath10); ivNumber.setTag(takePhotoPath10);
/* int height = bitmap.getHeight(); /* int height = bitmap.getHeight();

View File

@ -271,33 +271,39 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
// 根据用户点击的时间为视频名称赋值 // 根据用户点击的时间为视频名称赋值
DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss"); DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
String videoFormatName = formatter.format(new Date()); String videoFormatName = formatter.format(new Date());
Intent intent = new Intent(getContext(), PictureActivity.class); Intent intent = new Intent(getContext(), PicturesActivity.class);
intent.putExtra(Constant.INTENT_VIDEO_PATH, Constant.PICTURE_FOLDER + "/" + videoFormatName + ".mp4"); intent.putExtra(Constant.INTENT_VIDEO_PATH, Constant.PICTURE_FOLDER + "/" + videoFormatName + ".mp4");
startActivityForResult(intent, 0x101); startActivityForResult(intent, 0x101);
break; break;
case R.id.btn_poi_video_upload: case R.id.btn_poi_video_upload:
showLoadingDialog();
ArrayList<File> videoFileList = new ArrayList<>(); ArrayList<File> videoFileList = new ArrayList<>();
if (ivPoiVideoPicture.getTag() != null) { if (ivPoiVideoPicture.getTag() != null) {
showLoadingDialog();
File videoFile = (File) ivPoiVideoPicture.getTag(); File videoFile = (File) ivPoiVideoPicture.getTag();
videoFileList.add(videoFile); videoFileList.add(videoFile);
File file = new File(videoFile.getPath()+".txt"); File file = new File(videoFile.getPath()+".txt");
videoFileList.add(file); videoFileList.add(file);
fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip"); fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
ZipUtil.zipFiles(videoFileList, fileZip, null);
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
ZipUtil.zipFiles(videoFileList, fileZip, null);
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId()); PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
if (poiDaoPoiEntity == null || poiDaoPoiEntity.getTaskStatus() == 1 || poiDaoPoiEntity.getTaskStatus() == 2 || poiDaoPoiEntity.getTaskStatus() == 0) { if (poiDaoPoiEntity == null || poiDaoPoiEntity.getTaskStatus() == 1 || poiDaoPoiEntity.getTaskStatus() == 2 || poiDaoPoiEntity.getTaskStatus() == 0) {
dismissLoadingDialog(); getActivity().runOnUiThread(new Runnable() {
initPoiSaveLocal(true); @Override
public void run() {
dismissLoadingDialog();
initPoiSaveLocal(true);
}
});
} else { } else {
getActivity().runOnUiThread(new Runnable() { getActivity().runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
dismissLoadingDialog();
poiVideoUpload(poiDaoPoiEntity.getBodyId(), fileZip); poiVideoUpload(poiDaoPoiEntity.getBodyId(), fileZip);
} }
}); });
@ -306,6 +312,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
} }
}).start(); }).start();
}else { }else {
dismissLoadingDialog();
Toast.makeText(getContext(), "请录像", Toast.LENGTH_SHORT).show(); Toast.makeText(getContext(), "请录像", Toast.LENGTH_SHORT).show();
return; return;
} }
@ -314,7 +321,6 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
} }
public void initPoiSaveLocal(boolean isLocal) { public void initPoiSaveLocal(boolean isLocal) {
XXPermissions.with(getContext()) XXPermissions.with(getContext())
.permission(Permission.MANAGE_EXTERNAL_STORAGE) .permission(Permission.MANAGE_EXTERNAL_STORAGE)
.request(new OnPermissionCallback() { .request(new OnPermissionCallback() {
@ -441,6 +447,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
Toast.makeText(getActivity(), "未压缩完成", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "未压缩完成", Toast.LENGTH_SHORT).show();
return; return;
} }
showLoadingDialog();
OkGo OkGo
// 请求方式和请求url // 请求方式和请求url
.<OtherUploadPicBean>post(HttpInterface.POI_VIDEO_UPLOAD_PIC) .<OtherUploadPicBean>post(HttpInterface.POI_VIDEO_UPLOAD_PIC)

View File

@ -261,18 +261,20 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
startActivityForResult(intent, 0x101); startActivityForResult(intent, 0x101);
break; break;
case R.id.road_upload: case R.id.road_upload:
showLoadingDialog();
ArrayList<File> videoFileList = new ArrayList<>(); ArrayList<File> videoFileList = new ArrayList<>();
if (ivRoadPicture.getTag() != null) { if (ivRoadPicture.getTag() != null) {
showLoadingDialog();
File videoFile = (File) ivRoadPicture.getTag(); File videoFile = (File) ivRoadPicture.getTag();
videoFileList.add(videoFile); videoFileList.add(videoFile);
File file = new File(videoFile.getPath() + ".txt"); File file = new File(videoFile.getPath() + ".txt");
videoFileList.add(file); videoFileList.add(file);
fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip"); fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
ZipUtil.zipFiles(videoFileList, fileZip, null);
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
ZipUtil.zipFiles(videoFileList, fileZip, null);
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId()); PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
if (poiDaoPoiEntity == null || poiDaoPoiEntity.getTaskStatus() == 1 || poiDaoPoiEntity.getTaskStatus() == 2 || poiDaoPoiEntity.getTaskStatus() == 0) { if (poiDaoPoiEntity == null || poiDaoPoiEntity.getTaskStatus() == 1 || poiDaoPoiEntity.getTaskStatus() == 2 || poiDaoPoiEntity.getTaskStatus() == 0) {
dismissLoadingDialog(); dismissLoadingDialog();
@ -281,6 +283,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
getActivity().runOnUiThread(new Runnable() { getActivity().runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
dismissLoadingDialog();
poiVideoUpload(poiDaoPoiEntity.getBodyId(), fileZip); poiVideoUpload(poiDaoPoiEntity.getBodyId(), fileZip);
} }
}); });

View File

@ -1,195 +0,0 @@
<?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:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FF444444">
<com.otaliastudios.cameraview.CameraView
android:id="@+id/camera"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center"
android:keepScreenOn="true"
app:cameraAudio="on"
app:cameraAutoFocusMarker="@string/cameraview_default_autofocus_marker"
app:cameraEngine="camera2"
app:cameraExperimental="true"
app:cameraFacing="back"
app:cameraFlash="auto"
app:cameraGestureLongTap="none"
app:cameraGesturePinch="zoom"
app:cameraGestureScrollHorizontal="filterControl1"
app:cameraGestureScrollVertical="exposureCorrection"
app:cameraGestureTap="autoFocus"
app:cameraGrid="off"
app:cameraMode="picture"
app:cameraPlaySounds="true"
app:cameraPreview="glSurface"
app:layout_constraintBottom_toTopOf="@id/ll_caiji"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0"
tools:layout_editor_absoluteX="-76dp">
</com.otaliastudios.cameraview.CameraView>
<com.tencent.tencentmap.mapsdk.maps.MapView
android:id="@+id/iv_map"
android:layout_width="300dp"
android:layout_height="183dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/btn_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginRight="20dp"
android:text="切换"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
app:layout_constraintTop_toBottomOf="@id/btn_switch"
app:layout_constraintRight_toRightOf="@id/btn_switch"
android:id="@+id/btn_video"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="停止" />
<ImageView
android:id="@+id/iv_pic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/take_pic_arrow"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!-- <LinearLayout-->
<!-- android:id="@+id/ll_iv"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_gravity="bottom"-->
<!-- android:orientation="horizontal"-->
<!-- android:padding="16dp"-->
<!-- android:weightSum="4"-->
<!-- app:layout_constraintBottom_toBottomOf="parent">-->
<!-- <Space-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="1dp"-->
<!-- android:layout_weight="1" />-->
<LinearLayout
android:id="@+id/ll_caiji"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:layout_marginBottom="20dp"
app:layout_constraintBottom_toBottomOf="parent">
<Button
android:id="@+id/capuretVideo"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="开始采集"
android:layout_marginRight="10dp"
style="@style/user_data_style"/>
<Button
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="结束采集"
android:layout_marginLeft="10dp"
android:background="@drawable/uploding_shape"
android:textColor="@color/colorBlue"/>
<ImageButton
android:id="@+id/capturePicture"
android:layout_width="56dp"
android:layout_height="56dp"
android:visibility="gone"
android:background="?attr/selectableItemBackgroundBorderless"
app:srcCompat="@drawable/ic_photo" />
</LinearLayout>
<!-- <Space-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="1dp"-->
<!-- android:layout_weight="1" />-->
<!-- <Space-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="1dp"-->
<!-- android:layout_weight="1" />-->
<!-- <Space-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="1dp"-->
<!-- android:layout_weight="1" />-->
<!-- <Space-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="1dp"-->
<!-- android:layout_weight="1" />-->
<!-- <LinearLayout-->
<!-- android:id="@+id/capturePictureSnapshot"-->
<!-- android:layout_width="56dp"-->
<!-- android:layout_height="56dp"-->
<!-- android:background="?attr/selectableItemBackgroundBorderless"-->
<!-- android:gravity="center"-->
<!-- android:orientation="vertical"-->
<!-- android:visibility="gone">-->
<!-- <ImageView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- app:srcCompat="@drawable/ic_photo" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="SNAP"-->
<!-- android:textColor="@android:color/white"-->
<!-- android:textSize="10sp"-->
<!-- android:textStyle="bold" />-->
<!-- </LinearLayout>-->
<!-- <ImageButton-->
<!-- android:id="@+id/capuretVideo"-->
<!-- android:layout_width="56dp"-->
<!-- android:layout_height="56dp"-->
<!-- android:background="?attr/selectableItemBackgroundBorderless"-->
<!-- app:srcCompat="@drawable/ic_video" />-->
<!-- <LinearLayout-->
<!-- android:id="@+id/captureVideoSnapshot"-->
<!-- android:layout_width="56dp"-->
<!-- android:layout_height="56dp"-->
<!-- android:orientation="vertical"-->
<!-- android:background="?attr/selectableItemBackgroundBorderless"-->
<!-- android:gravity="center" >-->
<!-- <ImageView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- app:srcCompat="@drawable/ic_video"/>-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:textColor="@android:color/white"-->
<!-- android:textStyle="bold"-->
<!-- android:textSize="10sp"-->
<!-- android:text="SNAP"/>-->
<!-- </LinearLayout>-->
<!-- </LinearLayout>-->
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -40,15 +40,6 @@
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/btn_video"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="停止"
android:visibility="gone"
app:layout_constraintRight_toRightOf="@id/btn_switch"
app:layout_constraintTop_toBottomOf="@id/btn_switch" />
<ImageView <ImageView
android:id="@+id/iv_pic" android:id="@+id/iv_pic"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@ -6,21 +6,30 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#FF444444" android:background="#FF444444"
tools:context=".activity.PicturesActivity"> tools:context=".activity.PicturesActivity">
<FrameLayout
<com.otaliastudios.cameraview.CameraView android:id="@+id/layer_change"
android:id="@+id/cameraView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="match_parent">
app:layout_constraintTop_toTopOf="parent" <com.otaliastudios.cameraview.CameraView
app:layout_constraintLeft_toLeftOf="parent" android:id="@+id/camera"
/> android:layout_width="match_parent"
android:layout_height="match_parent"
android:keepScreenOn="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.tencent.tencentmap.mapsdk.maps.TextureMapView
android:id="@+id/iv_map"
android:layout_width="200dp"
android:layout_height="157dp"
app:layout_constraintHeight_default="percent"
app:layout_constraintHeight_percent="0.4"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_default="percent"
app:layout_constraintWidth_percent="0.4" />
</FrameLayout>
<!-- <com.tencent.tencentmap.mapsdk.maps.MapView-->
<!-- android:id="@+id/iv_map"-->
<!-- android:layout_width="300dp"-->
<!-- android:layout_height="183dp"-->
<!-- app:layout_constraintLeft_toLeftOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent" />-->
<Button <Button
android:id="@+id/btn_switch" android:id="@+id/btn_switch"
@ -32,23 +41,25 @@
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<ImageView <Button
android:id="@+id/iv_pic" android:id="@+id/btn_video"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@mipmap/take_pic_arrow" android:text="停止"
app:layout_constraintBottom_toBottomOf="parent" android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="@id/btn_switch"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toBottomOf="@id/btn_switch" />
app:layout_constraintTop_toTopOf="parent" />
<CheckBox
<Button
android:id="@+id/capuretVideo" android:id="@+id/capuretVideo"
style="@style/user_data_style" style="@style/user_data_style"
android:layout_width="100dp" android:layout_width="100dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="20dp" android:layout_marginBottom="20dp"
android:background="@drawable/user_style"
android:button="@null"
android:gravity="center"
android:padding="@dimen/fab_margin"
android:text="开始采集" android:text="开始采集"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"

View File

@ -150,7 +150,6 @@
android:layout_width="200dp" android:layout_width="200dp"
android:layout_height="100dp" android:layout_height="100dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
app:layout_constraintLeft_toLeftOf="@id/ll_pictures" app:layout_constraintLeft_toLeftOf="@id/ll_pictures"
app:layout_constraintTop_toBottomOf="@id/ll_pictures" /> app:layout_constraintTop_toBottomOf="@id/ll_pictures" />
<LinearLayout <LinearLayout

View File

@ -34,14 +34,6 @@
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/btn_video2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="停止"
android:visibility="gone"
app:layout_constraintRight_toRightOf="@id/btn_switch2"
app:layout_constraintTop_toBottomOf="@id/btn_switch2" />
<CheckBox <CheckBox
android:id="@+id/capuretVideo2" android:id="@+id/capuretVideo2"